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

Side by Side Diff: chrome/browser/signin/chrome_proximity_auth_client.cc

Issue 2502343003: Moved //components/proximity_auth/cryptauth to //components/cryptauth. (Closed)
Patch Set: Fixed proto #includes. Created 4 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/signin/chrome_proximity_auth_client.h" 5 #include "chrome/browser/signin/chrome_proximity_auth_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/sys_info.h" 11 #include "base/sys_info.h"
12 #include "base/version.h" 12 #include "base/version.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/profiles/profile_window.h" 15 #include "chrome/browser/profiles/profile_window.h"
16 #include "chrome/browser/signin/easy_unlock_service.h" 16 #include "chrome/browser/signin/easy_unlock_service.h"
17 #include "chrome/browser/signin/easy_unlock_service_regular.h" 17 #include "chrome/browser/signin/easy_unlock_service_regular.h"
18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
19 #include "chrome/browser/signin/signin_manager_factory.h" 19 #include "chrome/browser/signin/signin_manager_factory.h"
20 #include "components/cryptauth/cryptauth_client_impl.h"
21 #include "components/cryptauth/cryptauth_device_manager.h"
22 #include "components/cryptauth/cryptauth_enrollment_manager.h"
23 #include "components/cryptauth/secure_message_delegate.h"
20 #include "components/prefs/pref_service.h" 24 #include "components/prefs/pref_service.h"
21 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h"
22 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h"
23 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h"
24 #include "components/proximity_auth/cryptauth/secure_message_delegate.h"
25 #include "components/proximity_auth/logging/logging.h" 25 #include "components/proximity_auth/logging/logging.h"
26 #include "components/signin/core/browser/profile_oauth2_token_service.h" 26 #include "components/signin/core/browser/profile_oauth2_token_service.h"
27 #include "components/signin/core/browser/signin_manager_base.h" 27 #include "components/signin/core/browser/signin_manager_base.h"
28 #include "components/version_info/version_info.h" 28 #include "components/version_info/version_info.h"
29 29
30 #if defined(OS_CHROMEOS) 30 #if defined(OS_CHROMEOS)
31 #include "chrome/browser/chromeos/login/easy_unlock/secure_message_delegate_chro meos.h" 31 #include "chrome/browser/chromeos/login/easy_unlock/secure_message_delegate_chro meos.h"
32 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" 32 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h"
33 #endif 33 #endif
34 34
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 callback); 87 callback);
88 #else 88 #else
89 callback.Run(std::string()); 89 callback.Run(std::string());
90 #endif 90 #endif
91 } 91 }
92 92
93 PrefService* ChromeProximityAuthClient::GetPrefService() { 93 PrefService* ChromeProximityAuthClient::GetPrefService() {
94 return profile_->GetPrefs(); 94 return profile_->GetPrefs();
95 } 95 }
96 96
97 std::unique_ptr<proximity_auth::SecureMessageDelegate> 97 std::unique_ptr<cryptauth::SecureMessageDelegate>
98 ChromeProximityAuthClient::CreateSecureMessageDelegate() { 98 ChromeProximityAuthClient::CreateSecureMessageDelegate() {
99 #if defined(OS_CHROMEOS) 99 #if defined(OS_CHROMEOS)
100 return base::MakeUnique<chromeos::SecureMessageDelegateChromeOS>(); 100 return base::MakeUnique<chromeos::SecureMessageDelegateChromeOS>();
101 #else 101 #else
102 return nullptr; 102 return nullptr;
103 #endif 103 #endif
104 } 104 }
105 105
106 std::unique_ptr<proximity_auth::CryptAuthClientFactory> 106 std::unique_ptr<cryptauth::CryptAuthClientFactory>
107 ChromeProximityAuthClient::CreateCryptAuthClientFactory() { 107 ChromeProximityAuthClient::CreateCryptAuthClientFactory() {
108 return base::MakeUnique<proximity_auth::CryptAuthClientFactoryImpl>( 108 return base::MakeUnique<cryptauth::CryptAuthClientFactoryImpl>(
109 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(), 109 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(),
110 profile_->GetRequestContext(), GetDeviceClassifier()); 110 profile_->GetRequestContext(), GetDeviceClassifier());
111 } 111 }
112 112
113 cryptauth::DeviceClassifier ChromeProximityAuthClient::GetDeviceClassifier() { 113 cryptauth::DeviceClassifier ChromeProximityAuthClient::GetDeviceClassifier() {
114 cryptauth::DeviceClassifier device_classifier; 114 cryptauth::DeviceClassifier device_classifier;
115 115
116 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
117 int32_t major_version, minor_version, bugfix_version; 117 int32_t major_version, minor_version, bugfix_version;
118 // TODO(tengs): base::OperatingSystemVersionNumbers only works for ChromeOS. 118 // TODO(tengs): base::OperatingSystemVersionNumbers only works for ChromeOS.
(...skipping 15 matching lines...) Expand all
134 134
135 std::string ChromeProximityAuthClient::GetAccountId() { 135 std::string ChromeProximityAuthClient::GetAccountId() {
136 // There is no SigninManager for the login profile. 136 // There is no SigninManager for the login profile.
137 if (!SigninManagerFactory::GetForProfile(profile_)) 137 if (!SigninManagerFactory::GetForProfile(profile_))
138 return std::string(); 138 return std::string();
139 139
140 return SigninManagerFactory::GetForProfile(profile_) 140 return SigninManagerFactory::GetForProfile(profile_)
141 ->GetAuthenticatedAccountId(); 141 ->GetAuthenticatedAccountId();
142 } 142 }
143 143
144 proximity_auth::CryptAuthEnrollmentManager* 144 cryptauth::CryptAuthEnrollmentManager*
145 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { 145 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() {
146 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); 146 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular();
147 if (!easy_unlock_service) 147 if (!easy_unlock_service)
148 return nullptr; 148 return nullptr;
149 return easy_unlock_service->GetCryptAuthEnrollmentManager(); 149 return easy_unlock_service->GetCryptAuthEnrollmentManager();
150 } 150 }
151 151
152 proximity_auth::CryptAuthDeviceManager* 152 cryptauth::CryptAuthDeviceManager*
153 ChromeProximityAuthClient::GetCryptAuthDeviceManager() { 153 ChromeProximityAuthClient::GetCryptAuthDeviceManager() {
154 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); 154 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular();
155 if (!easy_unlock_service) 155 if (!easy_unlock_service)
156 return nullptr; 156 return nullptr;
157 return easy_unlock_service->GetCryptAuthDeviceManager(); 157 return easy_unlock_service->GetCryptAuthDeviceManager();
158 } 158 }
159 159
160 EasyUnlockServiceRegular* 160 EasyUnlockServiceRegular*
161 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { 161 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() {
162 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); 162 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_);
163 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) 163 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR)
164 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); 164 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service);
165 else 165 else
166 return nullptr; 166 return nullptr;
167 } 167 }
OLDNEW
« no previous file with comments | « chrome/browser/signin/chrome_proximity_auth_client.h ('k') | chrome/browser/signin/easy_unlock_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698