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 "base/task/cancelable_task_tracker.h" | 15 #include "base/task/cancelable_task_tracker.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/profiles/profile_metrics.h" | 17 #include "chrome/browser/profiles/profile_metrics.h" |
18 #include "chrome/browser/profiles/profile_statistics.h" | 18 #include "chrome/browser/profiles/profile_statistics.h" |
19 #include "chrome/browser/ui/host_desktop.h" | 19 #include "chrome/browser/ui/host_desktop.h" |
20 #include "components/proximity_auth/screenlock_bridge.h" | 20 #include "components/proximity_auth/screenlock_bridge.h" |
21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
23 #include "content/public/browser/web_ui_message_handler.h" | 23 #include "content/public/browser/web_ui_message_handler.h" |
24 #include "google_apis/gaia/gaia_oauth_client.h" | 24 #include "google_apis/gaia/gaia_oauth_client.h" |
25 | 25 |
| 26 class AccountId; |
26 class GaiaAuthFetcher; | 27 class GaiaAuthFetcher; |
27 | 28 |
28 namespace base { | 29 namespace base { |
29 class DictionaryValue; | 30 class DictionaryValue; |
30 class FilePath; | 31 class FilePath; |
31 class ListValue; | 32 class ListValue; |
32 } | 33 } |
33 | 34 |
34 class UserManagerScreenHandler | 35 class UserManagerScreenHandler |
35 : public content::WebUIMessageHandler, | 36 : public content::WebUIMessageHandler, |
36 public proximity_auth::ScreenlockBridge::LockHandler, | 37 public proximity_auth::ScreenlockBridge::LockHandler, |
37 public gaia::GaiaOAuthClient::Delegate, | 38 public gaia::GaiaOAuthClient::Delegate, |
38 public content::NotificationObserver { | 39 public content::NotificationObserver { |
39 public: | 40 public: |
40 UserManagerScreenHandler(); | 41 UserManagerScreenHandler(); |
41 ~UserManagerScreenHandler() override; | 42 ~UserManagerScreenHandler() override; |
42 | 43 |
| 44 void GetLocalizedValues(base::DictionaryValue* localized_strings); |
| 45 |
| 46 private: |
| 47 // An observer for any changes to Profiles in the ProfileInfoCache so that |
| 48 // all the visible user manager screens can be updated. |
| 49 class ProfileUpdateObserver; |
| 50 |
43 // WebUIMessageHandler implementation. | 51 // WebUIMessageHandler implementation. |
44 void RegisterMessages() override; | 52 void RegisterMessages() override; |
45 | 53 |
46 void GetLocalizedValues(base::DictionaryValue* localized_strings); | |
47 | |
48 // content::NotificationObserver implementation: | 54 // content::NotificationObserver implementation: |
49 void Observe(int type, | 55 void Observe(int type, |
50 const content::NotificationSource& source, | 56 const content::NotificationSource& source, |
51 const content::NotificationDetails& details) override; | 57 const content::NotificationDetails& details) override; |
52 | 58 |
53 // proximity_auth::ScreenlockBridge::LockHandler implementation. | 59 // proximity_auth::ScreenlockBridge::LockHandler implementation. |
54 void ShowBannerMessage(const base::string16& message) override; | 60 void ShowBannerMessage(const base::string16& message) override; |
55 void ShowUserPodCustomIcon( | 61 void ShowUserPodCustomIcon( |
56 const std::string& user_email, | 62 const AccountId& account_id, |
57 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& | 63 const proximity_auth::ScreenlockBridge::UserPodCustomIconOptions& |
58 icon_options) override; | 64 icon_options) override; |
59 void HideUserPodCustomIcon(const std::string& user_email) override; | 65 void HideUserPodCustomIcon(const AccountId& account_id) override; |
60 void EnableInput() override; | 66 void EnableInput() override; |
61 void SetAuthType( | 67 void SetAuthType( |
62 const std::string& user_email, | 68 const AccountId& account_id, |
63 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, | 69 proximity_auth::ScreenlockBridge::LockHandler::AuthType auth_type, |
64 const base::string16& auth_value) override; | 70 const base::string16& auth_value) override; |
65 AuthType GetAuthType(const std::string& user_email) const override; | 71 AuthType GetAuthType(const AccountId& account_id) const override; |
66 ScreenType GetScreenType() const override; | 72 ScreenType GetScreenType() const override; |
67 void Unlock(const std::string& user_email) override; | 73 void Unlock(const AccountId& account_id) override; |
68 void AttemptEasySignin(const std::string& user_email, | 74 void AttemptEasySignin(const AccountId& account_id, |
69 const std::string& secret, | 75 const std::string& secret, |
70 const std::string& key_label) override; | 76 const std::string& key_label) override; |
71 | 77 |
72 private: | |
73 // An observer for any changes to Profiles in the ProfileInfoCache so that | |
74 // all the visible user manager screens can be updated. | |
75 class ProfileUpdateObserver; | |
76 | |
77 void HandleInitialize(const base::ListValue* args); | 78 void HandleInitialize(const base::ListValue* args); |
78 void HandleAddUser(const base::ListValue* args); | 79 void HandleAddUser(const base::ListValue* args); |
79 void HandleAuthenticatedLaunchUser(const base::ListValue* args); | 80 void HandleAuthenticatedLaunchUser(const base::ListValue* args); |
80 void HandleLaunchGuest(const base::ListValue* args); | 81 void HandleLaunchGuest(const base::ListValue* args); |
81 void HandleLaunchUser(const base::ListValue* args); | 82 void HandleLaunchUser(const base::ListValue* args); |
82 void HandleRemoveUser(const base::ListValue* args); | 83 void HandleRemoveUser(const base::ListValue* args); |
83 void HandleAttemptUnlock(const base::ListValue* args); | 84 void HandleAttemptUnlock(const base::ListValue* args); |
84 void HandleHardlockUserPod(const base::ListValue* args); | 85 void HandleHardlockUserPod(const base::ListValue* args); |
85 void HandleRemoveUserWarningLoadStats(const base::ListValue* args); | 86 void HandleRemoveUserWarningLoadStats(const base::ListValue* args); |
86 void HandleGetRemoveWarningDialogMessage(const base::ListValue* args); | 87 void HandleGetRemoveWarningDialogMessage(const base::ListValue* args); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 | 139 |
139 // The CancelableTaskTracker is currently used by GetProfileStatistics | 140 // The CancelableTaskTracker is currently used by GetProfileStatistics |
140 base::CancelableTaskTracker tracker_; | 141 base::CancelableTaskTracker tracker_; |
141 | 142 |
142 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; | 143 base::WeakPtrFactory<UserManagerScreenHandler> weak_ptr_factory_; |
143 | 144 |
144 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); | 145 DISALLOW_COPY_AND_ASSIGN(UserManagerScreenHandler); |
145 }; | 146 }; |
146 | 147 |
147 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ | 148 #endif // CHROME_BROWSER_UI_WEBUI_SIGNIN_USER_MANAGER_SCREEN_HANDLER_H_ |
OLD | NEW |