Chromium Code Reviews| Index: chrome/browser/signin/chrome_proximity_auth_client.cc |
| diff --git a/chrome/browser/signin/chrome_proximity_auth_client.cc b/chrome/browser/signin/chrome_proximity_auth_client.cc |
| index 4241e6324fc0424ae5a523c363a637713aa1c7ce..b43ebe34aece73e4a3599f83a23ab7d11b91bda2 100644 |
| --- a/chrome/browser/signin/chrome_proximity_auth_client.cc |
| +++ b/chrome/browser/signin/chrome_proximity_auth_client.cc |
| @@ -5,11 +5,26 @@ |
| #include "chrome/browser/signin/chrome_proximity_auth_client.h" |
| #include "base/logging.h" |
| +#include "base/prefs/pref_service.h" |
| +#include "base/sys_info.h" |
| +#include "base/version.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/profiles/profile_window.h" |
| #include "chrome/browser/signin/easy_unlock_service.h" |
| +#include "chrome/browser/signin/easy_unlock_service_regular.h" |
| +#include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| +#include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
| +#include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" |
| +#include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" |
| +#include "components/proximity_auth/cryptauth/secure_message_delegate.h" |
| +#include "components/signin/core/browser/profile_oauth2_token_service.h" |
| #include "components/signin/core/browser/signin_manager_base.h" |
| +#include "components/version_info/version_info.h" |
| + |
| +#if defined(OS_CHROMEOS) |
| +#include "chrome/browser/chromeos/login/easy_unlock/secure_message_delegate_chromeos.h" |
| +#endif |
| using proximity_auth::ScreenlockState; |
| @@ -46,3 +61,64 @@ void ChromeProximityAuthClient::FinalizeSignin(const std::string& secret) { |
| if (service) |
| service->FinalizeSignin(secret); |
| } |
| + |
| +PrefService* ChromeProximityAuthClient::GetPrefService() { |
| + return profile_->GetPrefs(); |
| +} |
| + |
| +scoped_ptr<proximity_auth::SecureMessageDelegate> |
| +ChromeProximityAuthClient::CreateSecureMessageDelegate() { |
| +#if defined(OS_CHROMEOS) |
| + return make_scoped_ptr(new chromeos::SecureMessageDelegateChromeOS()); |
| +#else |
| + return nullptr; |
| +#endif |
| +} |
| + |
| +scoped_ptr<proximity_auth::CryptAuthClientFactory> |
| +ChromeProximityAuthClient::CreateCryptAuthClientFactory() { |
| + return make_scoped_ptr(new proximity_auth::CryptAuthClientFactoryImpl( |
| + ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(), |
| + profile_->GetRequestContext(), GetDeviceClassifier())); |
| +} |
| + |
| +cryptauth::DeviceClassifier ChromeProximityAuthClient::GetDeviceClassifier() { |
| + cryptauth::DeviceClassifier device_classifier; |
| + |
| +#if defined(OS_CHROMEOS) |
| + int32 major_version, minor_version, bugfix_version; |
| + // TODO(tengs): base::OperatingSystemVersionNumbers only works for ChromeOS. |
| + // We need to get different numbers for other platforms. |
| + base::SysInfo::OperatingSystemVersionNumbers(&major_version, &minor_version, |
| + &bugfix_version); |
| + device_classifier.set_device_os_version_code(major_version); |
| + device_classifier.set_device_type(cryptauth::CHROME); |
|
sacomoto
2015/08/27 11:29:31
This is sent to CryptAuth, right? Why does it need
Tim Song
2015/08/27 18:23:52
The people maintaining CryptAuth want to distingui
sacomoto
2015/08/28 14:40:23
I see. Thanks.
|
| +#endif |
| + |
| + const std::vector<uint32_t>& version_components = |
| + base::Version(version_info::GetVersionNumber()).components(); |
| + if (version_components.size() > 0) |
| + device_classifier.set_device_software_version_code(version_components[0]); |
| + |
| + device_classifier.set_device_software_package(version_info::GetProductName()); |
| + return device_classifier; |
| +} |
| + |
| +std::string ChromeProximityAuthClient::GetAccountId() { |
| + return SigninManagerFactory::GetForProfile(profile_) |
| + ->GetAuthenticatedAccountId(); |
| +} |
| + |
| +proximity_auth::CryptAuthEnrollmentManager* |
| +ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { |
| + // TODO(tengs): Return the real manager instance once it is implemented in |
| + // EasyUnlockService. |
| + return nullptr; |
| +} |
| + |
| +proximity_auth::CryptAuthDeviceManager* |
| +ChromeProximityAuthClient::GetCryptAuthDeviceManager() { |
| + // TODO(tengs): Return the real manager instance once it is implemented in |
| + // EasyUnlockService. |
| + return nullptr; |
| +} |