Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
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 file, |
michael@0 | 5 | * You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "Hal.h" |
michael@0 | 8 | #include "mozilla/AppProcessChecker.h" |
michael@0 | 9 | #include "mozilla/dom/ContentChild.h" |
michael@0 | 10 | #include "mozilla/dom/ContentParent.h" |
michael@0 | 11 | #include "mozilla/hal_sandbox/PHalChild.h" |
michael@0 | 12 | #include "mozilla/hal_sandbox/PHalParent.h" |
michael@0 | 13 | #include "mozilla/dom/TabParent.h" |
michael@0 | 14 | #include "mozilla/dom/TabChild.h" |
michael@0 | 15 | #include "mozilla/dom/battery/Types.h" |
michael@0 | 16 | #include "mozilla/dom/network/Types.h" |
michael@0 | 17 | #include "mozilla/dom/ScreenOrientation.h" |
michael@0 | 18 | #include "mozilla/Observer.h" |
michael@0 | 19 | #include "mozilla/unused.h" |
michael@0 | 20 | #include "WindowIdentifier.h" |
michael@0 | 21 | |
michael@0 | 22 | using namespace mozilla; |
michael@0 | 23 | using namespace mozilla::dom; |
michael@0 | 24 | using namespace mozilla::hal; |
michael@0 | 25 | |
michael@0 | 26 | namespace mozilla { |
michael@0 | 27 | namespace hal_sandbox { |
michael@0 | 28 | |
michael@0 | 29 | static bool sHalChildDestroyed = false; |
michael@0 | 30 | |
michael@0 | 31 | bool |
michael@0 | 32 | HalChildDestroyed() |
michael@0 | 33 | { |
michael@0 | 34 | return sHalChildDestroyed; |
michael@0 | 35 | } |
michael@0 | 36 | |
michael@0 | 37 | static PHalChild* sHal; |
michael@0 | 38 | static PHalChild* |
michael@0 | 39 | Hal() |
michael@0 | 40 | { |
michael@0 | 41 | if (!sHal) { |
michael@0 | 42 | sHal = ContentChild::GetSingleton()->SendPHalConstructor(); |
michael@0 | 43 | } |
michael@0 | 44 | return sHal; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | void |
michael@0 | 48 | Vibrate(const nsTArray<uint32_t>& pattern, const WindowIdentifier &id) |
michael@0 | 49 | { |
michael@0 | 50 | HAL_LOG(("Vibrate: Sending to parent process.")); |
michael@0 | 51 | |
michael@0 | 52 | AutoInfallibleTArray<uint32_t, 8> p(pattern); |
michael@0 | 53 | |
michael@0 | 54 | WindowIdentifier newID(id); |
michael@0 | 55 | newID.AppendProcessID(); |
michael@0 | 56 | Hal()->SendVibrate(p, newID.AsArray(), TabChild::GetFrom(newID.GetWindow())); |
michael@0 | 57 | } |
michael@0 | 58 | |
michael@0 | 59 | void |
michael@0 | 60 | CancelVibrate(const WindowIdentifier &id) |
michael@0 | 61 | { |
michael@0 | 62 | HAL_LOG(("CancelVibrate: Sending to parent process.")); |
michael@0 | 63 | |
michael@0 | 64 | WindowIdentifier newID(id); |
michael@0 | 65 | newID.AppendProcessID(); |
michael@0 | 66 | Hal()->SendCancelVibrate(newID.AsArray(), TabChild::GetFrom(newID.GetWindow())); |
michael@0 | 67 | } |
michael@0 | 68 | |
michael@0 | 69 | void |
michael@0 | 70 | EnableBatteryNotifications() |
michael@0 | 71 | { |
michael@0 | 72 | Hal()->SendEnableBatteryNotifications(); |
michael@0 | 73 | } |
michael@0 | 74 | |
michael@0 | 75 | void |
michael@0 | 76 | DisableBatteryNotifications() |
michael@0 | 77 | { |
michael@0 | 78 | Hal()->SendDisableBatteryNotifications(); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | void |
michael@0 | 82 | GetCurrentBatteryInformation(BatteryInformation* aBatteryInfo) |
michael@0 | 83 | { |
michael@0 | 84 | Hal()->SendGetCurrentBatteryInformation(aBatteryInfo); |
michael@0 | 85 | } |
michael@0 | 86 | |
michael@0 | 87 | void |
michael@0 | 88 | EnableNetworkNotifications() |
michael@0 | 89 | { |
michael@0 | 90 | Hal()->SendEnableNetworkNotifications(); |
michael@0 | 91 | } |
michael@0 | 92 | |
michael@0 | 93 | void |
michael@0 | 94 | DisableNetworkNotifications() |
michael@0 | 95 | { |
michael@0 | 96 | Hal()->SendDisableNetworkNotifications(); |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | void |
michael@0 | 100 | GetCurrentNetworkInformation(NetworkInformation* aNetworkInfo) |
michael@0 | 101 | { |
michael@0 | 102 | Hal()->SendGetCurrentNetworkInformation(aNetworkInfo); |
michael@0 | 103 | } |
michael@0 | 104 | |
michael@0 | 105 | void |
michael@0 | 106 | EnableScreenConfigurationNotifications() |
michael@0 | 107 | { |
michael@0 | 108 | Hal()->SendEnableScreenConfigurationNotifications(); |
michael@0 | 109 | } |
michael@0 | 110 | |
michael@0 | 111 | void |
michael@0 | 112 | DisableScreenConfigurationNotifications() |
michael@0 | 113 | { |
michael@0 | 114 | Hal()->SendDisableScreenConfigurationNotifications(); |
michael@0 | 115 | } |
michael@0 | 116 | |
michael@0 | 117 | void |
michael@0 | 118 | GetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) |
michael@0 | 119 | { |
michael@0 | 120 | Hal()->SendGetCurrentScreenConfiguration(aScreenConfiguration); |
michael@0 | 121 | } |
michael@0 | 122 | |
michael@0 | 123 | bool |
michael@0 | 124 | LockScreenOrientation(const dom::ScreenOrientation& aOrientation) |
michael@0 | 125 | { |
michael@0 | 126 | bool allowed; |
michael@0 | 127 | Hal()->SendLockScreenOrientation(aOrientation, &allowed); |
michael@0 | 128 | return allowed; |
michael@0 | 129 | } |
michael@0 | 130 | |
michael@0 | 131 | void |
michael@0 | 132 | UnlockScreenOrientation() |
michael@0 | 133 | { |
michael@0 | 134 | Hal()->SendUnlockScreenOrientation(); |
michael@0 | 135 | } |
michael@0 | 136 | |
michael@0 | 137 | bool |
michael@0 | 138 | GetScreenEnabled() |
michael@0 | 139 | { |
michael@0 | 140 | bool enabled = false; |
michael@0 | 141 | Hal()->SendGetScreenEnabled(&enabled); |
michael@0 | 142 | return enabled; |
michael@0 | 143 | } |
michael@0 | 144 | |
michael@0 | 145 | void |
michael@0 | 146 | SetScreenEnabled(bool enabled) |
michael@0 | 147 | { |
michael@0 | 148 | Hal()->SendSetScreenEnabled(enabled); |
michael@0 | 149 | } |
michael@0 | 150 | |
michael@0 | 151 | bool |
michael@0 | 152 | GetCpuSleepAllowed() |
michael@0 | 153 | { |
michael@0 | 154 | bool allowed = true; |
michael@0 | 155 | Hal()->SendGetCpuSleepAllowed(&allowed); |
michael@0 | 156 | return allowed; |
michael@0 | 157 | } |
michael@0 | 158 | |
michael@0 | 159 | void |
michael@0 | 160 | SetCpuSleepAllowed(bool allowed) |
michael@0 | 161 | { |
michael@0 | 162 | Hal()->SendSetCpuSleepAllowed(allowed); |
michael@0 | 163 | } |
michael@0 | 164 | |
michael@0 | 165 | double |
michael@0 | 166 | GetScreenBrightness() |
michael@0 | 167 | { |
michael@0 | 168 | double brightness = 0; |
michael@0 | 169 | Hal()->SendGetScreenBrightness(&brightness); |
michael@0 | 170 | return brightness; |
michael@0 | 171 | } |
michael@0 | 172 | |
michael@0 | 173 | void |
michael@0 | 174 | SetScreenBrightness(double brightness) |
michael@0 | 175 | { |
michael@0 | 176 | Hal()->SendSetScreenBrightness(brightness); |
michael@0 | 177 | } |
michael@0 | 178 | |
michael@0 | 179 | bool |
michael@0 | 180 | SetLight(hal::LightType light, const hal::LightConfiguration& aConfig) |
michael@0 | 181 | { |
michael@0 | 182 | bool status; |
michael@0 | 183 | Hal()->SendSetLight(light, aConfig, &status); |
michael@0 | 184 | return status; |
michael@0 | 185 | } |
michael@0 | 186 | |
michael@0 | 187 | bool |
michael@0 | 188 | GetLight(hal::LightType light, hal::LightConfiguration* aConfig) |
michael@0 | 189 | { |
michael@0 | 190 | bool status; |
michael@0 | 191 | Hal()->SendGetLight(light, aConfig, &status); |
michael@0 | 192 | return status; |
michael@0 | 193 | } |
michael@0 | 194 | |
michael@0 | 195 | void |
michael@0 | 196 | AdjustSystemClock(int64_t aDeltaMilliseconds) |
michael@0 | 197 | { |
michael@0 | 198 | Hal()->SendAdjustSystemClock(aDeltaMilliseconds); |
michael@0 | 199 | } |
michael@0 | 200 | |
michael@0 | 201 | void |
michael@0 | 202 | SetTimezone(const nsCString& aTimezoneSpec) |
michael@0 | 203 | { |
michael@0 | 204 | Hal()->SendSetTimezone(nsCString(aTimezoneSpec)); |
michael@0 | 205 | } |
michael@0 | 206 | |
michael@0 | 207 | nsCString |
michael@0 | 208 | GetTimezone() |
michael@0 | 209 | { |
michael@0 | 210 | nsCString timezone; |
michael@0 | 211 | Hal()->SendGetTimezone(&timezone); |
michael@0 | 212 | return timezone; |
michael@0 | 213 | } |
michael@0 | 214 | |
michael@0 | 215 | int32_t |
michael@0 | 216 | GetTimezoneOffset() |
michael@0 | 217 | { |
michael@0 | 218 | int32_t timezoneOffset; |
michael@0 | 219 | Hal()->SendGetTimezoneOffset(&timezoneOffset); |
michael@0 | 220 | return timezoneOffset; |
michael@0 | 221 | } |
michael@0 | 222 | |
michael@0 | 223 | void |
michael@0 | 224 | EnableSystemClockChangeNotifications() |
michael@0 | 225 | { |
michael@0 | 226 | Hal()->SendEnableSystemClockChangeNotifications(); |
michael@0 | 227 | } |
michael@0 | 228 | |
michael@0 | 229 | void |
michael@0 | 230 | DisableSystemClockChangeNotifications() |
michael@0 | 231 | { |
michael@0 | 232 | Hal()->SendDisableSystemClockChangeNotifications(); |
michael@0 | 233 | } |
michael@0 | 234 | |
michael@0 | 235 | void |
michael@0 | 236 | EnableSystemTimezoneChangeNotifications() |
michael@0 | 237 | { |
michael@0 | 238 | Hal()->SendEnableSystemTimezoneChangeNotifications(); |
michael@0 | 239 | } |
michael@0 | 240 | |
michael@0 | 241 | void |
michael@0 | 242 | DisableSystemTimezoneChangeNotifications() |
michael@0 | 243 | { |
michael@0 | 244 | Hal()->SendDisableSystemTimezoneChangeNotifications(); |
michael@0 | 245 | } |
michael@0 | 246 | |
michael@0 | 247 | void |
michael@0 | 248 | Reboot() |
michael@0 | 249 | { |
michael@0 | 250 | NS_RUNTIMEABORT("Reboot() can't be called from sandboxed contexts."); |
michael@0 | 251 | } |
michael@0 | 252 | |
michael@0 | 253 | void |
michael@0 | 254 | PowerOff() |
michael@0 | 255 | { |
michael@0 | 256 | NS_RUNTIMEABORT("PowerOff() can't be called from sandboxed contexts."); |
michael@0 | 257 | } |
michael@0 | 258 | |
michael@0 | 259 | void |
michael@0 | 260 | StartForceQuitWatchdog(ShutdownMode aMode, int32_t aTimeoutSecs) |
michael@0 | 261 | { |
michael@0 | 262 | NS_RUNTIMEABORT("StartForceQuitWatchdog() can't be called from sandboxed contexts."); |
michael@0 | 263 | } |
michael@0 | 264 | |
michael@0 | 265 | void |
michael@0 | 266 | EnableSensorNotifications(SensorType aSensor) { |
michael@0 | 267 | Hal()->SendEnableSensorNotifications(aSensor); |
michael@0 | 268 | } |
michael@0 | 269 | |
michael@0 | 270 | void |
michael@0 | 271 | DisableSensorNotifications(SensorType aSensor) { |
michael@0 | 272 | Hal()->SendDisableSensorNotifications(aSensor); |
michael@0 | 273 | } |
michael@0 | 274 | |
michael@0 | 275 | //TODO: bug 852944 - IPC implementations of these |
michael@0 | 276 | void StartMonitoringGamepadStatus() |
michael@0 | 277 | {} |
michael@0 | 278 | |
michael@0 | 279 | void StopMonitoringGamepadStatus() |
michael@0 | 280 | {} |
michael@0 | 281 | |
michael@0 | 282 | void |
michael@0 | 283 | EnableWakeLockNotifications() |
michael@0 | 284 | { |
michael@0 | 285 | Hal()->SendEnableWakeLockNotifications(); |
michael@0 | 286 | } |
michael@0 | 287 | |
michael@0 | 288 | void |
michael@0 | 289 | DisableWakeLockNotifications() |
michael@0 | 290 | { |
michael@0 | 291 | Hal()->SendDisableWakeLockNotifications(); |
michael@0 | 292 | } |
michael@0 | 293 | |
michael@0 | 294 | void |
michael@0 | 295 | ModifyWakeLock(const nsAString &aTopic, |
michael@0 | 296 | WakeLockControl aLockAdjust, |
michael@0 | 297 | WakeLockControl aHiddenAdjust, |
michael@0 | 298 | uint64_t aProcessID) |
michael@0 | 299 | { |
michael@0 | 300 | MOZ_ASSERT(aProcessID != CONTENT_PROCESS_ID_UNKNOWN); |
michael@0 | 301 | Hal()->SendModifyWakeLock(nsString(aTopic), aLockAdjust, aHiddenAdjust, aProcessID); |
michael@0 | 302 | } |
michael@0 | 303 | |
michael@0 | 304 | void |
michael@0 | 305 | GetWakeLockInfo(const nsAString &aTopic, WakeLockInformation *aWakeLockInfo) |
michael@0 | 306 | { |
michael@0 | 307 | Hal()->SendGetWakeLockInfo(nsString(aTopic), aWakeLockInfo); |
michael@0 | 308 | } |
michael@0 | 309 | |
michael@0 | 310 | void |
michael@0 | 311 | EnableSwitchNotifications(SwitchDevice aDevice) |
michael@0 | 312 | { |
michael@0 | 313 | Hal()->SendEnableSwitchNotifications(aDevice); |
michael@0 | 314 | } |
michael@0 | 315 | |
michael@0 | 316 | void |
michael@0 | 317 | DisableSwitchNotifications(SwitchDevice aDevice) |
michael@0 | 318 | { |
michael@0 | 319 | Hal()->SendDisableSwitchNotifications(aDevice); |
michael@0 | 320 | } |
michael@0 | 321 | |
michael@0 | 322 | SwitchState |
michael@0 | 323 | GetCurrentSwitchState(SwitchDevice aDevice) |
michael@0 | 324 | { |
michael@0 | 325 | SwitchState state; |
michael@0 | 326 | Hal()->SendGetCurrentSwitchState(aDevice, &state); |
michael@0 | 327 | return state; |
michael@0 | 328 | } |
michael@0 | 329 | |
michael@0 | 330 | void |
michael@0 | 331 | NotifySwitchStateFromInputDevice(SwitchDevice aDevice, SwitchState aState) |
michael@0 | 332 | { |
michael@0 | 333 | Hal()->SendNotifySwitchStateFromInputDevice(aDevice, aState); |
michael@0 | 334 | } |
michael@0 | 335 | |
michael@0 | 336 | bool |
michael@0 | 337 | EnableAlarm() |
michael@0 | 338 | { |
michael@0 | 339 | NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet."); |
michael@0 | 340 | return false; |
michael@0 | 341 | } |
michael@0 | 342 | |
michael@0 | 343 | void |
michael@0 | 344 | DisableAlarm() |
michael@0 | 345 | { |
michael@0 | 346 | NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet."); |
michael@0 | 347 | } |
michael@0 | 348 | |
michael@0 | 349 | bool |
michael@0 | 350 | SetAlarm(int32_t aSeconds, int32_t aNanoseconds) |
michael@0 | 351 | { |
michael@0 | 352 | NS_RUNTIMEABORT("Alarms can't be programmed from sandboxed contexts. Yet."); |
michael@0 | 353 | return false; |
michael@0 | 354 | } |
michael@0 | 355 | |
michael@0 | 356 | void |
michael@0 | 357 | SetProcessPriority(int aPid, |
michael@0 | 358 | ProcessPriority aPriority, |
michael@0 | 359 | ProcessCPUPriority aCPUPriority, |
michael@0 | 360 | uint32_t aBackgroundLRU) |
michael@0 | 361 | { |
michael@0 | 362 | NS_RUNTIMEABORT("Only the main process may set processes' priorities."); |
michael@0 | 363 | } |
michael@0 | 364 | |
michael@0 | 365 | void |
michael@0 | 366 | EnableFMRadio(const hal::FMRadioSettings& aSettings) |
michael@0 | 367 | { |
michael@0 | 368 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 369 | } |
michael@0 | 370 | |
michael@0 | 371 | void |
michael@0 | 372 | DisableFMRadio() |
michael@0 | 373 | { |
michael@0 | 374 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 375 | } |
michael@0 | 376 | |
michael@0 | 377 | void |
michael@0 | 378 | FMRadioSeek(const hal::FMRadioSeekDirection& aDirection) |
michael@0 | 379 | { |
michael@0 | 380 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 381 | } |
michael@0 | 382 | |
michael@0 | 383 | void |
michael@0 | 384 | GetFMRadioSettings(FMRadioSettings* aSettings) |
michael@0 | 385 | { |
michael@0 | 386 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 387 | } |
michael@0 | 388 | |
michael@0 | 389 | void |
michael@0 | 390 | SetFMRadioFrequency(const uint32_t aFrequency) |
michael@0 | 391 | { |
michael@0 | 392 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 393 | } |
michael@0 | 394 | |
michael@0 | 395 | uint32_t |
michael@0 | 396 | GetFMRadioFrequency() |
michael@0 | 397 | { |
michael@0 | 398 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 399 | return 0; |
michael@0 | 400 | } |
michael@0 | 401 | |
michael@0 | 402 | bool |
michael@0 | 403 | IsFMRadioOn() |
michael@0 | 404 | { |
michael@0 | 405 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 406 | return false; |
michael@0 | 407 | } |
michael@0 | 408 | |
michael@0 | 409 | uint32_t |
michael@0 | 410 | GetFMRadioSignalStrength() |
michael@0 | 411 | { |
michael@0 | 412 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 413 | return 0; |
michael@0 | 414 | } |
michael@0 | 415 | |
michael@0 | 416 | void |
michael@0 | 417 | CancelFMRadioSeek() |
michael@0 | 418 | { |
michael@0 | 419 | NS_RUNTIMEABORT("FM radio cannot be called from sandboxed contexts."); |
michael@0 | 420 | } |
michael@0 | 421 | |
michael@0 | 422 | void |
michael@0 | 423 | FactoryReset() |
michael@0 | 424 | { |
michael@0 | 425 | Hal()->SendFactoryReset(); |
michael@0 | 426 | } |
michael@0 | 427 | |
michael@0 | 428 | void |
michael@0 | 429 | StartDiskSpaceWatcher() |
michael@0 | 430 | { |
michael@0 | 431 | NS_RUNTIMEABORT("StartDiskSpaceWatcher() can't be called from sandboxed contexts."); |
michael@0 | 432 | } |
michael@0 | 433 | |
michael@0 | 434 | void |
michael@0 | 435 | StopDiskSpaceWatcher() |
michael@0 | 436 | { |
michael@0 | 437 | NS_RUNTIMEABORT("StopDiskSpaceWatcher() can't be called from sandboxed contexts."); |
michael@0 | 438 | } |
michael@0 | 439 | |
michael@0 | 440 | class HalParent : public PHalParent |
michael@0 | 441 | , public BatteryObserver |
michael@0 | 442 | , public NetworkObserver |
michael@0 | 443 | , public ISensorObserver |
michael@0 | 444 | , public WakeLockObserver |
michael@0 | 445 | , public ScreenConfigurationObserver |
michael@0 | 446 | , public SwitchObserver |
michael@0 | 447 | , public SystemClockChangeObserver |
michael@0 | 448 | , public SystemTimezoneChangeObserver |
michael@0 | 449 | { |
michael@0 | 450 | public: |
michael@0 | 451 | virtual void |
michael@0 | 452 | ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE |
michael@0 | 453 | { |
michael@0 | 454 | // NB: you *must* unconditionally unregister your observer here, |
michael@0 | 455 | // if it *may* be registered below. |
michael@0 | 456 | hal::UnregisterBatteryObserver(this); |
michael@0 | 457 | hal::UnregisterNetworkObserver(this); |
michael@0 | 458 | hal::UnregisterScreenConfigurationObserver(this); |
michael@0 | 459 | for (int32_t sensor = SENSOR_UNKNOWN + 1; |
michael@0 | 460 | sensor < NUM_SENSOR_TYPE; ++sensor) { |
michael@0 | 461 | hal::UnregisterSensorObserver(SensorType(sensor), this); |
michael@0 | 462 | } |
michael@0 | 463 | hal::UnregisterWakeLockObserver(this); |
michael@0 | 464 | hal::UnregisterSystemClockChangeObserver(this); |
michael@0 | 465 | hal::UnregisterSystemTimezoneChangeObserver(this); |
michael@0 | 466 | for (int32_t switchDevice = SWITCH_DEVICE_UNKNOWN + 1; |
michael@0 | 467 | switchDevice < NUM_SWITCH_DEVICE; ++switchDevice) { |
michael@0 | 468 | hal::UnregisterSwitchObserver(SwitchDevice(switchDevice), this); |
michael@0 | 469 | } |
michael@0 | 470 | } |
michael@0 | 471 | |
michael@0 | 472 | virtual bool |
michael@0 | 473 | RecvVibrate(const InfallibleTArray<unsigned int>& pattern, |
michael@0 | 474 | const InfallibleTArray<uint64_t> &id, |
michael@0 | 475 | PBrowserParent *browserParent) MOZ_OVERRIDE |
michael@0 | 476 | { |
michael@0 | 477 | // We give all content vibration permission. |
michael@0 | 478 | TabParent *tabParent = static_cast<TabParent*>(browserParent); |
michael@0 | 479 | nsCOMPtr<nsIDOMWindow> window = |
michael@0 | 480 | do_QueryInterface(tabParent->GetBrowserDOMWindow()); |
michael@0 | 481 | WindowIdentifier newID(id, window); |
michael@0 | 482 | hal::Vibrate(pattern, newID); |
michael@0 | 483 | return true; |
michael@0 | 484 | } |
michael@0 | 485 | |
michael@0 | 486 | virtual bool |
michael@0 | 487 | RecvCancelVibrate(const InfallibleTArray<uint64_t> &id, |
michael@0 | 488 | PBrowserParent *browserParent) MOZ_OVERRIDE |
michael@0 | 489 | { |
michael@0 | 490 | TabParent *tabParent = static_cast<TabParent*>(browserParent); |
michael@0 | 491 | nsCOMPtr<nsIDOMWindow> window = |
michael@0 | 492 | do_QueryInterface(tabParent->GetBrowserDOMWindow()); |
michael@0 | 493 | WindowIdentifier newID(id, window); |
michael@0 | 494 | hal::CancelVibrate(newID); |
michael@0 | 495 | return true; |
michael@0 | 496 | } |
michael@0 | 497 | |
michael@0 | 498 | virtual bool |
michael@0 | 499 | RecvEnableBatteryNotifications() MOZ_OVERRIDE { |
michael@0 | 500 | // We give all content battery-status permission. |
michael@0 | 501 | hal::RegisterBatteryObserver(this); |
michael@0 | 502 | return true; |
michael@0 | 503 | } |
michael@0 | 504 | |
michael@0 | 505 | virtual bool |
michael@0 | 506 | RecvDisableBatteryNotifications() MOZ_OVERRIDE { |
michael@0 | 507 | hal::UnregisterBatteryObserver(this); |
michael@0 | 508 | return true; |
michael@0 | 509 | } |
michael@0 | 510 | |
michael@0 | 511 | virtual bool |
michael@0 | 512 | RecvGetCurrentBatteryInformation(BatteryInformation* aBatteryInfo) MOZ_OVERRIDE { |
michael@0 | 513 | // We give all content battery-status permission. |
michael@0 | 514 | hal::GetCurrentBatteryInformation(aBatteryInfo); |
michael@0 | 515 | return true; |
michael@0 | 516 | } |
michael@0 | 517 | |
michael@0 | 518 | void Notify(const BatteryInformation& aBatteryInfo) MOZ_OVERRIDE { |
michael@0 | 519 | unused << SendNotifyBatteryChange(aBatteryInfo); |
michael@0 | 520 | } |
michael@0 | 521 | |
michael@0 | 522 | virtual bool |
michael@0 | 523 | RecvEnableNetworkNotifications() MOZ_OVERRIDE { |
michael@0 | 524 | // We give all content access to this network-status information. |
michael@0 | 525 | hal::RegisterNetworkObserver(this); |
michael@0 | 526 | return true; |
michael@0 | 527 | } |
michael@0 | 528 | |
michael@0 | 529 | virtual bool |
michael@0 | 530 | RecvDisableNetworkNotifications() MOZ_OVERRIDE { |
michael@0 | 531 | hal::UnregisterNetworkObserver(this); |
michael@0 | 532 | return true; |
michael@0 | 533 | } |
michael@0 | 534 | |
michael@0 | 535 | virtual bool |
michael@0 | 536 | RecvGetCurrentNetworkInformation(NetworkInformation* aNetworkInfo) MOZ_OVERRIDE { |
michael@0 | 537 | hal::GetCurrentNetworkInformation(aNetworkInfo); |
michael@0 | 538 | return true; |
michael@0 | 539 | } |
michael@0 | 540 | |
michael@0 | 541 | void Notify(const NetworkInformation& aNetworkInfo) { |
michael@0 | 542 | unused << SendNotifyNetworkChange(aNetworkInfo); |
michael@0 | 543 | } |
michael@0 | 544 | |
michael@0 | 545 | virtual bool |
michael@0 | 546 | RecvEnableScreenConfigurationNotifications() MOZ_OVERRIDE { |
michael@0 | 547 | // Screen configuration is used to implement CSS and DOM |
michael@0 | 548 | // properties, so all content already has access to this. |
michael@0 | 549 | hal::RegisterScreenConfigurationObserver(this); |
michael@0 | 550 | return true; |
michael@0 | 551 | } |
michael@0 | 552 | |
michael@0 | 553 | virtual bool |
michael@0 | 554 | RecvDisableScreenConfigurationNotifications() MOZ_OVERRIDE { |
michael@0 | 555 | hal::UnregisterScreenConfigurationObserver(this); |
michael@0 | 556 | return true; |
michael@0 | 557 | } |
michael@0 | 558 | |
michael@0 | 559 | virtual bool |
michael@0 | 560 | RecvGetCurrentScreenConfiguration(ScreenConfiguration* aScreenConfiguration) MOZ_OVERRIDE { |
michael@0 | 561 | hal::GetCurrentScreenConfiguration(aScreenConfiguration); |
michael@0 | 562 | return true; |
michael@0 | 563 | } |
michael@0 | 564 | |
michael@0 | 565 | virtual bool |
michael@0 | 566 | RecvLockScreenOrientation(const dom::ScreenOrientation& aOrientation, bool* aAllowed) MOZ_OVERRIDE |
michael@0 | 567 | { |
michael@0 | 568 | // FIXME/bug 777980: unprivileged content may only lock |
michael@0 | 569 | // orientation while fullscreen. We should check whether the |
michael@0 | 570 | // request comes from an actor in a process that might be |
michael@0 | 571 | // fullscreen. We don't have that information currently. |
michael@0 | 572 | *aAllowed = hal::LockScreenOrientation(aOrientation); |
michael@0 | 573 | return true; |
michael@0 | 574 | } |
michael@0 | 575 | |
michael@0 | 576 | virtual bool |
michael@0 | 577 | RecvUnlockScreenOrientation() MOZ_OVERRIDE |
michael@0 | 578 | { |
michael@0 | 579 | hal::UnlockScreenOrientation(); |
michael@0 | 580 | return true; |
michael@0 | 581 | } |
michael@0 | 582 | |
michael@0 | 583 | void Notify(const ScreenConfiguration& aScreenConfiguration) { |
michael@0 | 584 | unused << SendNotifyScreenConfigurationChange(aScreenConfiguration); |
michael@0 | 585 | } |
michael@0 | 586 | |
michael@0 | 587 | virtual bool |
michael@0 | 588 | RecvGetScreenEnabled(bool *enabled) MOZ_OVERRIDE |
michael@0 | 589 | { |
michael@0 | 590 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 591 | return false; |
michael@0 | 592 | } |
michael@0 | 593 | *enabled = hal::GetScreenEnabled(); |
michael@0 | 594 | return true; |
michael@0 | 595 | } |
michael@0 | 596 | |
michael@0 | 597 | virtual bool |
michael@0 | 598 | RecvSetScreenEnabled(const bool &enabled) MOZ_OVERRIDE |
michael@0 | 599 | { |
michael@0 | 600 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 601 | return false; |
michael@0 | 602 | } |
michael@0 | 603 | hal::SetScreenEnabled(enabled); |
michael@0 | 604 | return true; |
michael@0 | 605 | } |
michael@0 | 606 | |
michael@0 | 607 | virtual bool |
michael@0 | 608 | RecvGetCpuSleepAllowed(bool *allowed) MOZ_OVERRIDE |
michael@0 | 609 | { |
michael@0 | 610 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 611 | return false; |
michael@0 | 612 | } |
michael@0 | 613 | *allowed = hal::GetCpuSleepAllowed(); |
michael@0 | 614 | return true; |
michael@0 | 615 | } |
michael@0 | 616 | |
michael@0 | 617 | virtual bool |
michael@0 | 618 | RecvSetCpuSleepAllowed(const bool &allowed) MOZ_OVERRIDE |
michael@0 | 619 | { |
michael@0 | 620 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 621 | return false; |
michael@0 | 622 | } |
michael@0 | 623 | hal::SetCpuSleepAllowed(allowed); |
michael@0 | 624 | return true; |
michael@0 | 625 | } |
michael@0 | 626 | |
michael@0 | 627 | virtual bool |
michael@0 | 628 | RecvGetScreenBrightness(double *brightness) MOZ_OVERRIDE |
michael@0 | 629 | { |
michael@0 | 630 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 631 | return false; |
michael@0 | 632 | } |
michael@0 | 633 | *brightness = hal::GetScreenBrightness(); |
michael@0 | 634 | return true; |
michael@0 | 635 | } |
michael@0 | 636 | |
michael@0 | 637 | virtual bool |
michael@0 | 638 | RecvSetScreenBrightness(const double &brightness) MOZ_OVERRIDE |
michael@0 | 639 | { |
michael@0 | 640 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 641 | return false; |
michael@0 | 642 | } |
michael@0 | 643 | hal::SetScreenBrightness(brightness); |
michael@0 | 644 | return true; |
michael@0 | 645 | } |
michael@0 | 646 | |
michael@0 | 647 | virtual bool |
michael@0 | 648 | RecvSetLight(const LightType& aLight, const hal::LightConfiguration& aConfig, bool *status) MOZ_OVERRIDE |
michael@0 | 649 | { |
michael@0 | 650 | // XXX currently, the hardware key light and screen backlight are |
michael@0 | 651 | // controlled as a unit. Those are set through the power API, and |
michael@0 | 652 | // there's no other way to poke lights currently, so we require |
michael@0 | 653 | // "power" privileges here. |
michael@0 | 654 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 655 | return false; |
michael@0 | 656 | } |
michael@0 | 657 | *status = hal::SetLight(aLight, aConfig); |
michael@0 | 658 | return true; |
michael@0 | 659 | } |
michael@0 | 660 | |
michael@0 | 661 | virtual bool |
michael@0 | 662 | RecvGetLight(const LightType& aLight, LightConfiguration* aConfig, bool* status) MOZ_OVERRIDE |
michael@0 | 663 | { |
michael@0 | 664 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 665 | return false; |
michael@0 | 666 | } |
michael@0 | 667 | *status = hal::GetLight(aLight, aConfig); |
michael@0 | 668 | return true; |
michael@0 | 669 | } |
michael@0 | 670 | |
michael@0 | 671 | virtual bool |
michael@0 | 672 | RecvAdjustSystemClock(const int64_t &aDeltaMilliseconds) MOZ_OVERRIDE |
michael@0 | 673 | { |
michael@0 | 674 | if (!AssertAppProcessPermission(this, "time")) { |
michael@0 | 675 | return false; |
michael@0 | 676 | } |
michael@0 | 677 | hal::AdjustSystemClock(aDeltaMilliseconds); |
michael@0 | 678 | return true; |
michael@0 | 679 | } |
michael@0 | 680 | |
michael@0 | 681 | virtual bool |
michael@0 | 682 | RecvSetTimezone(const nsCString& aTimezoneSpec) MOZ_OVERRIDE |
michael@0 | 683 | { |
michael@0 | 684 | if (!AssertAppProcessPermission(this, "time")) { |
michael@0 | 685 | return false; |
michael@0 | 686 | } |
michael@0 | 687 | hal::SetTimezone(aTimezoneSpec); |
michael@0 | 688 | return true; |
michael@0 | 689 | } |
michael@0 | 690 | |
michael@0 | 691 | virtual bool |
michael@0 | 692 | RecvGetTimezone(nsCString *aTimezoneSpec) MOZ_OVERRIDE |
michael@0 | 693 | { |
michael@0 | 694 | if (!AssertAppProcessPermission(this, "time")) { |
michael@0 | 695 | return false; |
michael@0 | 696 | } |
michael@0 | 697 | *aTimezoneSpec = hal::GetTimezone(); |
michael@0 | 698 | return true; |
michael@0 | 699 | } |
michael@0 | 700 | |
michael@0 | 701 | virtual bool |
michael@0 | 702 | RecvGetTimezoneOffset(int32_t *aTimezoneOffset) MOZ_OVERRIDE |
michael@0 | 703 | { |
michael@0 | 704 | if (!AssertAppProcessPermission(this, "time")) { |
michael@0 | 705 | return false; |
michael@0 | 706 | } |
michael@0 | 707 | *aTimezoneOffset = hal::GetTimezoneOffset(); |
michael@0 | 708 | return true; |
michael@0 | 709 | } |
michael@0 | 710 | |
michael@0 | 711 | virtual bool |
michael@0 | 712 | RecvEnableSystemClockChangeNotifications() MOZ_OVERRIDE |
michael@0 | 713 | { |
michael@0 | 714 | hal::RegisterSystemClockChangeObserver(this); |
michael@0 | 715 | return true; |
michael@0 | 716 | } |
michael@0 | 717 | |
michael@0 | 718 | virtual bool |
michael@0 | 719 | RecvDisableSystemClockChangeNotifications() MOZ_OVERRIDE |
michael@0 | 720 | { |
michael@0 | 721 | hal::UnregisterSystemClockChangeObserver(this); |
michael@0 | 722 | return true; |
michael@0 | 723 | } |
michael@0 | 724 | |
michael@0 | 725 | virtual bool |
michael@0 | 726 | RecvEnableSystemTimezoneChangeNotifications() MOZ_OVERRIDE |
michael@0 | 727 | { |
michael@0 | 728 | hal::RegisterSystemTimezoneChangeObserver(this); |
michael@0 | 729 | return true; |
michael@0 | 730 | } |
michael@0 | 731 | |
michael@0 | 732 | virtual bool |
michael@0 | 733 | RecvDisableSystemTimezoneChangeNotifications() MOZ_OVERRIDE |
michael@0 | 734 | { |
michael@0 | 735 | hal::UnregisterSystemTimezoneChangeObserver(this); |
michael@0 | 736 | return true; |
michael@0 | 737 | } |
michael@0 | 738 | |
michael@0 | 739 | virtual bool |
michael@0 | 740 | RecvEnableSensorNotifications(const SensorType &aSensor) MOZ_OVERRIDE { |
michael@0 | 741 | // We currently allow any content to register device-sensor |
michael@0 | 742 | // listeners. |
michael@0 | 743 | hal::RegisterSensorObserver(aSensor, this); |
michael@0 | 744 | return true; |
michael@0 | 745 | } |
michael@0 | 746 | |
michael@0 | 747 | virtual bool |
michael@0 | 748 | RecvDisableSensorNotifications(const SensorType &aSensor) MOZ_OVERRIDE { |
michael@0 | 749 | hal::UnregisterSensorObserver(aSensor, this); |
michael@0 | 750 | return true; |
michael@0 | 751 | } |
michael@0 | 752 | |
michael@0 | 753 | void Notify(const SensorData& aSensorData) { |
michael@0 | 754 | unused << SendNotifySensorChange(aSensorData); |
michael@0 | 755 | } |
michael@0 | 756 | |
michael@0 | 757 | virtual bool |
michael@0 | 758 | RecvModifyWakeLock(const nsString& aTopic, |
michael@0 | 759 | const WakeLockControl& aLockAdjust, |
michael@0 | 760 | const WakeLockControl& aHiddenAdjust, |
michael@0 | 761 | const uint64_t& aProcessID) MOZ_OVERRIDE |
michael@0 | 762 | { |
michael@0 | 763 | MOZ_ASSERT(aProcessID != CONTENT_PROCESS_ID_UNKNOWN); |
michael@0 | 764 | |
michael@0 | 765 | // We allow arbitrary content to use wake locks. |
michael@0 | 766 | hal::ModifyWakeLock(aTopic, aLockAdjust, aHiddenAdjust, aProcessID); |
michael@0 | 767 | return true; |
michael@0 | 768 | } |
michael@0 | 769 | |
michael@0 | 770 | virtual bool |
michael@0 | 771 | RecvEnableWakeLockNotifications() MOZ_OVERRIDE |
michael@0 | 772 | { |
michael@0 | 773 | // We allow arbitrary content to use wake locks. |
michael@0 | 774 | hal::RegisterWakeLockObserver(this); |
michael@0 | 775 | return true; |
michael@0 | 776 | } |
michael@0 | 777 | |
michael@0 | 778 | virtual bool |
michael@0 | 779 | RecvDisableWakeLockNotifications() MOZ_OVERRIDE |
michael@0 | 780 | { |
michael@0 | 781 | hal::UnregisterWakeLockObserver(this); |
michael@0 | 782 | return true; |
michael@0 | 783 | } |
michael@0 | 784 | |
michael@0 | 785 | virtual bool |
michael@0 | 786 | RecvGetWakeLockInfo(const nsString &aTopic, WakeLockInformation *aWakeLockInfo) MOZ_OVERRIDE |
michael@0 | 787 | { |
michael@0 | 788 | hal::GetWakeLockInfo(aTopic, aWakeLockInfo); |
michael@0 | 789 | return true; |
michael@0 | 790 | } |
michael@0 | 791 | |
michael@0 | 792 | void Notify(const WakeLockInformation& aWakeLockInfo) |
michael@0 | 793 | { |
michael@0 | 794 | unused << SendNotifyWakeLockChange(aWakeLockInfo); |
michael@0 | 795 | } |
michael@0 | 796 | |
michael@0 | 797 | virtual bool |
michael@0 | 798 | RecvEnableSwitchNotifications(const SwitchDevice& aDevice) MOZ_OVERRIDE |
michael@0 | 799 | { |
michael@0 | 800 | // Content has no reason to listen to switch events currently. |
michael@0 | 801 | hal::RegisterSwitchObserver(aDevice, this); |
michael@0 | 802 | return true; |
michael@0 | 803 | } |
michael@0 | 804 | |
michael@0 | 805 | virtual bool |
michael@0 | 806 | RecvDisableSwitchNotifications(const SwitchDevice& aDevice) MOZ_OVERRIDE |
michael@0 | 807 | { |
michael@0 | 808 | hal::UnregisterSwitchObserver(aDevice, this); |
michael@0 | 809 | return true; |
michael@0 | 810 | } |
michael@0 | 811 | |
michael@0 | 812 | void Notify(const SwitchEvent& aSwitchEvent) |
michael@0 | 813 | { |
michael@0 | 814 | unused << SendNotifySwitchChange(aSwitchEvent); |
michael@0 | 815 | } |
michael@0 | 816 | |
michael@0 | 817 | virtual bool |
michael@0 | 818 | RecvGetCurrentSwitchState(const SwitchDevice& aDevice, hal::SwitchState *aState) MOZ_OVERRIDE |
michael@0 | 819 | { |
michael@0 | 820 | // Content has no reason to listen to switch events currently. |
michael@0 | 821 | *aState = hal::GetCurrentSwitchState(aDevice); |
michael@0 | 822 | return true; |
michael@0 | 823 | } |
michael@0 | 824 | |
michael@0 | 825 | virtual bool |
michael@0 | 826 | RecvNotifySwitchStateFromInputDevice(const SwitchDevice& aDevice, |
michael@0 | 827 | const SwitchState& aState) MOZ_OVERRIDE |
michael@0 | 828 | { |
michael@0 | 829 | hal::NotifySwitchStateFromInputDevice(aDevice, aState); |
michael@0 | 830 | return true; |
michael@0 | 831 | } |
michael@0 | 832 | |
michael@0 | 833 | void Notify(const int64_t& aClockDeltaMS) |
michael@0 | 834 | { |
michael@0 | 835 | unused << SendNotifySystemClockChange(aClockDeltaMS); |
michael@0 | 836 | } |
michael@0 | 837 | |
michael@0 | 838 | void Notify(const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) |
michael@0 | 839 | { |
michael@0 | 840 | unused << SendNotifySystemTimezoneChange(aSystemTimezoneChangeInfo); |
michael@0 | 841 | } |
michael@0 | 842 | |
michael@0 | 843 | virtual bool |
michael@0 | 844 | RecvFactoryReset() |
michael@0 | 845 | { |
michael@0 | 846 | if (!AssertAppProcessPermission(this, "power")) { |
michael@0 | 847 | return false; |
michael@0 | 848 | } |
michael@0 | 849 | hal::FactoryReset(); |
michael@0 | 850 | return true; |
michael@0 | 851 | } |
michael@0 | 852 | |
michael@0 | 853 | virtual mozilla::ipc::IProtocol* |
michael@0 | 854 | CloneProtocol(Channel* aChannel, |
michael@0 | 855 | mozilla::ipc::ProtocolCloneContext* aCtx) MOZ_OVERRIDE |
michael@0 | 856 | { |
michael@0 | 857 | ContentParent* contentParent = aCtx->GetContentParent(); |
michael@0 | 858 | nsAutoPtr<PHalParent> actor(contentParent->AllocPHalParent()); |
michael@0 | 859 | if (!actor || !contentParent->RecvPHalConstructor(actor)) { |
michael@0 | 860 | return nullptr; |
michael@0 | 861 | } |
michael@0 | 862 | return actor.forget(); |
michael@0 | 863 | } |
michael@0 | 864 | }; |
michael@0 | 865 | |
michael@0 | 866 | class HalChild : public PHalChild { |
michael@0 | 867 | public: |
michael@0 | 868 | virtual void |
michael@0 | 869 | ActorDestroy(ActorDestroyReason aWhy) MOZ_OVERRIDE |
michael@0 | 870 | { |
michael@0 | 871 | sHalChildDestroyed = true; |
michael@0 | 872 | } |
michael@0 | 873 | |
michael@0 | 874 | virtual bool |
michael@0 | 875 | RecvNotifyBatteryChange(const BatteryInformation& aBatteryInfo) MOZ_OVERRIDE { |
michael@0 | 876 | hal::NotifyBatteryChange(aBatteryInfo); |
michael@0 | 877 | return true; |
michael@0 | 878 | } |
michael@0 | 879 | |
michael@0 | 880 | virtual bool |
michael@0 | 881 | RecvNotifySensorChange(const hal::SensorData &aSensorData) MOZ_OVERRIDE; |
michael@0 | 882 | |
michael@0 | 883 | virtual bool |
michael@0 | 884 | RecvNotifyNetworkChange(const NetworkInformation& aNetworkInfo) MOZ_OVERRIDE { |
michael@0 | 885 | hal::NotifyNetworkChange(aNetworkInfo); |
michael@0 | 886 | return true; |
michael@0 | 887 | } |
michael@0 | 888 | |
michael@0 | 889 | virtual bool |
michael@0 | 890 | RecvNotifyWakeLockChange(const WakeLockInformation& aWakeLockInfo) MOZ_OVERRIDE { |
michael@0 | 891 | hal::NotifyWakeLockChange(aWakeLockInfo); |
michael@0 | 892 | return true; |
michael@0 | 893 | } |
michael@0 | 894 | |
michael@0 | 895 | virtual bool |
michael@0 | 896 | RecvNotifyScreenConfigurationChange(const ScreenConfiguration& aScreenConfiguration) MOZ_OVERRIDE { |
michael@0 | 897 | hal::NotifyScreenConfigurationChange(aScreenConfiguration); |
michael@0 | 898 | return true; |
michael@0 | 899 | } |
michael@0 | 900 | |
michael@0 | 901 | virtual bool |
michael@0 | 902 | RecvNotifySwitchChange(const mozilla::hal::SwitchEvent& aEvent) MOZ_OVERRIDE { |
michael@0 | 903 | hal::NotifySwitchChange(aEvent); |
michael@0 | 904 | return true; |
michael@0 | 905 | } |
michael@0 | 906 | |
michael@0 | 907 | virtual bool |
michael@0 | 908 | RecvNotifySystemClockChange(const int64_t& aClockDeltaMS) { |
michael@0 | 909 | hal::NotifySystemClockChange(aClockDeltaMS); |
michael@0 | 910 | return true; |
michael@0 | 911 | } |
michael@0 | 912 | |
michael@0 | 913 | virtual bool |
michael@0 | 914 | RecvNotifySystemTimezoneChange( |
michael@0 | 915 | const SystemTimezoneChangeInformation& aSystemTimezoneChangeInfo) { |
michael@0 | 916 | hal::NotifySystemTimezoneChange(aSystemTimezoneChangeInfo); |
michael@0 | 917 | return true; |
michael@0 | 918 | } |
michael@0 | 919 | }; |
michael@0 | 920 | |
michael@0 | 921 | bool |
michael@0 | 922 | HalChild::RecvNotifySensorChange(const hal::SensorData &aSensorData) { |
michael@0 | 923 | hal::NotifySensorChange(aSensorData); |
michael@0 | 924 | |
michael@0 | 925 | return true; |
michael@0 | 926 | } |
michael@0 | 927 | |
michael@0 | 928 | PHalChild* CreateHalChild() { |
michael@0 | 929 | return new HalChild(); |
michael@0 | 930 | } |
michael@0 | 931 | |
michael@0 | 932 | PHalParent* CreateHalParent() { |
michael@0 | 933 | return new HalParent(); |
michael@0 | 934 | } |
michael@0 | 935 | |
michael@0 | 936 | } // namespace hal_sandbox |
michael@0 | 937 | } // namespace mozilla |