| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/version.h" | 10 #include "base/version.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 const std::vector<uint32_t>& version_components = | 98 const std::vector<uint32_t>& version_components = |
| 99 base::Version(version_info::GetVersionNumber()).components(); | 99 base::Version(version_info::GetVersionNumber()).components(); |
| 100 if (version_components.size() > 0) | 100 if (version_components.size() > 0) |
| 101 device_classifier.set_device_software_version_code(version_components[0]); | 101 device_classifier.set_device_software_version_code(version_components[0]); |
| 102 | 102 |
| 103 device_classifier.set_device_software_package(version_info::GetProductName()); | 103 device_classifier.set_device_software_package(version_info::GetProductName()); |
| 104 return device_classifier; | 104 return device_classifier; |
| 105 } | 105 } |
| 106 | 106 |
| 107 std::string ChromeProximityAuthClient::GetAccountId() { | 107 std::string ChromeProximityAuthClient::GetAccountId() { |
| 108 // There is no SigninManager for the login profile. | |
| 109 if (!SigninManagerFactory::GetForProfile(profile_)) | |
| 110 return std::string(); | |
| 111 | |
| 112 return SigninManagerFactory::GetForProfile(profile_) | 108 return SigninManagerFactory::GetForProfile(profile_) |
| 113 ->GetAuthenticatedAccountId(); | 109 ->GetAuthenticatedAccountId(); |
| 114 } | 110 } |
| 115 | 111 |
| 116 proximity_auth::CryptAuthEnrollmentManager* | 112 proximity_auth::CryptAuthEnrollmentManager* |
| 117 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { | 113 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { |
| 118 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); | 114 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); |
| 119 if (!easy_unlock_service) | 115 if (!easy_unlock_service) |
| 120 return nullptr; | 116 return nullptr; |
| 121 return easy_unlock_service->GetCryptAuthEnrollmentManager(); | 117 return easy_unlock_service->GetCryptAuthEnrollmentManager(); |
| 122 } | 118 } |
| 123 | 119 |
| 124 proximity_auth::CryptAuthDeviceManager* | 120 proximity_auth::CryptAuthDeviceManager* |
| 125 ChromeProximityAuthClient::GetCryptAuthDeviceManager() { | 121 ChromeProximityAuthClient::GetCryptAuthDeviceManager() { |
| 126 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); | 122 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); |
| 127 if (!easy_unlock_service) | 123 if (!easy_unlock_service) |
| 128 return nullptr; | 124 return nullptr; |
| 129 return easy_unlock_service->GetCryptAuthDeviceManager(); | 125 return easy_unlock_service->GetCryptAuthDeviceManager(); |
| 130 } | 126 } |
| 131 | 127 |
| 132 EasyUnlockServiceRegular* | 128 EasyUnlockServiceRegular* |
| 133 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { | 129 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { |
| 134 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); | 130 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); |
| 135 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) | 131 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) |
| 136 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); | 132 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); |
| 137 else | 133 else |
| 138 return nullptr; | 134 return nullptr; |
| 139 } | 135 } |
| OLD | NEW |