OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
16 #include "chrome/browser/profiles/profile_metrics.h" | 16 #include "chrome/browser/profiles/profile_metrics.h" |
17 #include "chrome/browser/signin/screenlock_bridge.h" | |
18 #include "chrome/browser/ui/host_desktop.h" | 17 #include "chrome/browser/ui/host_desktop.h" |
| 18 #include "components/proximity_auth/screenlock_bridge.h" |
19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
21 #include "content/public/browser/web_ui_message_handler.h" | 21 #include "content/public/browser/web_ui_message_handler.h" |
22 #include "google_apis/gaia/gaia_auth_consumer.h" | 22 #include "google_apis/gaia/gaia_auth_consumer.h" |
23 | 23 |
24 class GaiaAuthFetcher; | 24 class GaiaAuthFetcher; |
25 | 25 |
26 namespace base { | 26 namespace base { |
27 class DictionaryValue; | 27 class DictionaryValue; |
28 class FilePath; | 28 class FilePath; |
29 class ListValue; | 29 class ListValue; |
30 } | 30 } |
31 | 31 |
32 class UserManagerScreenHandler : public content::WebUIMessageHandler, | 32 class UserManagerScreenHandler |
33 public ScreenlockBridge::LockHandler, | 33 : public content::WebUIMessageHandler, |
34 public GaiaAuthConsumer, | 34 public proximity_auth::ScreenlockBridge::LockHandler, |
35 public content::NotificationObserver { | 35 public GaiaAuthConsumer, |
| 36 public content::NotificationObserver { |
36 public: | 37 public: |
37 UserManagerScreenHandler(); | 38 UserManagerScreenHandler(); |
38 ~UserManagerScreenHandler() override; | 39 ~UserManagerScreenHandler() override; |
39 | 40 |
40 // WebUIMessageHandler implementation. | 41 // WebUIMessageHandler implementation. |
41 void RegisterMessages() override; | 42 void RegisterMessages() override; |
42 | 43 |
43 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 44 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
44 | 45 |
45 // content::NotificationObserver implementation: | 46 // content::NotificationObserver implementation: |
46 void Observe(int type, | 47 void Observe(int type, |
47 const content::NotificationSource& source, | 48 const content::NotificationSource& source, |
48 const content::NotificationDetails& details) override; | 49 const content::NotificationDetails& details) override; |
49 | 50 |
50 // ScreenlockBridge::LockHandler implementation. | 51 // proximity_auth::ScreenlockBridge::LockHandler implementation. |
51 void ShowBannerMessage(const base::string16& message) override; | 52 void ShowBannerMessage(const base::string16& message) override; |
52 void ShowUserPodCustomIcon( | 53 void ShowUserPodCustomIcon( |
53 const std::string& user_email, | 54 const std::string& user_email, |
54 const ScreenlockBridge::UserPodCustomIconOptions& icon_options) override; | 55 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& |
| 56 icon_options) override; |
55 void HideUserPodCustomIcon(const std::string& user_email) override; | 57 void HideUserPodCustomIcon(const std::string& user_email) override; |
56 void EnableInput() override; | 58 void EnableInput() override; |
57 void SetAuthType(const std::string& user_email, | 59 void SetAuthType( |
58 ScreenlockBridge::LockHandler::AuthType auth_type, | 60 const std::string& user_email, |
59 const base::string16& auth_value) override; | 61 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, |
| 62 const base::string16& auth_value) override; |
60 AuthType GetAuthType(const std::string& user_email) const override; | 63 AuthType GetAuthType(const std::string& user_email) const override; |
61 ScreenType GetScreenType() const override; | 64 ScreenType GetScreenType() const override; |
62 void Unlock(const std::string& user_email) override; | 65 void Unlock(const std::string& user_email) override; |
63 void AttemptEasySignin(const std::string& user_email, | 66 void AttemptEasySignin(const std::string& user_email, |
64 const std::string& secret, | 67 const std::string& secret, |
65 const std::string& key_label) override; | 68 const std::string& key_label) override; |
66 | 69 |
67 private: | 70 private: |
68 // An observer for any changes to Profiles in the ProfileInfoCache so that | 71 // An observer for any changes to Profiles in the ProfileInfoCache so that |
69 // all the visible user manager screens can be updated. | 72 // all the visible user manager screens can be updated. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 111 |
109 // The index of the profile currently being authenticated. | 112 // The index of the profile currently being authenticated. |
110 size_t authenticating_profile_index_; | 113 size_t authenticating_profile_index_; |
111 | 114 |
112 // Login password, held during on-line auth for saving later if correct. | 115 // Login password, held during on-line auth for saving later if correct. |
113 std::string password_attempt_; | 116 std::string password_attempt_; |
114 | 117 |
115 // URL hash, used to key post-profile actions if present. | 118 // URL hash, used to key post-profile actions if present. |
116 std::string url_hash_; | 119 std::string url_hash_; |
117 | 120 |
118 typedef std::map<std::string, ScreenlockBridge::LockHandler::AuthType> | 121 typedef std::map<std::string, |
| 122 proximity_auth::ScreenlockBridge::LockHandler::AuthType> |
119 UserAuthTypeMap; | 123 UserAuthTypeMap; |
120 UserAuthTypeMap user_auth_type_map_; | 124 UserAuthTypeMap user_auth_type_map_; |
121 | 125 |
122 content::NotificationRegistrar registrar_; | 126 content::NotificationRegistrar registrar_; |
123 | 127 |
124 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; | 128 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; |
125 | 129 |
126 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); | 130 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); |
127 }; | 131 }; |
128 | 132 |
129 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 133 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
OLD | NEW |