diff options
author | isherman <isherman@chromium.org> | 2015-07-01 01:00:55 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-01 08:01:18 +0000 |
commit | 3ff77c2ed40bcaea50e22142aaebc2dc91e3c796 (patch) | |
tree | 05faa618df2634915cbbb1a74c0af1baf5adc8d2 /components/proximity_auth | |
parent | fa271c3b0a42ae476ca43d6e6f45ad96a61bf761 (diff) | |
download | chromium_src-3ff77c2ed40bcaea50e22142aaebc2dc91e3c796.zip chromium_src-3ff77c2ed40bcaea50e22142aaebc2dc91e3c796.tar.gz chromium_src-3ff77c2ed40bcaea50e22142aaebc2dc91e3c796.tar.bz2 |
[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}
Diffstat (limited to 'components/proximity_auth')
-rw-r--r-- | components/proximity_auth/screenlock_bridge.cc | 20 | ||||
-rw-r--r-- | components/proximity_auth/screenlock_bridge.h | 15 |
2 files changed, 25 insertions, 10 deletions
diff --git a/components/proximity_auth/screenlock_bridge.cc b/components/proximity_auth/screenlock_bridge.cc index c3dd25f5..029e0b7 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<ScreenlockBridge> 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 92cc94f..9b47392 100644 --- a/components/proximity_auth/screenlock_bridge.h +++ b/components/proximity_auth/screenlock_bridge.h @@ -8,6 +8,7 @@ #include <string> #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<ScreenlockBridge>; + friend struct base::DefaultDeleter<ScreenlockBridge>; + + ScreenlockBridge(); + ~ScreenlockBridge(); + + LockHandler* lock_handler_; // Not owned + // The last focused user's id. std::string focused_user_id_; base::ObserverList<Observer, true> observers_; |