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