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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_
6 #define CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_
10 #include "base/lazy_instance.h"
11 #include "base/macros.h"
12 #include "base/observer_list.h"
20 // ScreenlockBridge brings together the screenLockPrivate API and underlying
21 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other
22 // platforms, it delegates calls to UserManagerUI (and friends).
23 class ScreenlockBridge
{
27 // Invoked after the screen is locked.
28 virtual void OnScreenDidLock() = 0;
29 // Invoked after the screen lock is dismissed.
30 virtual void OnScreenDidUnlock() = 0;
32 virtual ~Observer() {}
37 // Supported authentication types. Keep in sync with the enum in
46 // Displays |message| in a banner on the lock screen.
47 virtual void ShowBannerMessage(const std::string
& message
) = 0;
49 // Shows a custom icon in the user pod on the lock screen.
50 virtual void ShowUserPodCustomIcon(const std::string
& user_email
,
51 const gfx::Image
& icon
) = 0;
53 // Hides the custom icon in user pod for a user.
54 virtual void HideUserPodCustomIcon(const std::string
& user_email
) = 0;
56 // (Re)enable lock screen UI.
57 virtual void EnableInput() = 0;
59 // Set the authentication type to be used on the lock screen.
60 virtual void SetAuthType(const std::string
& user_email
,
62 const std::string
& auth_value
) = 0;
64 // Returns the authentication type used for a user.
65 virtual AuthType
GetAuthType(const std::string
& user_email
) const = 0;
67 // Unlock from easy unlock app for a user.
68 virtual void Unlock(const std::string
& user_email
) = 0;
71 virtual ~LockHandler() {}
74 static ScreenlockBridge
* Get();
75 static std::string
GetAuthenticatedUserEmail(Profile
* profile
);
77 void SetLockHandler(LockHandler
* lock_handler
);
79 bool IsLocked() const;
80 void Lock(Profile
* profile
);
81 void Unlock(Profile
* profile
);
83 void AddObserver(Observer
* observer
);
84 void RemoveObserver(Observer
* observer
);
86 LockHandler
* lock_handler() { return lock_handler_
; }
89 friend struct base::DefaultLazyInstanceTraits
<ScreenlockBridge
>;
90 friend struct base::DefaultDeleter
<ScreenlockBridge
>;
95 LockHandler
* lock_handler_
; // Not owned
96 ObserverList
<Observer
, true> observers_
;
98 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge
);
101 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_