Disable accessible touch exploration by default.
[chromium-blink-merge.git] / chrome / browser / signin / screenlock_bridge.h
blob1d75e3078b257f9160354ad8a7cb4e633392236f
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_
8 #include <string>
10 #include "base/lazy_instance.h"
11 #include "base/macros.h"
12 #include "base/observer_list.h"
14 namespace gfx {
15 class Image;
18 class Profile;
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 {
24 public:
25 class Observer {
26 public:
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;
31 protected:
32 virtual ~Observer() {}
35 class LockHandler {
36 public:
37 // Supported authentication types. Keep in sync with the enum in
38 // user_pod_row.js.
39 enum AuthType {
40 OFFLINE_PASSWORD = 0,
41 ONLINE_SIGN_IN = 1,
42 NUMERIC_PIN = 2,
43 USER_CLICK = 3,
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,
62 AuthType auth_type,
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;
71 protected:
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_; }
89 private:
90 friend struct base::DefaultLazyInstanceTraits<ScreenlockBridge>;
91 friend struct base::DefaultDeleter<ScreenlockBridge>;
93 ScreenlockBridge();
94 ~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_