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
44 EXPAND_THEN_USER_CLICK
= 4,
47 // Displays |message| in a banner on the lock screen.
48 virtual void ShowBannerMessage(const std::string
& message
) = 0;
50 // Shows a custom icon in the user pod on the lock screen.
51 virtual void ShowUserPodCustomIcon(const std::string
& user_email
,
52 const gfx::Image
& icon
) = 0;
54 // Hides the custom icon in user pod for a user.
55 virtual void HideUserPodCustomIcon(const std::string
& user_email
) = 0;
57 // (Re)enable lock screen UI.
58 virtual void EnableInput() = 0;
60 // Set the authentication type to be used on the lock screen.
61 virtual void SetAuthType(const std::string
& user_email
,
63 const std::string
& auth_value
) = 0;
65 // Returns the authentication type used for a user.
66 virtual AuthType
GetAuthType(const std::string
& user_email
) const = 0;
68 // Unlock from easy unlock app for a user.
69 virtual void Unlock(const std::string
& user_email
) = 0;
72 virtual ~LockHandler() {}
75 static ScreenlockBridge
* Get();
76 static std::string
GetAuthenticatedUserEmail(Profile
* profile
);
78 void SetLockHandler(LockHandler
* lock_handler
);
80 bool IsLocked() const;
81 void Lock(Profile
* profile
);
82 void Unlock(Profile
* profile
);
84 void AddObserver(Observer
* observer
);
85 void RemoveObserver(Observer
* observer
);
87 LockHandler
* lock_handler() { return lock_handler_
; }
90 friend struct base::DefaultLazyInstanceTraits
<ScreenlockBridge
>;
91 friend struct base::DefaultDeleter
<ScreenlockBridge
>;
96 LockHandler
* lock_handler_
; // Not owned
97 ObserverList
<Observer
, true> observers_
;
99 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge
);
102 #endif // CHROME_BROWSER_SIGNIN_SCREENLOCK_BRIDGE_H_