| 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 |
| 108 return SigninManagerFactory::GetForProfile(profile_) | 112 return SigninManagerFactory::GetForProfile(profile_) |
| 109 ->GetAuthenticatedAccountId(); | 113 ->GetAuthenticatedAccountId(); |
| 110 } | 114 } |
| 111 | 115 |
| 112 proximity_auth::CryptAuthEnrollmentManager* | 116 proximity_auth::CryptAuthEnrollmentManager* |
| 113 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { | 117 ChromeProximityAuthClient::GetCryptAuthEnrollmentManager() { |
| 114 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); | 118 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); |
| 115 if (!easy_unlock_service) | 119 if (!easy_unlock_service) |
| 116 return nullptr; | 120 return nullptr; |
| 117 return easy_unlock_service->GetCryptAuthEnrollmentManager(); | 121 return easy_unlock_service->GetCryptAuthEnrollmentManager(); |
| 118 } | 122 } |
| 119 | 123 |
| 120 proximity_auth::CryptAuthDeviceManager* | 124 proximity_auth::CryptAuthDeviceManager* |
| 121 ChromeProximityAuthClient::GetCryptAuthDeviceManager() { | 125 ChromeProximityAuthClient::GetCryptAuthDeviceManager() { |
| 122 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); | 126 EasyUnlockServiceRegular* easy_unlock_service = GetEasyUnlockServiceRegular(); |
| 123 if (!easy_unlock_service) | 127 if (!easy_unlock_service) |
| 124 return nullptr; | 128 return nullptr; |
| 125 return easy_unlock_service->GetCryptAuthDeviceManager(); | 129 return easy_unlock_service->GetCryptAuthDeviceManager(); |
| 126 } | 130 } |
| 127 | 131 |
| 128 EasyUnlockServiceRegular* | 132 EasyUnlockServiceRegular* |
| 129 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { | 133 ChromeProximityAuthClient::GetEasyUnlockServiceRegular() { |
| 130 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); | 134 EasyUnlockService* easy_unlock_service = EasyUnlockService::Get(profile_); |
| 131 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) | 135 if (easy_unlock_service->GetType() == EasyUnlockService::TYPE_REGULAR) |
| 132 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); | 136 return static_cast<EasyUnlockServiceRegular*>(easy_unlock_service); |
| 133 else | 137 else |
| 134 return nullptr; | 138 return nullptr; |
| 135 } | 139 } |
| OLD | NEW |