Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
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 | #ifndef mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |
michael@0 | 8 | #define mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |
michael@0 | 9 | |
michael@0 | 10 | #include "BluetoothService.h" |
michael@0 | 11 | |
michael@0 | 12 | namespace mozilla { |
michael@0 | 13 | namespace ipc { |
michael@0 | 14 | class UnixSocketConsumer; |
michael@0 | 15 | } |
michael@0 | 16 | namespace dom { |
michael@0 | 17 | namespace bluetooth { |
michael@0 | 18 | |
michael@0 | 19 | class BluetoothChild; |
michael@0 | 20 | |
michael@0 | 21 | } // namespace bluetooth |
michael@0 | 22 | } // namespace dom |
michael@0 | 23 | } // namespace mozilla |
michael@0 | 24 | |
michael@0 | 25 | |
michael@0 | 26 | BEGIN_BLUETOOTH_NAMESPACE |
michael@0 | 27 | |
michael@0 | 28 | class BluetoothServiceChildProcess : public BluetoothService |
michael@0 | 29 | { |
michael@0 | 30 | friend class mozilla::dom::bluetooth::BluetoothChild; |
michael@0 | 31 | |
michael@0 | 32 | public: |
michael@0 | 33 | static BluetoothServiceChildProcess* |
michael@0 | 34 | Create(); |
michael@0 | 35 | |
michael@0 | 36 | virtual void |
michael@0 | 37 | RegisterBluetoothSignalHandler(const nsAString& aNodeName, |
michael@0 | 38 | BluetoothSignalObserver* aMsgHandler) |
michael@0 | 39 | MOZ_OVERRIDE; |
michael@0 | 40 | |
michael@0 | 41 | virtual void |
michael@0 | 42 | UnregisterBluetoothSignalHandler(const nsAString& aNodeName, |
michael@0 | 43 | BluetoothSignalObserver* aMsgHandler) |
michael@0 | 44 | MOZ_OVERRIDE; |
michael@0 | 45 | |
michael@0 | 46 | virtual nsresult |
michael@0 | 47 | GetDefaultAdapterPathInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 48 | |
michael@0 | 49 | virtual nsresult |
michael@0 | 50 | GetPairedDevicePropertiesInternal(const nsTArray<nsString>& aDeviceAddresses, |
michael@0 | 51 | BluetoothReplyRunnable* aRunnable) |
michael@0 | 52 | MOZ_OVERRIDE; |
michael@0 | 53 | |
michael@0 | 54 | virtual nsresult |
michael@0 | 55 | GetConnectedDevicePropertiesInternal(uint16_t aServiceUuid, |
michael@0 | 56 | BluetoothReplyRunnable* aRunnable) |
michael@0 | 57 | MOZ_OVERRIDE; |
michael@0 | 58 | virtual nsresult |
michael@0 | 59 | StopDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 60 | |
michael@0 | 61 | virtual nsresult |
michael@0 | 62 | StartDiscoveryInternal(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 63 | |
michael@0 | 64 | virtual nsresult |
michael@0 | 65 | SetProperty(BluetoothObjectType aType, |
michael@0 | 66 | const BluetoothNamedValue& aValue, |
michael@0 | 67 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 68 | |
michael@0 | 69 | virtual nsresult |
michael@0 | 70 | CreatePairedDeviceInternal(const nsAString& aAddress, |
michael@0 | 71 | int aTimeout, |
michael@0 | 72 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 73 | |
michael@0 | 74 | virtual nsresult |
michael@0 | 75 | RemoveDeviceInternal(const nsAString& aObjectPath, |
michael@0 | 76 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 77 | |
michael@0 | 78 | virtual nsresult |
michael@0 | 79 | GetServiceChannel(const nsAString& aDeviceAddress, |
michael@0 | 80 | const nsAString& aServiceUuid, |
michael@0 | 81 | BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; |
michael@0 | 82 | |
michael@0 | 83 | virtual bool |
michael@0 | 84 | UpdateSdpRecords(const nsAString& aDeviceAddress, |
michael@0 | 85 | BluetoothProfileManagerBase* aManager) MOZ_OVERRIDE; |
michael@0 | 86 | |
michael@0 | 87 | virtual bool |
michael@0 | 88 | SetPinCodeInternal(const nsAString& aDeviceAddress, |
michael@0 | 89 | const nsAString& aPinCode, |
michael@0 | 90 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 91 | |
michael@0 | 92 | virtual bool |
michael@0 | 93 | SetPasskeyInternal(const nsAString& aDeviceAddress, |
michael@0 | 94 | uint32_t aPasskey, |
michael@0 | 95 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 96 | |
michael@0 | 97 | virtual bool |
michael@0 | 98 | SetPairingConfirmationInternal(const nsAString& aDeviceAddress, |
michael@0 | 99 | bool aConfirm, |
michael@0 | 100 | BluetoothReplyRunnable* aRunnable) |
michael@0 | 101 | MOZ_OVERRIDE; |
michael@0 | 102 | |
michael@0 | 103 | virtual void |
michael@0 | 104 | Connect(const nsAString& aDeviceAddress, |
michael@0 | 105 | uint32_t aCod, |
michael@0 | 106 | uint16_t aServiceUuid, |
michael@0 | 107 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 108 | |
michael@0 | 109 | virtual void |
michael@0 | 110 | Disconnect(const nsAString& aDeviceAddress, |
michael@0 | 111 | uint16_t aServiceUuid, |
michael@0 | 112 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 113 | |
michael@0 | 114 | virtual bool |
michael@0 | 115 | IsConnected(uint16_t aServiceUuid) MOZ_OVERRIDE; |
michael@0 | 116 | |
michael@0 | 117 | virtual void |
michael@0 | 118 | SendFile(const nsAString& aDeviceAddress, |
michael@0 | 119 | BlobParent* aBlobParent, |
michael@0 | 120 | BlobChild* aBlobChild, |
michael@0 | 121 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 122 | |
michael@0 | 123 | virtual void |
michael@0 | 124 | SendFile(const nsAString& aDeviceAddress, |
michael@0 | 125 | nsIDOMBlob* aBlob, |
michael@0 | 126 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 127 | |
michael@0 | 128 | virtual void |
michael@0 | 129 | StopSendingFile(const nsAString& aDeviceAddress, |
michael@0 | 130 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 131 | |
michael@0 | 132 | virtual void |
michael@0 | 133 | ConfirmReceivingFile(const nsAString& aDeviceAddress, |
michael@0 | 134 | bool aConfirm, |
michael@0 | 135 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 136 | |
michael@0 | 137 | virtual void |
michael@0 | 138 | ConnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 139 | |
michael@0 | 140 | virtual void |
michael@0 | 141 | DisconnectSco(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 142 | |
michael@0 | 143 | virtual void |
michael@0 | 144 | IsScoConnected(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 145 | |
michael@0 | 146 | #ifdef MOZ_B2G_RIL |
michael@0 | 147 | virtual void |
michael@0 | 148 | AnswerWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 149 | |
michael@0 | 150 | virtual void |
michael@0 | 151 | IgnoreWaitingCall(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 152 | |
michael@0 | 153 | virtual void |
michael@0 | 154 | ToggleCalls(BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 155 | #endif |
michael@0 | 156 | |
michael@0 | 157 | virtual void |
michael@0 | 158 | SendMetaData(const nsAString& aTitle, |
michael@0 | 159 | const nsAString& aArtist, |
michael@0 | 160 | const nsAString& aAlbum, |
michael@0 | 161 | int64_t aMediaNumber, |
michael@0 | 162 | int64_t aTotalMediaCount, |
michael@0 | 163 | int64_t aDuration, |
michael@0 | 164 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 165 | |
michael@0 | 166 | virtual void |
michael@0 | 167 | SendPlayStatus(int64_t aDuration, |
michael@0 | 168 | int64_t aPosition, |
michael@0 | 169 | const nsAString& aPlayStatus, |
michael@0 | 170 | BluetoothReplyRunnable* aRunnable) MOZ_OVERRIDE; |
michael@0 | 171 | |
michael@0 | 172 | virtual void |
michael@0 | 173 | UpdatePlayStatus(uint32_t aDuration, |
michael@0 | 174 | uint32_t aPosition, |
michael@0 | 175 | ControlPlayStatus aPlayStatus) MOZ_OVERRIDE; |
michael@0 | 176 | |
michael@0 | 177 | virtual nsresult |
michael@0 | 178 | SendSinkMessage(const nsAString& aDeviceAddresses, |
michael@0 | 179 | const nsAString& aMessage) MOZ_OVERRIDE; |
michael@0 | 180 | |
michael@0 | 181 | virtual nsresult |
michael@0 | 182 | SendInputMessage(const nsAString& aDeviceAddresses, |
michael@0 | 183 | const nsAString& aMessage) MOZ_OVERRIDE; |
michael@0 | 184 | |
michael@0 | 185 | protected: |
michael@0 | 186 | BluetoothServiceChildProcess(); |
michael@0 | 187 | virtual ~BluetoothServiceChildProcess(); |
michael@0 | 188 | |
michael@0 | 189 | void |
michael@0 | 190 | NoteDeadActor(); |
michael@0 | 191 | |
michael@0 | 192 | void |
michael@0 | 193 | NoteShutdownInitiated(); |
michael@0 | 194 | |
michael@0 | 195 | virtual nsresult |
michael@0 | 196 | HandleStartup() MOZ_OVERRIDE; |
michael@0 | 197 | |
michael@0 | 198 | virtual nsresult |
michael@0 | 199 | HandleShutdown() MOZ_OVERRIDE; |
michael@0 | 200 | |
michael@0 | 201 | private: |
michael@0 | 202 | // This method should never be called. |
michael@0 | 203 | virtual nsresult |
michael@0 | 204 | StartInternal() MOZ_OVERRIDE; |
michael@0 | 205 | |
michael@0 | 206 | // This method should never be called. |
michael@0 | 207 | virtual nsresult |
michael@0 | 208 | StopInternal() MOZ_OVERRIDE; |
michael@0 | 209 | |
michael@0 | 210 | bool |
michael@0 | 211 | IsSignalRegistered(const nsAString& aNodeName) { |
michael@0 | 212 | return !!mBluetoothSignalObserverTable.Get(aNodeName); |
michael@0 | 213 | } |
michael@0 | 214 | }; |
michael@0 | 215 | |
michael@0 | 216 | END_BLUETOOTH_NAMESPACE |
michael@0 | 217 | |
michael@0 | 218 | #endif // mozilla_dom_bluetooth_ipc_bluetoothservicechildprocess_h__ |