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 <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
| 10 #include <memory> |
10 #include <string> | 11 #include <string> |
11 | 12 |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "device/bluetooth/bluetooth_device.h" | 14 #include "device/bluetooth/bluetooth_device.h" |
15 #include "extensions/browser/api/bluetooth/bluetooth_extension_function.h" | 15 #include "extensions/browser/api/bluetooth/bluetooth_extension_function.h" |
16 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" | 16 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" |
17 #include "extensions/browser/browser_context_keyed_api_factory.h" | 17 #include "extensions/browser/browser_context_keyed_api_factory.h" |
18 #include "extensions/browser/extension_function.h" | 18 #include "extensions/browser/extension_function.h" |
19 | 19 |
20 // Implementations for chrome.easyUnlockPrivate API functions. | 20 // Implementations for chrome.easyUnlockPrivate API functions. |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class Timer; | 23 class Timer; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 EasyUnlockPrivateConnectionManager* get_connection_manager() { | 58 EasyUnlockPrivateConnectionManager* get_connection_manager() { |
59 return connection_manager_.get(); | 59 return connection_manager_.get(); |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 friend class BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>; | 63 friend class BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI>; |
64 | 64 |
65 // BrowserContextKeyedAPI implementation. | 65 // BrowserContextKeyedAPI implementation. |
66 static const char* service_name() { return "EasyUnlockPrivate"; } | 66 static const char* service_name() { return "EasyUnlockPrivate"; } |
67 | 67 |
68 scoped_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_; | 68 std::unique_ptr<EasyUnlockPrivateCryptoDelegate> crypto_delegate_; |
69 | 69 |
70 scoped_ptr<EasyUnlockPrivateConnectionManager> connection_manager_; | 70 std::unique_ptr<EasyUnlockPrivateConnectionManager> connection_manager_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI); | 72 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateAPI); |
73 }; | 73 }; |
74 | 74 |
75 // TODO(tbarzic): Replace SyncExtensionFunction/AsyncExtensionFunction overrides | 75 // TODO(tbarzic): Replace SyncExtensionFunction/AsyncExtensionFunction overrides |
76 // with UIThreadExtensionFunction throughout the file. | 76 // with UIThreadExtensionFunction throughout the file. |
77 class EasyUnlockPrivateGetStringsFunction : public SyncExtensionFunction { | 77 class EasyUnlockPrivateGetStringsFunction : public SyncExtensionFunction { |
78 public: | 78 public: |
79 EasyUnlockPrivateGetStringsFunction(); | 79 EasyUnlockPrivateGetStringsFunction(); |
80 | 80 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 void OnPSKDerivedForDevice(const cryptauth::ExternalDeviceInfo& device, | 326 void OnPSKDerivedForDevice(const cryptauth::ExternalDeviceInfo& device, |
327 const std::string& persistent_symmetric_key); | 327 const std::string& persistent_symmetric_key); |
328 | 328 |
329 // The permit id of the user. Used for the native experiment. | 329 // The permit id of the user. Used for the native experiment. |
330 std::string permit_id_; | 330 std::string permit_id_; |
331 | 331 |
332 // The expected number of devices to return. Used for the native experiment. | 332 // The expected number of devices to return. Used for the native experiment. |
333 size_t expected_devices_count_; | 333 size_t expected_devices_count_; |
334 | 334 |
335 // Working list of the devices to return. Used for the native experiment. | 335 // Working list of the devices to return. Used for the native experiment. |
336 scoped_ptr<base::ListValue> remote_devices_; | 336 std::unique_ptr<base::ListValue> remote_devices_; |
337 | 337 |
338 // Used to derive devices' PSK. Used for the native experiment. | 338 // Used to derive devices' PSK. Used for the native experiment. |
339 scoped_ptr<proximity_auth::SecureMessageDelegate> secure_message_delegate_; | 339 std::unique_ptr<proximity_auth::SecureMessageDelegate> |
| 340 secure_message_delegate_; |
340 | 341 |
341 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction); | 342 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateGetRemoteDevicesFunction); |
342 }; | 343 }; |
343 | 344 |
344 class EasyUnlockPrivateGetSignInChallengeFunction : | 345 class EasyUnlockPrivateGetSignInChallengeFunction : |
345 public AsyncExtensionFunction { | 346 public AsyncExtensionFunction { |
346 public: | 347 public: |
347 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getSignInChallenge", | 348 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.getSignInChallenge", |
348 EASYUNLOCKPRIVATE_GETSIGNINCHALLENGE) | 349 EASYUNLOCKPRIVATE_GETSIGNINCHALLENGE) |
349 EasyUnlockPrivateGetSignInChallengeFunction(); | 350 EasyUnlockPrivateGetSignInChallengeFunction(); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 EasyUnlockPrivateFindSetupConnectionFunction(); | 465 EasyUnlockPrivateFindSetupConnectionFunction(); |
465 | 466 |
466 private: | 467 private: |
467 ~EasyUnlockPrivateFindSetupConnectionFunction() override; | 468 ~EasyUnlockPrivateFindSetupConnectionFunction() override; |
468 | 469 |
469 // AsyncExtensionFunction: | 470 // AsyncExtensionFunction: |
470 bool RunAsync() override; | 471 bool RunAsync() override; |
471 | 472 |
472 // Called when the connection with the remote device advertising the setup | 473 // Called when the connection with the remote device advertising the setup |
473 // service was found. | 474 // service was found. |
474 void OnConnectionFound(scoped_ptr<proximity_auth::Connection> connection); | 475 void OnConnectionFound( |
| 476 std::unique_ptr<proximity_auth::Connection> connection); |
475 | 477 |
476 // Callback when waiting for |connection_finder_| to return. | 478 // Callback when waiting for |connection_finder_| to return. |
477 void OnConnectionFinderTimedOut(); | 479 void OnConnectionFinderTimedOut(); |
478 | 480 |
479 // The BLE connection finder instance. | 481 // The BLE connection finder instance. |
480 scoped_ptr<proximity_auth::BluetoothLowEnergyConnectionFinder> | 482 std::unique_ptr<proximity_auth::BluetoothLowEnergyConnectionFinder> |
481 connection_finder_; | 483 connection_finder_; |
482 | 484 |
483 // The connection throttler passed to the BLE connection finder. | 485 // The connection throttler passed to the BLE connection finder. |
484 scoped_ptr<proximity_auth::BluetoothThrottler> bluetooth_throttler_; | 486 std::unique_ptr<proximity_auth::BluetoothThrottler> bluetooth_throttler_; |
485 | 487 |
486 // Used for timing out when waiting for the connection finder to return. | 488 // Used for timing out when waiting for the connection finder to return. |
487 scoped_ptr<base::Timer> timer_; | 489 std::unique_ptr<base::Timer> timer_; |
488 | 490 |
489 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateFindSetupConnectionFunction); | 491 DISALLOW_COPY_AND_ASSIGN(EasyUnlockPrivateFindSetupConnectionFunction); |
490 }; | 492 }; |
491 | 493 |
492 class EasyUnlockPrivateSetupConnectionStatusFunction | 494 class EasyUnlockPrivateSetupConnectionStatusFunction |
493 : public SyncExtensionFunction { | 495 : public SyncExtensionFunction { |
494 public: | 496 public: |
495 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setupConnectionStatus", | 497 DECLARE_EXTENSION_FUNCTION("easyUnlockPrivate.setupConnectionStatus", |
496 EASYUNLOCKPRIVATE_SETUPCONNECTIONSTATUS) | 498 EASYUNLOCKPRIVATE_SETUPCONNECTIONSTATUS) |
497 EasyUnlockPrivateSetupConnectionStatusFunction(); | 499 EasyUnlockPrivateSetupConnectionStatusFunction(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 // SyncExtensionFunction: | 553 // SyncExtensionFunction: |
552 bool RunSync() override; | 554 bool RunSync() override; |
553 | 555 |
554 DISALLOW_COPY_AND_ASSIGN( | 556 DISALLOW_COPY_AND_ASSIGN( |
555 EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction); | 557 EasyUnlockPrivateSetupConnectionGetDeviceAddressFunction); |
556 }; | 558 }; |
557 | 559 |
558 } // namespace extensions | 560 } // namespace extensions |
559 | 561 |
560 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_API_H_ | 562 #endif // CHROME_BROWSER_EXTENSIONS_API_EASY_UNLOCK_PRIVATE_EASY_UNLOCK_PRIVATE
_API_H_ |
OLD | NEW |