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