hal/sandbox/PHal.ipdl

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set sw=2 ts=8 et ft=cpp : */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 include protocol PContent;
     8 include protocol PBrowser;
    10 using mozilla::dom::ScreenOrientation from "mozilla/dom/ScreenOrientation.h";
    11 using mozilla::hal::FlashMode from "mozilla/HalTypes.h";
    12 using mozilla::hal::LightType from "mozilla/HalTypes.h";
    13 using mozilla::hal::LightMode from "mozilla/HalTypes.h";
    14 using mozilla::hal::SensorType from "mozilla/HalSensor.h";
    15 using mozilla::hal::SensorAccuracyType from "mozilla/HalSensor.h";
    16 using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
    17 using mozilla::hal::SwitchState from "mozilla/HalTypes.h";
    18 using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h";
    19 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
    20 using struct nsIntRect from "nsRect.h";
    21 using PRTime from "prtime.h";
    22 using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h";
    23 using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h";
    24 using mozilla::hal::FMRadioOperationStatus from "mozilla/HalTypes.h";
    26 namespace mozilla {
    28 namespace hal {
    29 struct BatteryInformation {
    30   double level;
    31   bool   charging;
    32   double remainingTime;
    33 };
    35 struct LightConfiguration {
    36   LightType light;
    37   LightMode mode;
    38   FlashMode flash;
    39   uint32_t flashOnMS;
    40   uint32_t flashOffMS;
    41   uint32_t color;
    42 };
    44 struct SensorData {
    45   SensorType sensor;
    46   PRTime timestamp;
    47   float[] values;
    48   SensorAccuracyType accuracy;
    49 };
    51 struct NetworkInformation {
    52   uint32_t type;
    53   bool   isWifi;
    54   uint32_t dhcpGateway;
    55 };
    57 struct SwitchEvent {
    58   SwitchDevice device;
    59   SwitchState status;
    60 };
    62 struct WakeLockInformation {
    63   nsString topic;
    64   uint32_t numLocks;
    65   uint32_t numHidden;
    66   uint64_t[] lockingProcesses;
    67 };
    69 struct ScreenConfiguration {
    70   nsIntRect rect;
    71   ScreenOrientation orientation;
    72   uint32_t colorDepth;
    73   uint32_t pixelDepth;
    74 };
    76 struct FMRadioOperationInformation {
    77   FMRadioOperation operation;
    78   FMRadioOperationStatus status;
    79   uint32_t frequency;
    80 };
    82 struct FMRadioSettings {
    83   FMRadioCountry country;
    84   uint32_t upperLimit;
    85   uint32_t lowerLimit;
    86   uint32_t spaceType;
    87   uint32_t preEmphasis;
    88 };
    90 struct SystemTimezoneChangeInformation {
    91   // These timezone offsets are relative to UTC in minutes and
    92   // have already taken daylight saving time (DST) into account.
    93   int32_t oldTimezoneOffsetMinutes;
    94   int32_t newTimezoneOffsetMinutes;
    95 };
    97 } // namespace hal
    99 namespace hal_sandbox {
   101 sync protocol PHal {
   102     manager PContent;
   104 child:
   105     NotifyBatteryChange(BatteryInformation aBatteryInfo);
   106     NotifyNetworkChange(NetworkInformation aNetworkInfo);
   107     NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
   108     NotifyScreenConfigurationChange(ScreenConfiguration aScreenOrientation);
   109     NotifySwitchChange(SwitchEvent aEvent);
   110     NotifySystemClockChange(int64_t aClockDeltaMS); 
   111     NotifySystemTimezoneChange(SystemTimezoneChangeInformation aSystemTimezoneChangeInfo); 
   113 parent:
   114     Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
   115     CancelVibrate(uint64_t[] id, PBrowser browser);
   117     EnableBatteryNotifications();
   118     DisableBatteryNotifications();
   119     sync GetCurrentBatteryInformation()
   120       returns (BatteryInformation aBatteryInfo);
   122     EnableNetworkNotifications();
   123     DisableNetworkNotifications();
   124     sync GetCurrentNetworkInformation()
   125       returns (NetworkInformation aNetworkInfo);
   127     sync GetScreenEnabled() returns (bool enabled);
   128     SetScreenEnabled(bool enabled);
   130     sync GetCpuSleepAllowed() returns (bool allowed);
   131     SetCpuSleepAllowed(bool allowed);
   133     sync GetScreenBrightness() returns (double brightness);
   134     SetScreenBrightness(double brightness);
   136     AdjustSystemClock(int64_t aDeltaMilliseconds);
   137     SetTimezone(nsCString aTimezoneSpec);
   138     sync GetTimezone()
   139       returns (nsCString aTimezoneSpec);
   140     sync GetTimezoneOffset()
   141       returns (int32_t aTimezoneOffset);
   142     EnableSystemClockChangeNotifications();
   143     DisableSystemClockChangeNotifications();
   144     EnableSystemTimezoneChangeNotifications();
   145     DisableSystemTimezoneChangeNotifications();
   147     sync SetLight(LightType light, LightConfiguration aConfig)
   148       returns (bool status);
   149     sync GetLight(LightType light)
   150       returns (LightConfiguration aConfig, bool status);
   152     ModifyWakeLock(nsString aTopic,
   153                    WakeLockControl aLockAdjust,
   154                    WakeLockControl aHiddenAdjust,
   155                    uint64_t aProcessID);
   156     EnableWakeLockNotifications();
   157     DisableWakeLockNotifications();
   158     sync GetWakeLockInfo(nsString aTopic)
   159       returns (WakeLockInformation aWakeLockInfo);
   161     EnableScreenConfigurationNotifications();
   162     DisableScreenConfigurationNotifications();
   163     sync GetCurrentScreenConfiguration()
   164       returns (ScreenConfiguration aScreenConfiguration);
   165     sync LockScreenOrientation(ScreenOrientation aOrientation)
   166       returns (bool allowed);
   167     UnlockScreenOrientation();
   169     EnableSwitchNotifications(SwitchDevice aDevice);
   170     DisableSwitchNotifications(SwitchDevice aDevice);
   171     sync GetCurrentSwitchState(SwitchDevice aDevice)
   172       returns (SwitchState aState);
   173     NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState);
   175     FactoryReset();
   177 child:
   178     NotifySensorChange(SensorData aSensorData);
   180 parent:
   181     EnableSensorNotifications(SensorType aSensor);
   182     DisableSensorNotifications(SensorType aSensor);
   184     __delete__();
   185 };
   187 } // namespace hal
   188 } // namespace mozilla

mercurial