tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

PHal.ipdl (2800B)


      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/. */
      6 
      7 include protocol PContent;
      8 include protocol PBrowser;
      9 
     10 include "mozilla/dom/ReferrerInfoUtils.h";
     11 include "mozilla/GfxMessageUtils.h";
     12 
     13 using mozilla::hal::ScreenOrientation from "mozilla/HalIPCUtils.h";
     14 using mozilla::hal::SensorType from "mozilla/HalSensor.h";
     15 using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h";
     16 using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h";
     17 using nsIntRect from "nsRect.h";
     18 using PRTime from "prtime.h";
     19 
     20 namespace mozilla {
     21 
     22 namespace hal {
     23 struct BatteryInformation {
     24   double level;
     25   bool   charging;
     26   double remainingTime;
     27 };
     28 
     29 struct SensorData {
     30   SensorType sensor;
     31   PRTime timestamp;
     32   float[] values;
     33 };
     34 
     35 struct NetworkInformation {
     36   uint32_t type;
     37   bool   isWifi;
     38   uint32_t dhcpGateway;
     39 };
     40 
     41 struct WakeLockInformation {
     42   nsString topic;
     43   uint32_t numLocks;
     44   uint32_t numHidden;
     45   uint64_t[] lockingProcesses;
     46 };
     47 
     48 } // namespace hal
     49 
     50 namespace hal_sandbox {
     51 
     52 [ManualDealloc, ChildImpl=virtual, ParentImpl=virtual]
     53 sync protocol PHal {
     54     manager PContent;
     55 
     56 child:
     57     async NotifyBatteryChange(BatteryInformation aBatteryInfo);
     58     async NotifyNetworkChange(NetworkInformation aNetworkInfo);
     59     async NotifyWakeLockChange(WakeLockInformation aWakeLockInfo);
     60 
     61 parent:
     62     async Vibrate(uint32_t[] pattern, uint64_t[] id, PBrowser browser);
     63     async CancelVibrate(uint64_t[] id, PBrowser browser);
     64 
     65     async EnableBatteryNotifications();
     66     async DisableBatteryNotifications();
     67     sync GetCurrentBatteryInformation()
     68       returns (BatteryInformation aBatteryInfo);
     69 
     70     async EnableNetworkNotifications();
     71     async DisableNetworkNotifications();
     72     sync GetCurrentNetworkInformation()
     73       returns (NetworkInformation aNetworkInfo);
     74 
     75     async ModifyWakeLock(nsString aTopic,
     76                          WakeLockControl aLockAdjust,
     77                          WakeLockControl aHiddenAdjust);
     78     async EnableWakeLockNotifications();
     79     async DisableWakeLockNotifications();
     80     sync GetWakeLockInfo(nsString aTopic)
     81       returns (WakeLockInformation aWakeLockInfo);
     82 
     83     async LockScreenOrientation(ScreenOrientation aOrientation)
     84       returns (nsresult result);
     85     async UnlockScreenOrientation();
     86 
     87     async PerformHapticFeedback(int32_t aType);
     88 
     89 child:
     90     async NotifySensorChange(SensorData aSensorData);
     91 
     92 parent:
     93     async EnableSensorNotifications(SensorType aSensor);
     94     async DisableSensorNotifications(SensorType aSensor);
     95 
     96     async __delete__();
     97 };
     98 
     99 } // namespace hal
    100 } // namespace mozilla