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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/ui/host_desktop.h" | 10 #include "chrome/browser/ui/host_desktop.h" |
11 #include "content/public/browser/web_ui_message_handler.h" | 11 #include "content/public/browser/web_ui_message_handler.h" |
| 12 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 13 |
| 14 class GaiaAuthFetcher; |
12 | 15 |
13 namespace base { | 16 namespace base { |
14 class DictionaryValue; | 17 class DictionaryValue; |
15 class FilePath; | 18 class FilePath; |
16 class ListValue; | 19 class ListValue; |
17 } | 20 } |
18 | 21 |
19 class UserManagerScreenHandler : public content::WebUIMessageHandler { | 22 class UserManagerScreenHandler : public content::WebUIMessageHandler, |
| 23 public GaiaAuthConsumer { |
20 public: | 24 public: |
21 UserManagerScreenHandler(); | 25 UserManagerScreenHandler(); |
22 virtual ~UserManagerScreenHandler(); | 26 virtual ~UserManagerScreenHandler(); |
23 | 27 |
24 // WebUIMessageHandler implementation. | 28 // WebUIMessageHandler implementation. |
25 virtual void RegisterMessages() OVERRIDE; | 29 virtual void RegisterMessages() OVERRIDE; |
26 | 30 |
27 void GetLocalizedValues(base::DictionaryValue* localized_strings); | 31 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
28 | 32 |
29 private: | 33 private: |
30 // An observer for any changes to Profiles in the ProfileInfoCache so that | 34 // An observer for any changes to Profiles in the ProfileInfoCache so that |
31 // all the visible user manager screens can be updated. | 35 // all the visible user manager screens can be updated. |
32 class ProfileUpdateObserver; | 36 class ProfileUpdateObserver; |
33 | 37 |
34 void HandleInitialize(const base::ListValue* args); | 38 void HandleInitialize(const base::ListValue* args); |
35 void HandleAddUser(const base::ListValue* args); | 39 void HandleAddUser(const base::ListValue* args); |
36 void HandleAuthenticatedLaunchUser(const base::ListValue* args); | 40 void HandleAuthenticatedLaunchUser(const base::ListValue* args); |
37 void HandleLaunchGuest(const base::ListValue* args); | 41 void HandleLaunchGuest(const base::ListValue* args); |
38 void HandleLaunchUser(const base::ListValue* args); | 42 void HandleLaunchUser(const base::ListValue* args); |
39 void HandleRemoveUser(const base::ListValue* args); | 43 void HandleRemoveUser(const base::ListValue* args); |
40 | 44 |
| 45 // Handle GAIA auth results. |
| 46 virtual void OnClientLoginSuccess(const ClientLoginResult& result) OVERRIDE; |
| 47 virtual void OnClientLoginFailure(const GoogleServiceAuthError& error) |
| 48 OVERRIDE; |
| 49 |
41 // Sends user list to account chooser. | 50 // Sends user list to account chooser. |
42 void SendUserList(); | 51 void SendUserList(); |
43 | 52 |
| 53 // Pass success/failure information back to the web page. |
| 54 void ReportAuthenticationResult(bool success); |
| 55 |
44 // Observes the ProfileInfoCache and gets notified when a profile has been | 56 // Observes the ProfileInfoCache and gets notified when a profile has been |
45 // modified, so that the displayed user pods can be updated. | 57 // modified, so that the displayed user pods can be updated. |
46 scoped_ptr<ProfileUpdateObserver> profileInfoCacheObserver_; | 58 scoped_ptr<ProfileUpdateObserver> profileInfoCacheObserver_; |
47 | 59 |
48 // The host desktop type this user manager belongs to. | 60 // The host desktop type this user manager belongs to. |
49 chrome::HostDesktopType desktop_type_; | 61 chrome::HostDesktopType desktop_type_; |
50 | 62 |
| 63 // Authenticator used when local-auth fails. |
| 64 scoped_ptr<GaiaAuthFetcher> client_login_; |
| 65 |
| 66 // The index of the profile currently being authenticated. |
| 67 size_t authenticating_profile_index_; |
| 68 |
| 69 // Login password, held during on-line auth for saving later if correct. |
| 70 std::string password_attempt_; |
| 71 |
51 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); | 72 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); |
52 }; | 73 }; |
53 | 74 |
54 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 75 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
OLD | NEW |