Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 2561203002: Migrate weave-related classes from proximity_auth/ble to cryptauth/ble. (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h" 5 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ api.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64url.h" 10 #include "base/base64url.h"
(...skipping 11 matching lines...) Expand all
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ connection_manager.h" 23 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ connection_manager.h"
24 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ crypto_delegate.h" 24 #include "chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_ crypto_delegate.h"
25 #include "chrome/browser/profiles/profile.h" 25 #include "chrome/browser/profiles/profile.h"
26 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h" 26 #include "chrome/browser/signin/easy_unlock_screenlock_state_handler.h"
27 #include "chrome/browser/signin/easy_unlock_service.h" 27 #include "chrome/browser/signin/easy_unlock_service.h"
28 #include "chrome/browser/signin/easy_unlock_service_regular.h" 28 #include "chrome/browser/signin/easy_unlock_service_regular.h"
29 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h" 29 #include "chrome/browser/ui/proximity_auth/proximity_auth_error_bubble.h"
30 #include "chrome/common/extensions/api/easy_unlock_private.h" 30 #include "chrome/common/extensions/api/easy_unlock_private.h"
31 #include "chrome/grit/generated_resources.h" 31 #include "chrome/grit/generated_resources.h"
32 #include "components/cryptauth/bluetooth_throttler_impl.h"
32 #include "components/cryptauth/cryptauth_device_manager.h" 33 #include "components/cryptauth/cryptauth_device_manager.h"
33 #include "components/cryptauth/cryptauth_enrollment_manager.h" 34 #include "components/cryptauth/cryptauth_enrollment_manager.h"
34 #include "components/cryptauth/cryptauth_enrollment_utils.h" 35 #include "components/cryptauth/cryptauth_enrollment_utils.h"
35 #include "components/cryptauth/proto/cryptauth_api.pb.h" 36 #include "components/cryptauth/proto/cryptauth_api.pb.h"
36 #include "components/cryptauth/remote_device.h" 37 #include "components/cryptauth/remote_device.h"
37 #include "components/cryptauth/secure_message_delegate.h" 38 #include "components/cryptauth/secure_message_delegate.h"
38 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h" 39 #include "components/proximity_auth/ble/bluetooth_low_energy_connection.h"
39 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h " 40 #include "components/proximity_auth/ble/bluetooth_low_energy_connection_finder.h "
40 #include "components/proximity_auth/bluetooth_throttler_impl.h"
41 #include "components/proximity_auth/bluetooth_util.h" 41 #include "components/proximity_auth/bluetooth_util.h"
42 #include "components/proximity_auth/logging/logging.h" 42 #include "components/proximity_auth/logging/logging.h"
43 #include "components/proximity_auth/proximity_auth_client.h" 43 #include "components/proximity_auth/proximity_auth_client.h"
44 #include "components/proximity_auth/screenlock_bridge.h" 44 #include "components/proximity_auth/screenlock_bridge.h"
45 #include "components/proximity_auth/screenlock_state.h" 45 #include "components/proximity_auth/screenlock_state.h"
46 #include "components/proximity_auth/switches.h" 46 #include "components/proximity_auth/switches.h"
47 #include "components/signin/core/account_id/account_id.h" 47 #include "components/signin/core/account_id/account_id.h"
48 #include "content/public/browser/browser_thread.h" 48 #include "content/public/browser/browser_thread.h"
49 #include "content/public/browser/web_contents.h" 49 #include "content/public/browser/web_contents.h"
50 #include "extensions/browser/browser_context_keyed_api_factory.h" 50 #include "extensions/browser/browser_context_keyed_api_factory.h"
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1043
1044 Profile* profile = Profile::FromBrowserContext(browser_context()); 1044 Profile* profile = Profile::FromBrowserContext(browser_context());
1045 EasyUnlockService::Get(profile) 1045 EasyUnlockService::Get(profile)
1046 ->SetAutoPairingResult(params->result.success, error_message); 1046 ->SetAutoPairingResult(params->result.success, error_message);
1047 1047
1048 return RespondNow(NoArguments()); 1048 return RespondNow(NoArguments());
1049 } 1049 }
1050 1050
1051 EasyUnlockPrivateFindSetupConnectionFunction:: 1051 EasyUnlockPrivateFindSetupConnectionFunction::
1052 EasyUnlockPrivateFindSetupConnectionFunction() 1052 EasyUnlockPrivateFindSetupConnectionFunction()
1053 : bluetooth_throttler_(new proximity_auth::BluetoothThrottlerImpl( 1053 : bluetooth_throttler_(new cryptauth::BluetoothThrottlerImpl(
1054 base::MakeUnique<base::DefaultTickClock>())) {} 1054 base::MakeUnique<base::DefaultTickClock>())) {}
1055 1055
1056 EasyUnlockPrivateFindSetupConnectionFunction:: 1056 EasyUnlockPrivateFindSetupConnectionFunction::
1057 ~EasyUnlockPrivateFindSetupConnectionFunction() { 1057 ~EasyUnlockPrivateFindSetupConnectionFunction() {
1058 // |connection_finder_| has a raw pointer to |bluetooth_throttler_|, so it 1058 // |connection_finder_| has a raw pointer to |bluetooth_throttler_|, so it
1059 // should be destroyed first. 1059 // should be destroyed first.
1060 connection_finder_.reset(); 1060 connection_finder_.reset();
1061 bluetooth_throttler_.reset(); 1061 bluetooth_throttler_.reset();
1062 } 1062 }
1063 1063
1064 void EasyUnlockPrivateFindSetupConnectionFunction:: 1064 void EasyUnlockPrivateFindSetupConnectionFunction::
1065 OnConnectionFinderTimedOut() { 1065 OnConnectionFinderTimedOut() {
1066 SetError("No connection found."); 1066 SetError("No connection found.");
1067 connection_finder_.reset(); 1067 connection_finder_.reset();
1068 SendResponse(false); 1068 SendResponse(false);
1069 } 1069 }
1070 1070
1071 void EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound( 1071 void EasyUnlockPrivateFindSetupConnectionFunction::OnConnectionFound(
1072 std::unique_ptr<proximity_auth::Connection> connection) { 1072 std::unique_ptr<cryptauth::Connection> connection) {
1073 // Connection are not persistent by default. 1073 // Connection are not persistent by default.
1074 std::string device_address = connection->remote_device().bluetooth_address; 1074 std::string device_address = connection->remote_device().bluetooth_address;
1075 bool persistent = false; 1075 bool persistent = false;
1076 int connection_id = 1076 int connection_id =
1077 GetConnectionManager(browser_context()) 1077 GetConnectionManager(browser_context())
1078 ->AddConnection(extension(), std::move(connection), persistent); 1078 ->AddConnection(extension(), std::move(connection), persistent);
1079 results_ = easy_unlock_private::FindSetupConnection::Results::Create( 1079 results_ = easy_unlock_private::FindSetupConnection::Results::Create(
1080 connection_id, device_address); 1080 connection_id, device_address);
1081 SendResponse(true); 1081 SendResponse(true);
1082 } 1082 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1181 GetConnectionManager(browser_context()) 1181 GetConnectionManager(browser_context())
1182 ->GetDeviceAddress(extension(), params->connection_id); 1182 ->GetDeviceAddress(extension(), params->connection_id);
1183 if (device_address.empty()) 1183 if (device_address.empty())
1184 return RespondNow(Error("Invalid connectionId.")); 1184 return RespondNow(Error("Invalid connectionId."));
1185 return RespondNow(ArgumentList( 1185 return RespondNow(ArgumentList(
1186 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create( 1186 easy_unlock_private::SetupConnectionGetDeviceAddress::Results::Create(
1187 device_address))); 1187 device_address)));
1188 } 1188 }
1189 1189
1190 } // namespace extensions 1190 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698