OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_AP
I_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_AP
I_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_AP
I_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE_AP
I_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" |
11 #include "extensions/browser/browser_context_keyed_api_factory.h" | 12 #include "extensions/browser/browser_context_keyed_api_factory.h" |
12 #include "extensions/browser/extension_function.h" | 13 #include "extensions/browser/extension_function.h" |
13 | 14 |
14 // Implementations for chrome.easyUnlockPrivate API functions. | 15 // Implementations for chrome.easyUnlockPrivate API functions. |
15 | 16 |
16 namespace content { | 17 namespace content { |
17 class BrowserContext; | 18 class BrowserContext; |
18 } | 19 } |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 namespace api { | 22 namespace api { |
22 | 23 |
23 namespace easy_unlock { | 24 namespace easy_unlock { |
24 struct SeekDeviceResult; | 25 struct SeekDeviceResult; |
25 } // easy_unlock | 26 } // easy_unlock |
26 | 27 |
27 class EasyUnlockPrivateCryptoDelegate; | 28 class EasyUnlockPrivateCryptoDelegate; |
28 | 29 |
29 class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI { | 30 class EasyUnlockPrivateAPI : public BrowserContextKeyedAPI { |
30 public: | 31 public: |
31 static BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>* | 32 static BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>* |
32 GetFactoryInstance(); | 33 GetFactoryInstance(); |
33 | 34 |
34 explicit EasyUnlockPrivateAPI(content::BrowserContext* context); | 35 explicit EasyUnlockPrivateAPI(content::BrowserContext* context); |
35 virtual ~EasyUnlockPrivateAPI(); | 36 virtual ~EasyUnlockPrivateAPI(); |
36 | 37 |
| 38 void SendTurnOffFlowFinished(); |
| 39 |
37 EasyUnlockPrivateCryptoDelegate* crypto_delegate() { | 40 EasyUnlockPrivateCryptoDelegate* crypto_delegate() { |
38 return crypto_delegate_.get(); | 41 return crypto_delegate_.get(); |
39 } | 42 } |
40 | 43 |
41 private: | 44 private: |
42 friend class BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>; | 45 friend class BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>; |
43 | 46 |
44 // BrowserContextKeyedAPI implementation. | 47 // BrowserContextKeyedAPI implementation. |
45 static const char* service_name() { return "EasyUnlockPrivate"; } | 48 static const char* service_name() { return "EasyUnlockPrivate"; } |
46 | 49 |
| 50 content::BrowserContext* browser_context_; |
47 scoped_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_; | 51 scoped_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_; |
48 | 52 |
49 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI); | 53 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI); |
50 }; | 54 }; |
51 | 55 |
52 class EasyUnlockPrivateGetStringsFunction : public SyncExtensionFunction { | 56 class EasyUnlockPrivateGetStringsFunction : public SyncExtensionFunction { |
53 public: | 57 public: |
54 EasyUnlockPrivateGetStringsFunction(); | 58 EasyUnlockPrivateGetStringsFunction(); |
55 | 59 |
56 protected: | 60 protected: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 // AsyncExtensionFunction: | 152 // AsyncExtensionFunction: |
149 virtual bool RunAsync() OVERRIDE; | 153 virtual bool RunAsync() OVERRIDE; |
150 | 154 |
151 // Callback that is called when the seek operation succeeds. | 155 // Callback that is called when the seek operation succeeds. |
152 void OnSeekCompleted(const easy_unlock::SeekDeviceResult& seek_result); | 156 void OnSeekCompleted(const easy_unlock::SeekDeviceResult& seek_result); |
153 | 157 |
154 DISALLOW_COPY_AND_ASSIGN( | 158 DISALLOW_COPY_AND_ASSIGN( |
155 EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction); | 159 EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction); |
156 }; | 160 }; |
157 | 161 |
| 162 class EasyUnlockPrivateSetPermitAccessFunction : public SyncExtensionFunction { |
| 163 public: |
| 164 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setPermitAccess", |
| 165 EASYUNLOCKPRIVATE_SETPERMITACCESS) |
| 166 EasyUnlockPrivateSetPermitAccessFunction(); |
| 167 |
| 168 private: |
| 169 virtual ~EasyUnlockPrivateSetPermitAccessFunction(); |
| 170 |
| 171 // SyncExtensionFunction: |
| 172 virtual bool RunSync() OVERRIDE; |
| 173 |
| 174 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetPermitAccessFunction); |
| 175 }; |
| 176 |
| 177 class EasyUnlockPrivateGetPermitAccessFunction : public SyncExtensionFunction { |
| 178 public: |
| 179 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getPermitAccess", |
| 180 EASYUNLOCKPRIVATE_GETPERMITACCESS) |
| 181 EasyUnlockPrivateGetPermitAccessFunction(); |
| 182 |
| 183 private: |
| 184 virtual ~EasyUnlockPrivateGetPermitAccessFunction(); |
| 185 |
| 186 // SyncExtensionFunction: |
| 187 virtual bool RunSync() OVERRIDE; |
| 188 |
| 189 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetPermitAccessFunction); |
| 190 }; |
| 191 |
| 192 class EasyUnlockPrivateClearPermitAccessFunction |
| 193 : public SyncExtensionFunction { |
| 194 public: |
| 195 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.clearPermitAccess", |
| 196 EASYUNLOCKPRIVATE_CLEARPERMITACCESS) |
| 197 EasyUnlockPrivateClearPermitAccessFunction(); |
| 198 |
| 199 private: |
| 200 virtual ~EasyUnlockPrivateClearPermitAccessFunction(); |
| 201 |
| 202 // SyncExtensionFunction: |
| 203 virtual bool RunSync() OVERRIDE; |
| 204 |
| 205 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateClearPermitAccessFunction); |
| 206 }; |
| 207 |
| 208 class EasyUnlockPrivateSetRemoteDevicesFunction : public SyncExtensionFunction { |
| 209 public: |
| 210 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setRemoteDevices", |
| 211 EASYUNLOCKPRIVATE_SETREMOTEDEVICES) |
| 212 EasyUnlockPrivateSetRemoteDevicesFunction(); |
| 213 |
| 214 private: |
| 215 virtual ~EasyUnlockPrivateSetRemoteDevicesFunction(); |
| 216 |
| 217 // SyncExtensionFunction: |
| 218 virtual bool RunSync() OVERRIDE; |
| 219 |
| 220 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateSetRemoteDevicesFunction); |
| 221 }; |
| 222 |
| 223 class EasyUnlockPrivateGetRemoteDevicesFunction : public SyncExtensionFunction { |
| 224 public: |
| 225 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getRemoteDevices", |
| 226 EASYUNLOCKPRIVATE_GETREMOTEDEVICES) |
| 227 EasyUnlockPrivateGetRemoteDevicesFunction(); |
| 228 |
| 229 private: |
| 230 virtual ~EasyUnlockPrivateGetRemoteDevicesFunction(); |
| 231 |
| 232 // SyncExtensionFunction: |
| 233 virtual bool RunSync() OVERRIDE; |
| 234 |
| 235 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction); |
| 236 }; |
| 237 |
158 } // namespace api | 238 } // namespace api |
159 } // namespace extensions | 239 } // namespace extensions |
160 | 240 |
161 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_API_H_ | 241 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_API_H_ |
OLD | NEW |