From 3ff77c2ed40bcaea50e22142aaebc2dc91e3c796 Mon Sep 17 00:00:00 2001 From: isherman Date: Wed, 1 Jul 2015 01:00:55 -0700 Subject: [PATCH] [Proximity Auth] Remove the ProximityAuthFacade class. Make ScreenlockBridge once again directly implement singleton behavior, rather than using a wrapper class to do so. BUG=501626 TEST=none R=tengs@chromium.org TBR=jam@chromium.org Review URL: https://codereview.chromium.org/1211343002 Cr-Commit-Position: refs/heads/master@{#336994} --- .../login/easy_unlock/easy_unlock_reauth.cc | 6 +-- .../login/screens/user_selection_screen.cc | 5 +-- .../screenlock_private/screenlock_private_api.cc | 14 +++---- .../screenlock_private_apitest.cc | 4 +- chrome/browser/signin/easy_unlock_auth_attempt.cc | 27 ++++++------ .../signin/easy_unlock_auth_attempt_unittest.cc | 49 +++++++++++----------- ...asy_unlock_screenlock_state_handler_unittest.cc | 29 +++++++------ chrome/browser/signin/easy_unlock_service.cc | 7 ++-- .../browser/signin/easy_unlock_service_regular.cc | 5 +-- .../signin/easy_unlock_service_signin_chromeos.cc | 5 +-- chrome/browser/signin/proximity_auth_facade.cc | 39 ----------------- chrome/browser/signin/proximity_auth_facade.h | 15 ------- .../webui/chromeos/login/signin_screen_handler.cc | 8 ++-- .../ui/webui/signin/user_manager_screen_handler.cc | 6 +-- chrome/chrome_browser.gypi | 2 - components/proximity_auth/screenlock_bridge.cc | 20 ++++++--- components/proximity_auth/screenlock_bridge.h | 15 +++++-- 17 files changed, 108 insertions(+), 148 deletions(-) delete mode 100644 chrome/browser/signin/proximity_auth_facade.cc delete mode 100644 chrome/browser/signin/proximity_auth_facade.h diff --git a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc index f56fbbb6b7f8..a04c385919bf 100644 --- a/chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc +++ b/chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.cc @@ -7,7 +7,6 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_reauth.h" #include "chrome/browser/chromeos/login/lock/screen_locker.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/grit/generated_resources.h" #include "chromeos/dbus/dbus_thread_manager.h" #include "chromeos/dbus/session_manager_client.h" @@ -85,8 +84,9 @@ class ReauthHandler : public content::NotificationObserver, const user_manager::UserList& lock_users = screen_locker->users(); DCHECK(lock_users.size() == 1); - GetScreenlockBridgeInstance()->lock_handler()->ShowUserPodCustomIcon( - lock_users[0]->email(), icon_options); + proximity_auth::ScreenlockBridge::Get() + ->lock_handler() + ->ShowUserPodCustomIcon(lock_users[0]->email(), icon_options); } // chromeos::AuthStatusConsumer: diff --git a/chrome/browser/chromeos/login/screens/user_selection_screen.cc b/chrome/browser/chromeos/login/screens/user_selection_screen.cc index 814faee0196f..ae3542276ad6 100644 --- a/chrome/browser/chromeos/login/screens/user_selection_screen.cc +++ b/chrome/browser/chromeos/login/screens/user_selection_screen.cc @@ -19,7 +19,6 @@ #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/profiles/profile_helper.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" #include "components/proximity_auth/screenlock_bridge.h" @@ -120,14 +119,14 @@ UserSelectionScreen::UserSelectionScreen(const std::string& display_type) } UserSelectionScreen::~UserSelectionScreen() { - GetScreenlockBridgeInstance()->SetLockHandler(nullptr); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(nullptr); ui::UserActivityDetector* activity_detector = ui::UserActivityDetector::Get(); if (activity_detector->HasObserver(this)) activity_detector->RemoveObserver(this); } void UserSelectionScreen::InitEasyUnlock() { - GetScreenlockBridgeInstance()->SetLockHandler(this); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); } void UserSelectionScreen::SetLoginDisplayDelegate( diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc index cc2001833a4e..bc58952fcd88 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_api.cc @@ -9,9 +9,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/signin/chrome_proximity_auth_client.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/common/extensions/api/screenlock_private.h" #include "chrome/common/extensions/extension_constants.h" +#include "components/proximity_auth/screenlock_bridge.h" #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/event_router.h" @@ -52,8 +52,8 @@ ScreenlockPrivateGetLockedFunction::ScreenlockPrivateGetLockedFunction() {} ScreenlockPrivateGetLockedFunction::~ScreenlockPrivateGetLockedFunction() {} bool ScreenlockPrivateGetLockedFunction::RunAsync() { - SetResult( - new base::FundamentalValue(GetScreenlockBridgeInstance()->IsLocked())); + SetResult(new base::FundamentalValue( + proximity_auth::ScreenlockBridge::Get()->IsLocked())); SendResponse(error_.empty()); return true; } @@ -77,9 +77,9 @@ bool ScreenlockPrivateSetLockedFunction::RunAsync() { // TODO(tbarzic): Move this logic to a new easyUnlockPrivate function. service->SetTrialRun(); } - GetScreenlockBridgeInstance()->Lock(); + proximity_auth::ScreenlockBridge::Get()->Lock(); } else { - GetScreenlockBridgeInstance()->Unlock( + proximity_auth::ScreenlockBridge::Get()->Unlock( service->proximity_auth_client()->GetAuthenticatedUsername()); } SendResponse(error_.empty()); @@ -107,7 +107,7 @@ bool ScreenlockPrivateAcceptAuthAttemptFunction::RunSync() { ScreenlockPrivateEventRouter::ScreenlockPrivateEventRouter( content::BrowserContext* context) : browser_context_(context) { - GetScreenlockBridgeInstance()->AddObserver(this); + proximity_auth::ScreenlockBridge::Get()->AddObserver(this); } ScreenlockPrivateEventRouter::~ScreenlockPrivateEventRouter() {} @@ -149,7 +149,7 @@ ScreenlockPrivateEventRouter::GetFactoryInstance() { } void ScreenlockPrivateEventRouter::Shutdown() { - GetScreenlockBridgeInstance()->RemoveObserver(this); + proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); } bool ScreenlockPrivateEventRouter::OnAuthAttempted( diff --git a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc index 42ce4fd2c8d7..d498c04e0bbb 100644 --- a/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc +++ b/chrome/browser/extensions/api/screenlock_private/screenlock_private_apitest.cc @@ -10,8 +10,8 @@ #include "chrome/browser/profiles/profile_info_cache.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/signin/signin_manager_factory.h" +#include "components/proximity_auth/screenlock_bridge.h" #include "components/signin/core/browser/signin_manager.h" #include "components/signin/core/common/profile_management_switches.h" #include "content/public/browser/notification_service.h" @@ -77,7 +77,7 @@ class ScreenlockPrivateApiTest : public ExtensionApiTest, const content::NotificationDetails& details) override { const std::string& content = *content::Details(details).ptr(); if (content == kAttemptClickAuthMessage) { - GetScreenlockBridgeInstance()->lock_handler()->SetAuthType( + proximity_auth::ScreenlockBridge::Get()->lock_handler()->SetAuthType( kTestUser, proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, base::string16()); EasyUnlockService::Get(profile())->AttemptAuth(kTestUser); diff --git a/chrome/browser/signin/easy_unlock_auth_attempt.cc b/chrome/browser/signin/easy_unlock_auth_attempt.cc index 5560754a974d..f55f49139269 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt.cc @@ -7,7 +7,6 @@ #include "base/bind.h" #include "base/logging.h" #include "chrome/browser/signin/easy_unlock_app_manager.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "components/proximity_auth/screenlock_bridge.h" #include "crypto/encryptor.h" #include "crypto/symmetric_key.h" @@ -51,26 +50,29 @@ void DefaultAuthAttemptFinalizedHandler( const std::string& user_id, const std::string& key_secret, const std::string& key_label) { - if (!GetScreenlockBridgeInstance()->IsLocked()) + if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) return; switch (auth_attempt_type) { case EasyUnlockAuthAttempt::TYPE_UNLOCK: if (success) { - GetScreenlockBridgeInstance()->lock_handler()->Unlock(user_id); + proximity_auth::ScreenlockBridge::Get()->lock_handler()->Unlock( + user_id); } else { - GetScreenlockBridgeInstance()->lock_handler()->EnableInput(); + proximity_auth::ScreenlockBridge::Get()->lock_handler()->EnableInput(); } return; case EasyUnlockAuthAttempt::TYPE_SIGNIN: if (success) { - GetScreenlockBridgeInstance()->lock_handler()->AttemptEasySignin( - user_id, key_secret, key_label); + proximity_auth::ScreenlockBridge::Get() + ->lock_handler() + ->AttemptEasySignin(user_id, key_secret, key_label); } else { // Attempting signin with an empty secret is equivalent to canceling the // attempt. - GetScreenlockBridgeInstance()->lock_handler()->AttemptEasySignin( - user_id, std::string(), std::string()); + proximity_auth::ScreenlockBridge::Get() + ->lock_handler() + ->AttemptEasySignin(user_id, std::string(), std::string()); } return; } @@ -100,11 +102,12 @@ EasyUnlockAuthAttempt::~EasyUnlockAuthAttempt() { bool EasyUnlockAuthAttempt::Start() { DCHECK_EQ(STATE_IDLE, state_); - if (!GetScreenlockBridgeInstance()->IsLocked()) + if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) return false; proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type = - GetScreenlockBridgeInstance()->lock_handler()->GetAuthType(user_id_); + proximity_auth::ScreenlockBridge::Get()->lock_handler()->GetAuthType( + user_id_); if (auth_type != proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK) { Cancel(user_id_); @@ -126,7 +129,7 @@ void EasyUnlockAuthAttempt::FinalizeUnlock(const std::string& user_id, if (state_ != STATE_RUNNING || user_id != user_id_) return; - if (!GetScreenlockBridgeInstance()->IsLocked()) + if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) return; if (type_ != TYPE_UNLOCK) { @@ -145,7 +148,7 @@ void EasyUnlockAuthAttempt::FinalizeSignin(const std::string& user_id, if (state_ != STATE_RUNNING || user_id != user_id_) return; - if (!GetScreenlockBridgeInstance()->IsLocked()) + if (!proximity_auth::ScreenlockBridge::Get()->IsLocked()) return; if (type_ != TYPE_SIGNIN) { diff --git a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc index 3b183cf60968..a8b49fd23bb8 100644 --- a/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc +++ b/chrome/browser/signin/easy_unlock_auth_attempt_unittest.cc @@ -6,7 +6,6 @@ #include "base/macros.h" #include "chrome/browser/signin/easy_unlock_app_manager.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "components/proximity_auth/screenlock_bridge.h" #include "testing/gtest/include/gtest/gtest.h" @@ -217,7 +216,7 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test { } void TearDown() override { - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); auth_attempt_.reset(); } @@ -225,7 +224,8 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test { void InitScreenLock() { lock_handler_.reset(new TestLockHandler(kTestUser1)); lock_handler_->set_state(TestLockHandler::STATE_ATTEMPTING_UNLOCK); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler( + lock_handler_.get()); } scoped_ptr auth_attempt_; @@ -237,7 +237,7 @@ class EasyUnlockAuthAttemptUnlockTest : public testing::Test { }; TEST_F(EasyUnlockAuthAttemptUnlockTest, StartWhenNotLocked) { - ASSERT_FALSE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_FALSE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); EXPECT_FALSE(auth_attempt_->Start()); EXPECT_EQ(0u, app_manager_->auth_attempt_count()); @@ -245,7 +245,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, StartWhenNotLocked) { TEST_F(EasyUnlockAuthAttemptUnlockTest, StartWhenAuthTypeIsPassword) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); lock_handler_->set_auth_type( @@ -260,7 +260,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, StartWhenAuthTypeIsPassword) { TEST_F(EasyUnlockAuthAttemptUnlockTest, StartWhenDispatchingAuthAttemptEventFails) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); app_manager_->set_auth_attempt_should_fail(true); @@ -273,7 +273,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, TEST_F(EasyUnlockAuthAttemptUnlockTest, ResetBeforeFinalizeUnlock) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -288,7 +288,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, ResetBeforeFinalizeUnlock) { TEST_F(EasyUnlockAuthAttemptUnlockTest, FinalizeUnlockFailure) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -303,7 +303,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, FinalizeUnlockFailure) { TEST_F(EasyUnlockAuthAttemptUnlockTest, FinalizeSigninCalled) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -320,7 +320,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, FinalizeSigninCalled) { TEST_F(EasyUnlockAuthAttemptUnlockTest, UnlockSucceeds) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -335,7 +335,7 @@ TEST_F(EasyUnlockAuthAttemptUnlockTest, UnlockSucceeds) { TEST_F(EasyUnlockAuthAttemptUnlockTest, FinalizeUnlockCalledForWrongUser) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_UNLOCK, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -370,7 +370,7 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test { } void TearDown() override { - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); auth_attempt_.reset(); } @@ -378,7 +378,8 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test { void InitScreenLock() { lock_handler_.reset(new TestLockHandler(kTestUser1)); lock_handler_->set_state(TestLockHandler::STATE_ATTEMPTING_SIGNIN); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler( + lock_handler_.get()); } scoped_ptr auth_attempt_; @@ -390,7 +391,7 @@ class EasyUnlockAuthAttemptSigninTest : public testing::Test { }; TEST_F(EasyUnlockAuthAttemptSigninTest, StartWhenNotLocked) { - ASSERT_FALSE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_FALSE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); EXPECT_FALSE(auth_attempt_->Start()); EXPECT_EQ(0u, app_manager_->auth_attempt_count()); @@ -398,7 +399,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, StartWhenNotLocked) { TEST_F(EasyUnlockAuthAttemptSigninTest, StartWhenAuthTypeIsPassword) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); lock_handler_->set_auth_type( @@ -413,7 +414,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, StartWhenAuthTypeIsPassword) { TEST_F(EasyUnlockAuthAttemptSigninTest, StartWhenDispatchingAuthAttemptEventFails) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); app_manager_->set_auth_attempt_should_fail(true); @@ -426,7 +427,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, TEST_F(EasyUnlockAuthAttemptSigninTest, ResetBeforeFinalizeSignin) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -441,7 +442,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, ResetBeforeFinalizeSignin) { TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeSigninWithEmtpySecret) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -456,7 +457,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeSigninWithEmtpySecret) { TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeSigninWithEmtpyKey) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -471,7 +472,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeSigninWithEmtpyKey) { TEST_F(EasyUnlockAuthAttemptSigninTest, SigninSuccess) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -488,7 +489,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, SigninSuccess) { TEST_F(EasyUnlockAuthAttemptSigninTest, WrongWrappedSecret) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -503,7 +504,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, WrongWrappedSecret) { TEST_F(EasyUnlockAuthAttemptSigninTest, InvalidSessionKey) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -518,7 +519,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, InvalidSessionKey) { TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeUnlockCalled) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); @@ -533,7 +534,7 @@ TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeUnlockCalled) { TEST_F(EasyUnlockAuthAttemptSigninTest, FinalizeSigninCalledForWrongUser) { InitScreenLock(); - ASSERT_TRUE(GetScreenlockBridgeInstance()->IsLocked()); + ASSERT_TRUE(proximity_auth::ScreenlockBridge::Get()->IsLocked()); ASSERT_EQ(TestLockHandler::STATE_ATTEMPTING_SIGNIN, lock_handler_->state()); ASSERT_TRUE(auth_attempt_->Start()); diff --git a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc index e9c6fc876490..ba4e4ae376ca 100644 --- a/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc +++ b/chrome/browser/signin/easy_unlock_screenlock_state_handler_unittest.cc @@ -14,7 +14,6 @@ #include "base/test/histogram_tester.h" #include "chrome/browser/signin/easy_unlock_metrics.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/grit/generated_resources.h" #include "components/proximity_auth/screenlock_bridge.h" #include "components/proximity_auth/screenlock_state.h" @@ -214,7 +213,7 @@ class EasyUnlockScreenlockStateHandlerTest : public testing::Test { // Create and inject fake lock handler to the screenlock bridge. lock_handler_.reset(new TestLockHandler(user_email_)); proximity_auth::ScreenlockBridge* screenlock_bridge = - GetScreenlockBridgeInstance(); + proximity_auth::ScreenlockBridge::Get(); screenlock_bridge->SetLockHandler(lock_handler_.get()); // Create the screenlock state handler object that will be tested. @@ -225,7 +224,7 @@ class EasyUnlockScreenlockStateHandlerTest : public testing::Test { } void TearDown() override { - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(); state_handler_.reset(); } @@ -419,10 +418,10 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StatePreservedWhenScreenUnlocks) { lock_handler_->GetAuthType(user_email_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::USER_CLICK, @@ -438,13 +437,13 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, StateChangeWhileScreenUnlocked) { lock_handler_->GetAuthType(user_email_)); ASSERT_TRUE(lock_handler_->HasCustomIcon()); - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); state_handler_->ChangeState(ScreenlockState::BLUETOOTH_CONNECTING); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, @@ -475,9 +474,9 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, EXPECT_FALSE(lock_handler_->CustomIconHardlocksOnClick()); } - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); for (size_t i = 0; i < states.size(); ++i) { SCOPED_TRACE(base::IntToString(i)); @@ -622,20 +621,20 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, state_handler_->SetHardlockState( EasyUnlockScreenlockStateHandler::NO_HARDLOCK); - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); state_handler_->ChangeState(ScreenlockState::NO_PHONE); EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount()); EXPECT_TRUE(lock_handler_->HasCustomIcon()); - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_TRUE(lock_handler_->HasCustomIcon()); @@ -657,10 +656,10 @@ TEST_F(EasyUnlockScreenlockStateHandlerTest, HardlockStatePersistsOverUnlocks) { EasyUnlockScreenlockStateHandler::USER_HARDLOCK); EXPECT_EQ(2u, lock_handler_->GetAndResetShowIconCount()); - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); lock_handler_.reset(new TestLockHandler(user_email_)); EXPECT_EQ(0u, lock_handler_->GetAndResetShowIconCount()); - GetScreenlockBridgeInstance()->SetLockHandler(lock_handler_.get()); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(lock_handler_.get()); EXPECT_EQ(1u, lock_handler_->GetAndResetShowIconCount()); EXPECT_EQ(proximity_auth::ScreenlockBridge::LockHandler::OFFLINE_PASSWORD, diff --git a/chrome/browser/signin/easy_unlock_service.cc b/chrome/browser/signin/easy_unlock_service.cc index 43e652be3438..6236dfe813c0 100644 --- a/chrome/browser/signin/easy_unlock_service.cc +++ b/chrome/browser/signin/easy_unlock_service.cc @@ -21,11 +21,11 @@ #include "base/version.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/signin/chrome_proximity_auth_client.h" #include "chrome/browser/signin/easy_unlock_app_manager.h" #include "chrome/browser/signin/easy_unlock_service_factory.h" #include "chrome/browser/signin/easy_unlock_service_observer.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" @@ -457,7 +457,8 @@ EasyUnlockScreenlockStateHandler* return NULL; if (!screenlock_state_handler_) { screenlock_state_handler_.reset(new EasyUnlockScreenlockStateHandler( - GetUserEmail(), GetHardlockState(), GetScreenlockBridgeInstance())); + GetUserEmail(), GetHardlockState(), + proximity_auth::ScreenlockBridge::Get())); } return screenlock_state_handler_.get(); } @@ -695,7 +696,7 @@ void EasyUnlockService::UpdateAppState() { !proximity_auth_ble_system_) { proximity_auth_ble_system_.reset( new proximity_auth::ProximityAuthBleSystem( - GetScreenlockBridgeInstance(), &proximity_auth_client_, + proximity_auth::ScreenlockBridge::Get(), &proximity_auth_client_, CreateCryptAuthClientFactory())); } diff --git a/chrome/browser/signin/easy_unlock_service_regular.cc b/chrome/browser/signin/easy_unlock_service_regular.cc index 17ee0ff4db4e..24cb23406826 100644 --- a/chrome/browser/signin/easy_unlock_service_regular.cc +++ b/chrome/browser/signin/easy_unlock_service_regular.cc @@ -11,7 +11,6 @@ #include "base/values.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/common/extensions/api/easy_unlock_private.h" #include "chrome/common/extensions/extension_constants.h" @@ -274,7 +273,7 @@ void EasyUnlockServiceRegular::SetAutoPairingResult( } void EasyUnlockServiceRegular::InitializeInternal() { - GetScreenlockBridgeInstance()->AddObserver(this); + proximity_auth::ScreenlockBridge::Get()->AddObserver(this); registrar_.Init(profile()->GetPrefs()); registrar_.Add( prefs::kEasyUnlockAllowed, @@ -293,7 +292,7 @@ void EasyUnlockServiceRegular::ShutdownInternal() { turn_off_flow_status_ = EasyUnlockService::IDLE; registrar_.RemoveAll(); - GetScreenlockBridgeInstance()->RemoveObserver(this); + proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); } bool EasyUnlockServiceRegular::IsAllowedInternal() const { diff --git a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc index ad3536f856e0..e30ee9298818 100644 --- a/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc +++ b/chrome/browser/signin/easy_unlock_service_signin_chromeos.cc @@ -16,7 +16,6 @@ #include "chrome/browser/chromeos/login/session/user_session_manager.h" #include "chrome/browser/signin/easy_unlock_app_manager.h" #include "chrome/browser/signin/easy_unlock_metrics.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chromeos/login/auth/user_context.h" #include "chromeos/tpm/tpm_token_loader.h" @@ -224,7 +223,7 @@ void EasyUnlockServiceSignin::InitializeInternal() { chromeos::LoginState::Get()->AddObserver(this); proximity_auth::ScreenlockBridge* screenlock_bridge = - GetScreenlockBridgeInstance(); + proximity_auth::ScreenlockBridge::Get(); screenlock_bridge->AddObserver(this); if (!screenlock_bridge->focused_user_id().empty()) OnFocusedUserChanged(screenlock_bridge->focused_user_id()); @@ -236,7 +235,7 @@ void EasyUnlockServiceSignin::ShutdownInternal() { service_active_ = false; weak_ptr_factory_.InvalidateWeakPtrs(); - GetScreenlockBridgeInstance()->RemoveObserver(this); + proximity_auth::ScreenlockBridge::Get()->RemoveObserver(this); chromeos::LoginState::Get()->RemoveObserver(this); STLDeleteContainerPairSecondPointers(user_data_.begin(), user_data_.end()); user_data_.clear(); diff --git a/chrome/browser/signin/proximity_auth_facade.cc b/chrome/browser/signin/proximity_auth_facade.cc deleted file mode 100644 index 71de2e8c3f79..000000000000 --- a/chrome/browser/signin/proximity_auth_facade.cc +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "chrome/browser/signin/proximity_auth_facade.h" - -#include "base/lazy_instance.h" -#include "components/proximity_auth/screenlock_bridge.h" - -namespace { - -// A facade class that is the glue required to initialize and manage the -// lifecycle of various objects of the Proximity Auth component. -class ProximityAuthFacade { - public: - proximity_auth::ScreenlockBridge* GetScreenlockBridge() { - return &screenlock_bridge_; - } - - private: - friend struct base::DefaultLazyInstanceTraits; - friend struct base::DefaultDeleter; - - ProximityAuthFacade() {} - ~ProximityAuthFacade() {} - - proximity_auth::ScreenlockBridge screenlock_bridge_; - - DISALLOW_COPY_AND_ASSIGN(ProximityAuthFacade); -}; - -base::LazyInstance g_proximity_auth_facade_instance = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - -proximity_auth::ScreenlockBridge* GetScreenlockBridgeInstance() { - return g_proximity_auth_facade_instance.Pointer()->GetScreenlockBridge(); -} diff --git a/chrome/browser/signin/proximity_auth_facade.h b/chrome/browser/signin/proximity_auth_facade.h deleted file mode 100644 index 9a99ed16abf8..000000000000 --- a/chrome/browser/signin/proximity_auth_facade.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef CHROME_BROWSER_SIGNIN_PROXIMITY_AUTH_FACADE_H_ -#define CHROME_BROWSER_SIGNIN_PROXIMITY_AUTH_FACADE_H_ - -namespace proximity_auth { -class ScreenlockBridge; -} - -// Returns the global proximity_auth::ScreenlockBridge instance. -proximity_auth::ScreenlockBridge* GetScreenlockBridgeInstance(); - -#endif // CHROME_BROWSER_SIGNIN_PROXIMITY_AUTH_FACADE_H_ diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 4767c4ea3f7b..3e6194c6e04d 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -52,7 +52,6 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_metrics.h" #include "chrome/browser/signin/easy_unlock_service.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" @@ -71,6 +70,7 @@ #include "chromeos/network/network_state_handler.h" #include "chromeos/network/portal_detector/network_portal_detector.h" #include "components/login/localized_values_builder.h" +#include "components/proximity_auth/screenlock_bridge.h" #include "components/user_manager/user.h" #include "components/user_manager/user_manager.h" #include "components/user_manager/user_type.h" @@ -296,8 +296,8 @@ SigninScreenHandler::~SigninScreenHandler() { max_mode_delegate_->RemoveObserver(this); max_mode_delegate_.reset(NULL); } - GetScreenlockBridgeInstance()->SetLockHandler(NULL); - GetScreenlockBridgeInstance()->SetFocusedUser(""); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(""); } // static @@ -1281,7 +1281,7 @@ void SigninScreenHandler::HandleUpdateOfflineLogin(bool offline_login_active) { void SigninScreenHandler::HandleFocusPod(const std::string& user_id) { SetUserInputMethod(user_id, ime_state_.get()); WallpaperManager::Get()->SetUserWallpaperDelayed(user_id); - GetScreenlockBridgeInstance()->SetFocusedUser(user_id); + proximity_auth::ScreenlockBridge::Get()->SetFocusedUser(user_id); if (delegate_) delegate_->CheckUserStatus(user_id); if (!test_focus_pod_callback_.is_null()) diff --git a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc index 530558500204..4f9c2c2f320c 100644 --- a/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc +++ b/chrome/browser/ui/webui/signin/user_manager_screen_handler.cc @@ -25,7 +25,6 @@ #include "chrome/browser/profiles/profile_window.h" #include "chrome/browser/profiles/profiles_state.h" #include "chrome/browser/signin/local_auth.h" -#include "chrome/browser/signin/proximity_auth_facade.h" #include "chrome/browser/ui/app_list/app_list_service.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/browser_dialogs.h" @@ -39,6 +38,7 @@ #include "chrome/common/url_constants.h" #include "chrome/grit/chromium_strings.h" #include "chrome/grit/generated_resources.h" +#include "components/proximity_auth/screenlock_bridge.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/web_contents.h" #include "content/public/browser/web_ui.h" @@ -302,7 +302,7 @@ UserManagerScreenHandler::UserManagerScreenHandler() } UserManagerScreenHandler::~UserManagerScreenHandler() { - GetScreenlockBridgeInstance()->SetLockHandler(NULL); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(NULL); } void UserManagerScreenHandler::ShowBannerMessage( @@ -394,7 +394,7 @@ void UserManagerScreenHandler::HandleInitialize(const base::ListValue* args) { desktop_type_ = chrome::GetHostDesktopTypeForNativeView( web_ui()->GetWebContents()->GetNativeView()); - GetScreenlockBridgeInstance()->SetLockHandler(this); + proximity_auth::ScreenlockBridge::Get()->SetLockHandler(this); } void UserManagerScreenHandler::HandleAddUser(const base::ListValue* args) { diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0d6640a807a5..ab638b9f7075 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1498,8 +1498,6 @@ 'browser/signin/easy_unlock_service_regular.h', 'browser/signin/easy_unlock_service_signin_chromeos.cc', 'browser/signin/easy_unlock_service_signin_chromeos.h', - 'browser/signin/proximity_auth_facade.cc', - 'browser/signin/proximity_auth_facade.h', 'browser/speech/extension_api/tts_engine_extension_api.cc', 'browser/speech/extension_api/tts_engine_extension_api.h', 'browser/speech/extension_api/tts_engine_extension_observer.cc', diff --git a/components/proximity_auth/screenlock_bridge.cc b/components/proximity_auth/screenlock_bridge.cc index c3dd25f50e6a..029e0b781e73 100644 --- a/components/proximity_auth/screenlock_bridge.cc +++ b/components/proximity_auth/screenlock_bridge.cc @@ -15,6 +15,9 @@ namespace proximity_auth { namespace { +base::LazyInstance g_screenlock_bridge_instance = + LAZY_INSTANCE_INITIALIZER; + // Ids for the icons that are supported by lock screen and signin screen // account picker as user pod custom icons. // The id's should be kept in sync with values used by user_pod_row.js. @@ -48,12 +51,6 @@ std::string GetIdForIcon(ScreenlockBridge::UserPodCustomIcon icon) { } // namespace -ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { -} - -ScreenlockBridge::~ScreenlockBridge() { -} - ScreenlockBridge::UserPodCustomIconOptions::UserPodCustomIconOptions() : autoshow_tooltip_(false), hardlock_on_click_(false), @@ -113,6 +110,11 @@ void ScreenlockBridge::UserPodCustomIconOptions::SetTrialRun() { is_trial_run_ = true; } +// static +ScreenlockBridge* ScreenlockBridge::Get() { + return g_screenlock_bridge_instance.Pointer(); +} + void ScreenlockBridge::SetLockHandler(LockHandler* lock_handler) { DCHECK(lock_handler_ == nullptr || lock_handler == nullptr); @@ -170,4 +172,10 @@ void ScreenlockBridge::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } +ScreenlockBridge::ScreenlockBridge() : lock_handler_(nullptr) { +} + +ScreenlockBridge::~ScreenlockBridge() { +} + } // namespace proximity_auth diff --git a/components/proximity_auth/screenlock_bridge.h b/components/proximity_auth/screenlock_bridge.h index 92cc94f0a8d9..9b4739298c9a 100644 --- a/components/proximity_auth/screenlock_bridge.h +++ b/components/proximity_auth/screenlock_bridge.h @@ -8,6 +8,7 @@ #include #include "base/basictypes.h" +#include "base/lazy_instance.h" #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "base/observer_list.h" @@ -23,9 +24,6 @@ namespace proximity_auth { // used solely for the lock screen anymore. class ScreenlockBridge { public: - ScreenlockBridge(); - ~ScreenlockBridge(); - // User pod icons supported by lock screen / signin screen UI. enum UserPodCustomIcon { USER_POD_CUSTOM_ICON_NONE, @@ -154,6 +152,8 @@ class ScreenlockBridge { virtual ~Observer() {} }; + static ScreenlockBridge* Get(); + void SetLockHandler(LockHandler* lock_handler); void SetFocusedUser(const std::string& user_id); @@ -171,7 +171,14 @@ class ScreenlockBridge { std::string focused_user_id() const { return focused_user_id_; } private: - LockHandler* lock_handler_; // Not owned + friend struct base::DefaultLazyInstanceTraits; + friend struct base::DefaultDeleter; + + ScreenlockBridge(); + ~ScreenlockBridge(); + + LockHandler* lock_handler_; // Not owned + // The last focused user's id. std::string focused_user_id_; base::ObserverList observers_; -- 2.11.4.GIT