OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 5 #ifndef COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
6 #define COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 6 #define COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/lazy_instance.h" | 11 #include "base/lazy_instance.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/values.h" | 15 #include "base/values.h" |
| 16 #include "components/proximity_auth/public/interfaces/auth_type.mojom.h" |
16 #include "components/signin/core/account_id/account_id.h" | 17 #include "components/signin/core/account_id/account_id.h" |
17 | 18 |
18 namespace proximity_auth { | 19 namespace proximity_auth { |
19 | 20 |
20 // ScreenlockBridge brings together the screenLockPrivate API and underlying | 21 // ScreenlockBridge brings together the screenLockPrivate API and underlying |
21 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other | 22 // support. On ChromeOS, it delegates calls to the ScreenLocker. On other |
22 // platforms, it delegates calls to UserManagerUI (and friends). | 23 // platforms, it delegates calls to UserManagerUI (and friends). |
23 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not | 24 // TODO(tbarzic): Rename ScreenlockBridge to SignInScreenBridge, as this is not |
24 // used solely for the lock screen anymore. | 25 // used solely for the lock screen anymore. |
25 class ScreenlockBridge { | 26 class ScreenlockBridge { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 bool hardlock_on_click_; | 94 bool hardlock_on_click_; |
94 | 95 |
95 bool is_trial_run_; | 96 bool is_trial_run_; |
96 | 97 |
97 DISALLOW_COPY_AND_ASSIGN(UserPodCustomIconOptions); | 98 DISALLOW_COPY_AND_ASSIGN(UserPodCustomIconOptions); |
98 }; | 99 }; |
99 | 100 |
100 class LockHandler { | 101 class LockHandler { |
101 public: | 102 public: |
102 // Supported authentication types. Keep in sync with the enum in | |
103 // user_pod_row.js. | |
104 enum AuthType { | |
105 OFFLINE_PASSWORD = 0, | |
106 ONLINE_SIGN_IN = 1, | |
107 NUMERIC_PIN = 2, | |
108 USER_CLICK = 3, | |
109 EXPAND_THEN_USER_CLICK = 4, | |
110 FORCE_OFFLINE_PASSWORD = 5 | |
111 }; | |
112 | |
113 enum ScreenType { SIGNIN_SCREEN = 0, LOCK_SCREEN = 1, OTHER_SCREEN = 2 }; | 103 enum ScreenType { SIGNIN_SCREEN = 0, LOCK_SCREEN = 1, OTHER_SCREEN = 2 }; |
114 | 104 |
115 // Displays |message| in a banner on the lock screen. | 105 // Displays |message| in a banner on the lock screen. |
116 virtual void ShowBannerMessage(const base::string16& message) = 0; | 106 virtual void ShowBannerMessage(const base::string16& message) = 0; |
117 | 107 |
118 // Shows a custom icon in the user pod on the lock screen. | 108 // Shows a custom icon in the user pod on the lock screen. |
119 virtual void ShowUserPodCustomIcon( | 109 virtual void ShowUserPodCustomIcon( |
120 const AccountId& account_id, | 110 const AccountId& account_id, |
121 const UserPodCustomIconOptions& icon) = 0; | 111 const UserPodCustomIconOptions& icon) = 0; |
122 | 112 |
123 // Hides the custom icon in user pod for a user. | 113 // Hides the custom icon in user pod for a user. |
124 virtual void HideUserPodCustomIcon(const AccountId& account_id) = 0; | 114 virtual void HideUserPodCustomIcon(const AccountId& account_id) = 0; |
125 | 115 |
126 // (Re)enable lock screen UI. | 116 // (Re)enable lock screen UI. |
127 virtual void EnableInput() = 0; | 117 virtual void EnableInput() = 0; |
128 | 118 |
129 // Set the authentication type to be used on the lock screen. | 119 // Set the authentication type to be used on the lock screen. |
130 virtual void SetAuthType(const AccountId& account_id, | 120 virtual void SetAuthType(const AccountId& account_id, |
131 AuthType auth_type, | 121 proximity_auth::mojom::AuthType auth_type, |
132 const base::string16& auth_value) = 0; | 122 const base::string16& auth_value) = 0; |
133 | 123 |
134 // Returns the authentication type used for a user. | 124 // Returns the authentication type used for a user. |
135 virtual AuthType GetAuthType(const AccountId& account_id) const = 0; | 125 virtual proximity_auth::mojom::AuthType GetAuthType( |
| 126 const AccountId& account_id) const = 0; |
136 | 127 |
137 // Returns the type of the screen -- a signin or a lock screen. | 128 // Returns the type of the screen -- a signin or a lock screen. |
138 virtual ScreenType GetScreenType() const = 0; | 129 virtual ScreenType GetScreenType() const = 0; |
139 | 130 |
140 // Unlocks from easy unlock app for a user. | 131 // Unlocks from easy unlock app for a user. |
141 virtual void Unlock(const AccountId& account_id) = 0; | 132 virtual void Unlock(const AccountId& account_id) = 0; |
142 | 133 |
143 // Attempts to login the user using an easy unlock key. | 134 // Attempts to login the user using an easy unlock key. |
144 virtual void AttemptEasySignin(const AccountId& account_id, | 135 virtual void AttemptEasySignin(const AccountId& account_id, |
145 const std::string& secret, | 136 const std::string& secret, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 // The last focused user's id. | 185 // The last focused user's id. |
195 AccountId focused_account_id_; | 186 AccountId focused_account_id_; |
196 base::ObserverList<Observer, true> observers_; | 187 base::ObserverList<Observer, true> observers_; |
197 | 188 |
198 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); | 189 DISALLOW_COPY_AND_ASSIGN(ScreenlockBridge); |
199 }; | 190 }; |
200 | 191 |
201 } // namespace proximity_auth | 192 } // namespace proximity_auth |
202 | 193 |
203 #endif // COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ | 194 #endif // COMPONENTS_PROXIMITY_AUTH_SCREENLOCK_BRIDGE_H_ |
OLD | NEW |