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/ui/host_desktop.h" | 17 #include "chrome/browser/ui/host_desktop.h" |
18 #include "components/proximity_auth/screenlock_bridge.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" | |
23 #include "google_apis/gaia/gaia_oauth_client.h" | 22 #include "google_apis/gaia/gaia_oauth_client.h" |
24 | 23 |
25 class GaiaAuthFetcher; | 24 class GaiaAuthFetcher; |
26 | 25 |
27 namespace base { | 26 namespace base { |
28 class DictionaryValue; | 27 class DictionaryValue; |
29 class FilePath; | 28 class FilePath; |
30 class ListValue; | 29 class ListValue; |
31 } | 30 } |
32 | 31 |
33 class UserManagerScreenHandler | 32 class UserManagerScreenHandler |
34 : public content::WebUIMessageHandler, | 33 : public content::WebUIMessageHandler, |
35 public proximity_auth::ScreenlockBridge::LockHandler, | 34 public proximity_auth::ScreenlockBridge::LockHandler, |
36 public GaiaAuthConsumer, | |
37 public gaia::GaiaOAuthClient::Delegate, | 35 public gaia::GaiaOAuthClient::Delegate, |
38 public content::NotificationObserver { | 36 public content::NotificationObserver { |
39 public: | 37 public: |
40 UserManagerScreenHandler(); | 38 UserManagerScreenHandler(); |
41 ~UserManagerScreenHandler() override; | 39 ~UserManagerScreenHandler() override; |
42 | 40 |
43 // WebUIMessageHandler implementation. | 41 // WebUIMessageHandler implementation. |
44 void RegisterMessages() override; | 42 void RegisterMessages() override; |
45 | 43 |
46 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 44 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void HandleLaunchUser(const base::ListValue* args); | 79 void HandleLaunchUser(const base::ListValue* args); |
82 void HandleRemoveUser(const base::ListValue* args); | 80 void HandleRemoveUser(const base::ListValue* args); |
83 void HandleAttemptUnlock(const base::ListValue* args); | 81 void HandleAttemptUnlock(const base::ListValue* args); |
84 void HandleHardlockUserPod(const base::ListValue* args); | 82 void HandleHardlockUserPod(const base::ListValue* args); |
85 | 83 |
86 // Handle GAIA auth results. | 84 // Handle GAIA auth results. |
87 void OnGetTokenInfoResponse( | 85 void OnGetTokenInfoResponse( |
88 scoped_ptr<base::DictionaryValue> token_info) override; | 86 scoped_ptr<base::DictionaryValue> token_info) override; |
89 void OnOAuthError() override; | 87 void OnOAuthError() override; |
90 void OnNetworkError(int response_code) override; | 88 void OnNetworkError(int response_code) override; |
91 // ClientLogin is deprecated | |
92 void OnClientLoginSuccess(const ClientLoginResult& result) override; | |
93 void OnClientLoginFailure(const GoogleServiceAuthError& error) override; | |
94 | 89 |
95 // Handle when Notified of a NOTIFICATION_BROWSER_WINDOW_READY event. | 90 // Handle when Notified of a NOTIFICATION_BROWSER_WINDOW_READY event. |
96 void OnBrowserWindowReady(Browser* browser); | 91 void OnBrowserWindowReady(Browser* browser); |
97 | 92 |
98 // Sends user list to account chooser. | 93 // Sends user list to account chooser. |
99 void SendUserList(); | 94 void SendUserList(); |
100 | 95 |
101 // Pass success/failure information back to the web page. | 96 // Pass success/failure information back to the web page. |
102 void ReportAuthenticationResult(bool success, | 97 void ReportAuthenticationResult(bool success, |
103 ProfileMetrics::ProfileAuth metric); | 98 ProfileMetrics::ProfileAuth metric); |
104 | 99 |
105 // Perform cleanup once the profile and browser are open. | 100 // Perform cleanup once the profile and browser are open. |
106 void OnSwitchToProfileComplete(Profile* profile, | 101 void OnSwitchToProfileComplete(Profile* profile, |
107 Profile::CreateStatus profile_create_status); | 102 Profile::CreateStatus profile_create_status); |
108 | 103 |
109 // Observes the ProfileInfoCache and gets notified when a profile has been | 104 // Observes the ProfileInfoCache and gets notified when a profile has been |
110 // modified, so that the displayed user pods can be updated. | 105 // modified, so that the displayed user pods can be updated. |
111 scoped_ptr<ProfileUpdateObserver> profileInfoCacheObserver_; | 106 scoped_ptr<ProfileUpdateObserver> profileInfoCacheObserver_; |
112 | 107 |
113 // The host desktop type this user manager belongs to. | 108 // The host desktop type this user manager belongs to. |
114 chrome::HostDesktopType desktop_type_; | 109 chrome::HostDesktopType desktop_type_; |
115 | 110 |
116 // Authenticator used when local-auth fails. | 111 // Authenticator used when local-auth fails. |
117 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; | 112 scoped_ptr<gaia::GaiaOAuthClient> oauth_client_; |
118 scoped_ptr<GaiaAuthFetcher> client_login_; | |
119 | 113 |
120 // The index of the profile currently being authenticated. | 114 // The path of the profile currently being authenticated. |
121 size_t authenticating_profile_index_; | 115 base::FilePath authenticating_profile_path_; |
122 | 116 |
123 // Login email and password, held during on-line auth for later use. | 117 // Login email and password, held during on-line auth for later use. |
124 base::string16 email_address_; | 118 std::string email_address_; |
125 std::string password_attempt_; | 119 std::string password_attempt_; |
126 | 120 |
127 // URL hash, used to key post-profile actions if present. | 121 // URL hash, used to key post-profile actions if present. |
128 std::string url_hash_; | 122 std::string url_hash_; |
129 | 123 |
130 typedef std::map<std::string, | 124 typedef std::map<std::string, |
131 proximity_auth::ScreenlockBridge::LockHandler::AuthType> | 125 proximity_auth::ScreenlockBridge::LockHandler::AuthType> |
132 UserAuthTypeMap; | 126 UserAuthTypeMap; |
133 UserAuthTypeMap user_auth_type_map_; | 127 UserAuthTypeMap user_auth_type_map_; |
134 | 128 |
135 content::NotificationRegistrar registrar_; | 129 content::NotificationRegistrar registrar_; |
136 | 130 |
137 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; | 131 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; |
138 | 132 |
139 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); | 133 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); |
140 }; | 134 }; |
141 | 135 |
142 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 136 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
OLD | NEW |