-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathuser_manager_screen_handler.h
132 lines (104 loc) · 4.99 KB
/
user_manager_screen_handler.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_
#define CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_
#include <map>
#include <string>
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/signin/screenlock_bridge.h"
#include "chrome/browser/ui/host_desktop.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_ui_message_handler.h"
#include "google_apis/gaia/gaia_auth_consumer.h"
class GaiaAuthFetcher;
namespace base {
class DictionaryValue;
class FilePath;
class ListValue;
}
class UserManagerScreenHandler : public content::WebUIMessageHandler,
public ScreenlockBridge::LockHandler,
public GaiaAuthConsumer,
public content::NotificationObserver {
public:
UserManagerScreenHandler();
~UserManagerScreenHandler() override;
// WebUIMessageHandler implementation.
void RegisterMessages() override;
void GetLocalizedValues(base::DictionaryValue* localized_strings);
// content::NotificationObserver implementation:
void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
// ScreenlockBridge::LockHandler implementation.
void ShowBannerMessage(const base::string16& message) override;
void ShowUserPodCustomIcon(
const std::string& user_email,
const ScreenlockBridge::UserPodCustomIconOptions& icon_options) override;
void HideUserPodCustomIcon(const std::string& user_email) override;
void EnableInput() override;
void SetAuthType(const std::string& user_email,
ScreenlockBridge::LockHandler::AuthType auth_type,
const base::string16& auth_value) override;
AuthType GetAuthType(const std::string& user_email) const override;
ScreenType GetScreenType() const override;
void Unlock(const std::string& user_email) override;
void AttemptEasySignin(const std::string& user_email,
const std::string& secret,
const std::string& key_label) override;
private:
// An observer for any changes to Profiles in the ProfileInfoCache so that
// all the visible user manager screens can be updated.
class ProfileUpdateObserver;
void HandleInitialize(const base::ListValue* args);
void HandleAddUser(const base::ListValue* args);
//start NCSU
void HandleAddUserIncognito(const base::ListValue* args);
//end NCSU
void HandleAuthenticatedLaunchUser(const base::ListValue* args);
void HandleLaunchGuest(const base::ListValue* args);
void HandleLaunchUser(const base::ListValue* args);
void HandleRemoveUser(const base::ListValue* args);
void HandleAttemptUnlock(const base::ListValue* args);
void HandleHardlockUserPod(const base::ListValue* args);
// Handle GAIA auth results.
void OnClientLoginSuccess(const ClientLoginResult& result) override;
void OnClientLoginFailure(const GoogleServiceAuthError& error) override;
// Handle when Notified of a NOTIFICATION_BROWSER_WINDOW_READY event.
void OnBrowserWindowReady(Browser* browser);
// Sends user list to account chooser.
void SendUserList();
// Pass success/failure information back to the web page.
void ReportAuthenticationResult(bool success,
ProfileMetrics::ProfileAuth metric);
// Perform cleanup once the profile and browser are open.
void OnSwitchToProfileComplete(Profile* profile,
Profile::CreateStatus profile_create_status);
// Observes the ProfileInfoCache and gets notified when a profile has been
// modified, so that the displayed user pods can be updated.
scoped_ptr<ProfileUpdateObserver> profileInfoCacheObserver_;
// The host desktop type this user manager belongs to.
chrome::HostDesktopType desktop_type_;
// Authenticator used when local-auth fails.
scoped_ptr<GaiaAuthFetcher> client_login_;
// The index of the profile currently being authenticated.
size_t authenticating_profile_index_;
// Login password, held during on-line auth for saving later if correct.
std::string password_attempt_;
// URL hash, used to key post-profile actions if present.
std::string url_hash_;
typedef std::map<std::string, ScreenlockBridge::LockHandler::AuthType>
UserAuthTypeMap;
UserAuthTypeMap user_auth_type_map_;
content::NotificationRegistrar registrar_;
base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler);
};
#endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_