| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/easy_unlock_service.h" | 5 #include "chrome/browser/signin/easy_unlock_service.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "apps/app_lifetime_monitor.h" | 9 #include "apps/app_lifetime_monitor.h" |
| 8 #include "apps/app_lifetime_monitor_factory.h" | 10 #include "apps/app_lifetime_monitor_factory.h" |
| 9 #include "base/bind.h" | 11 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/guid.h" | 13 #include "base/guid.h" |
| 12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 13 #include "base/macros.h" | 15 #include "base/macros.h" |
| 14 #include "base/metrics/histogram_macros.h" | 16 #include "base/metrics/histogram_macros.h" |
| 15 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 16 #include "base/prefs/pref_service.h" | 18 #include "base/prefs/pref_service.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 std::string device_id = local_state->GetString(prefs::kEasyUnlockDeviceId); | 358 std::string device_id = local_state->GetString(prefs::kEasyUnlockDeviceId); |
| 357 if (device_id.empty()) { | 359 if (device_id.empty()) { |
| 358 device_id = base::GenerateGUID(); | 360 device_id = base::GenerateGUID(); |
| 359 local_state->SetString(prefs::kEasyUnlockDeviceId, device_id); | 361 local_state->SetString(prefs::kEasyUnlockDeviceId, device_id); |
| 360 } | 362 } |
| 361 return device_id; | 363 return device_id; |
| 362 } | 364 } |
| 363 | 365 |
| 364 void EasyUnlockService::Initialize( | 366 void EasyUnlockService::Initialize( |
| 365 scoped_ptr<EasyUnlockAppManager> app_manager) { | 367 scoped_ptr<EasyUnlockAppManager> app_manager) { |
| 366 app_manager_ = app_manager.Pass(); | 368 app_manager_ = std::move(app_manager); |
| 367 app_manager_->EnsureReady( | 369 app_manager_->EnsureReady( |
| 368 base::Bind(&EasyUnlockService::InitializeOnAppManagerReady, | 370 base::Bind(&EasyUnlockService::InitializeOnAppManagerReady, |
| 369 weak_ptr_factory_.GetWeakPtr())); | 371 weak_ptr_factory_.GetWeakPtr())); |
| 370 } | 372 } |
| 371 | 373 |
| 372 bool EasyUnlockService::IsAllowed() const { | 374 bool EasyUnlockService::IsAllowed() const { |
| 373 if (shut_down_) | 375 if (shut_down_) |
| 374 return false; | 376 return false; |
| 375 | 377 |
| 376 if (!IsAllowedInternal()) | 378 if (!IsAllowedInternal()) |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 | 919 |
| 918 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt | 920 // TODO(tbarzic): Set check_private_key only if previous sign-in attempt |
| 919 // failed. | 921 // failed. |
| 920 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) | 922 EasyUnlockTpmKeyManagerFactory::GetInstance()->Get(profile_) |
| 921 ->PrepareTpmKey(true /* check_private_key */, | 923 ->PrepareTpmKey(true /* check_private_key */, |
| 922 base::Closure()); | 924 base::Closure()); |
| 923 #endif // defined(OS_CHROMEOS) | 925 #endif // defined(OS_CHROMEOS) |
| 924 | 926 |
| 925 tpm_key_checked_ = true; | 927 tpm_key_checked_ = true; |
| 926 } | 928 } |
| OLD | NEW |