Chromium Code Reviews| Index: chrome/browser/signin/easy_unlock_service_regular.cc |
| diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc |
| index a7f8ea9568613448e73a1a1a5fbbb29121bfd9ab..1c34d3c734ca2d094b36269fa72b63b91467acb0 100644 |
| --- a/chrome/browser/signin/easy_unlock_service_regular.cc |
| +++ b/chrome/browser/signin/easy_unlock_service_regular.cc |
| @@ -13,8 +13,8 @@ |
| #include "base/version.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/profiles/profile.h" |
| +#include "chrome/browser/signin/easy_unlock_util.h" |
| #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| -#include "chrome/browser/signin/screenlock_bridge.h" |
| #include "chrome/browser/signin/signin_manager_factory.h" |
| #include "chrome/common/chrome_version_info.h" |
| #include "chrome/common/extensions/api/easy_unlock_private.h" |
| @@ -24,6 +24,7 @@ |
| #include "components/pref_registry/pref_registry_syncable.h" |
| #include "components/proximity_auth/cryptauth/cryptauth_access_token_fetcher.h" |
| #include "components/proximity_auth/cryptauth/cryptauth_client_impl.h" |
| +#include "components/proximity_auth/screenlock_bridge.h" |
| #include "components/proximity_auth/switches.h" |
| #include "components/signin/core/browser/profile_oauth2_token_service.h" |
| #include "components/signin/core/browser/signin_manager.h" |
| @@ -92,7 +93,12 @@ EasyUnlockService::Type EasyUnlockServiceRegular::GetType() const { |
| } |
| std::string EasyUnlockServiceRegular::GetUserEmail() const { |
| - return ScreenlockBridge::GetAuthenticatedUserEmail(profile()); |
| + const SigninManagerBase* signin_manager = |
| + SigninManagerFactory::GetForProfileIfExists(profile()); |
| + // |profile| has to be a signed-in profile with SigninManager already |
| + // created. Otherwise, just crash to collect stack. |
| + CHECK(signin_manager); |
|
Ilya Sherman
2015/04/24 21:22:02
This should be at most a DCHECK. CHECK is used ve
msarda
2015/04/27 11:29:24
Done.
|
| + return signin_manager->GetAuthenticatedUsername(); |
| } |
| void EasyUnlockServiceRegular::LaunchSetup() { |
| @@ -298,7 +304,7 @@ void EasyUnlockServiceRegular::SetAutoPairingResult( |
| } |
| void EasyUnlockServiceRegular::InitializeInternal() { |
| - ScreenlockBridge::Get()->AddObserver(this); |
| + GetScreenlockBridgeInstance()->AddObserver(this); |
| registrar_.Init(profile()->GetPrefs()); |
| registrar_.Add( |
| prefs::kEasyUnlockAllowed, |
| @@ -317,7 +323,7 @@ void EasyUnlockServiceRegular::ShutdownInternal() { |
| turn_off_flow_status_ = EasyUnlockService::IDLE; |
| registrar_.RemoveAll(); |
| - ScreenlockBridge::Get()->RemoveObserver(this); |
| + GetScreenlockBridgeInstance()->RemoveObserver(this); |
| } |
| bool EasyUnlockServiceRegular::IsAllowedInternal() const { |
| @@ -354,16 +360,16 @@ void EasyUnlockServiceRegular::OnSuspendDone() { |
| } |
| void EasyUnlockServiceRegular::OnScreenDidLock( |
| - ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| + proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| will_unlock_using_easy_unlock_ = false; |
| lock_screen_last_shown_timestamp_ = base::TimeTicks::Now(); |
| } |
| void EasyUnlockServiceRegular::OnScreenDidUnlock( |
| - ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| + proximity_auth::ScreenlockBridge::LockHandler::ScreenType screen_type) { |
| // Notifications of signin screen unlock events can also reach this code path; |
| // disregard them. |
| - if (screen_type != ScreenlockBridge::LockHandler::LOCK_SCREEN) |
| + if (screen_type != proximity_auth::ScreenlockBridge::LockHandler::LOCK_SCREEN) |
| return; |
| // Only record metrics for users who have enabled the feature. |