OLD | NEW |
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> |
| 8 |
7 #include "base/logging.h" | 9 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
9 #include "base/sys_info.h" | 11 #include "base/sys_info.h" |
10 #include "base/version.h" | 12 #include "base/version.h" |
| 13 #include "build/build_config.h" |
11 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/profiles/profile_window.h" | 15 #include "chrome/browser/profiles/profile_window.h" |
13 #include "chrome/browser/signin/easy_unlock_service.h" | 16 #include "chrome/browser/signin/easy_unlock_service.h" |
14 #include "chrome/browser/signin/easy_unlock_service_regular.h" | 17 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 18 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
16 #include "chrome/browser/signin/signin_manager_factory.h" | 19 #include "chrome/browser/signin/signin_manager_factory.h" |
17 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" | 20 #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
18 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" | 21 #include "components/proximity_auth/cryptauth/cryptauth_device_manager.h" |
19 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" | 22 #include "components/proximity_auth/cryptauth/cryptauth_enrollment_manager.h" |
20 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" | 23 #include "components/proximity_auth/cryptauth/secure_message_delegate.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 ChromeProximityAuthClient::CreateCryptAuthClientFactory() { | 106 ChromeProximityAuthClient::CreateCryptAuthClientFactory() { |
104 return make_scoped_ptr(new proximity_auth::CryptAuthClientFactoryImpl( | 107 return make_scoped_ptr(new proximity_auth::CryptAuthClientFactoryImpl( |
105 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(), | 108 ProfileOAuth2TokenServiceFactory::GetForProfile(profile_), GetAccountId(), |
106 profile_->GetRequestContext(), GetDeviceClassifier())); | 109 profile_->GetRequestContext(), GetDeviceClassifier())); |
107 } | 110 } |
108 | 111 |
109 cryptauth::DeviceClassifier ChromeProximityAuthClient::GetDeviceClassifier() { | 112 cryptauth::DeviceClassifier ChromeProximityAuthClient::GetDeviceClassifier() { |
110 cryptauth::DeviceClassifier device_classifier; | 113 cryptauth::DeviceClassifier device_classifier; |
111 | 114 |
112 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
113 int32 major_version, minor_version, bugfix_version; | 116 int32_t major_version, minor_version, bugfix_version; |
114 // TODO(tengs): base::OperatingSystemVersionNumbers only works for ChromeOS. | 117 // TODO(tengs): base::OperatingSystemVersionNumbers only works for ChromeOS. |
115 // We need to get different numbers for other platforms. | 118 // We need to get different numbers for other platforms. |
116 base::SysInfo::OperatingSystemVersionNumbers(&major_version, &minor_version, | 119 base::SysInfo::OperatingSystemVersionNumbers(&major_version, &minor_version, |
117 &bugfix_version); | 120 &bugfix_version); |
118 device_classifier.set_device_os_version_code(major_version); | 121 device_classifier.set_device_os_version_code(major_version); |
119 device_classifier.set_device_type(cryptauth::CHROME); | 122 device_classifier.set_device_type(cryptauth::CHROME); |
120 #endif | 123 #endif |
121 | 124 |
122 const std::vector<uint32_t>& version_components = | 125 const std::vector<uint32_t>& version_components = |
123 base::Version(version_info::GetVersionNumber()).components(); | 126 base::Version(version_info::GetVersionNumber()).components(); |
(...skipping 30 matching lines...) Expand all Loading... |
154 } | 157 } |
155 | 158 |
156 EasyUnlockServiceRegular* | 159 EasyUnlockServiceRegular* |
157 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { | 160 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { |
158 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); | 161 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); |
159 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) | 162 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) |
160 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); | 163 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); |
161 else | 164 else |
162 return nullptr; | 165 return nullptr; |
163 } | 166 } |
OLD | NEW |