| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SETTINGS_PEOPLE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/gtest_prod_util.h" | 8 #include "base/gtest_prod_util.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "base/scoped_observer.h" | 12 #include "base/scoped_observer.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 16 #include "chrome/browser/sync/sync_startup_tracker.h" | 17 #include "chrome/browser/sync/sync_startup_tracker.h" |
| 17 #include "chrome/browser/ui/webui/signin/login_ui_service.h" | 18 #include "chrome/browser/ui/webui/signin/login_ui_service.h" |
| 18 #include "components/signin/core/browser/signin_manager_base.h" | 19 #include "components/signin/core/browser/signin_manager_base.h" |
| 19 #include "components/sync_driver/sync_service_observer.h" | 20 #include "components/sync_driver/sync_service_observer.h" |
| 20 #include "content/public/browser/web_ui_message_handler.h" | 21 #include "content/public/browser/web_ui_message_handler.h" |
| 21 | 22 |
| 22 class LoginUIService; | 23 class LoginUIService; |
| 23 class ProfileSyncService; | 24 class ProfileSyncService; |
| 24 class SigninManagerBase; | 25 class SigninManagerBase; |
| 25 | 26 |
| 26 namespace content { | 27 namespace content { |
| 27 class WebContents; | 28 class WebContents; |
| 28 class WebUI; | 29 class WebUI; |
| 29 } | 30 } |
| 30 | 31 |
| 31 namespace signin_metrics { | 32 namespace signin_metrics { |
| 32 enum class AccessPoint; | 33 enum class AccessPoint; |
| 33 } | 34 } |
| 34 | 35 |
| 35 namespace settings { | 36 namespace settings { |
| 36 | 37 |
| 37 class PeopleHandler : public content::WebUIMessageHandler, | 38 class PeopleHandler : public content::WebUIMessageHandler, |
| 38 public SigninManagerBase::Observer, | 39 public SigninManagerBase::Observer, |
| 39 public SyncStartupTracker::Observer, | 40 public SyncStartupTracker::Observer, |
| 40 public LoginUIService::LoginUI, | 41 public LoginUIService::LoginUI, |
| 41 public sync_driver::SyncServiceObserver { | 42 public sync_driver::SyncServiceObserver, |
| 43 public ProfileInfoCacheObserver { |
| 42 public: | 44 public: |
| 43 explicit PeopleHandler(Profile* profile); | 45 explicit PeopleHandler(Profile* profile); |
| 44 ~PeopleHandler() override; | 46 ~PeopleHandler() override; |
| 45 | 47 |
| 46 // content::WebUIMessageHandler implementation. | 48 // content::WebUIMessageHandler implementation. |
| 47 void RegisterMessages() override; | 49 void RegisterMessages() override; |
| 48 | 50 |
| 49 // SyncStartupTracker::Observer implementation. | 51 // SyncStartupTracker::Observer implementation. |
| 50 void SyncStartupCompleted() override; | 52 void SyncStartupCompleted() override; |
| 51 void SyncStartupFailed() override; | 53 void SyncStartupFailed() override; |
| 52 | 54 |
| 53 // LoginUIService::LoginUI implementation. | 55 // LoginUIService::LoginUI implementation. |
| 54 void FocusUI() override; | 56 void FocusUI() override; |
| 55 void CloseUI() override; | 57 void CloseUI() override; |
| 56 | 58 |
| 57 // SigninManagerBase::Observer implementation. | 59 // SigninManagerBase::Observer implementation. |
| 58 void GoogleSigninSucceeded(const std::string& account_id, | 60 void GoogleSigninSucceeded(const std::string& account_id, |
| 59 const std::string& username, | 61 const std::string& username, |
| 60 const std::string& password) override; | 62 const std::string& password) override; |
| 61 void GoogleSignedOut(const std::string& account_id, | 63 void GoogleSignedOut(const std::string& account_id, |
| 62 const std::string& username) override; | 64 const std::string& username) override; |
| 63 | 65 |
| 64 // sync_driver::SyncServiceObserver implementation. | 66 // sync_driver::SyncServiceObserver implementation. |
| 65 void OnStateChanged() override; | 67 void OnStateChanged() override; |
| 66 | 68 |
| 69 // ProfileInfoCacheObserver implementation. |
| 70 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 71 const base::string16& old_profile_name) override; |
| 72 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 73 |
| 67 // Initializes the sync setup flow and shows the setup UI. | 74 // Initializes the sync setup flow and shows the setup UI. |
| 68 void OpenSyncSetup(const base::ListValue* args); | 75 void OpenSyncSetup(const base::ListValue* args); |
| 69 | 76 |
| 70 // Shows advanced configuration dialog without going through sign in dialog. | 77 // Shows advanced configuration dialog without going through sign in dialog. |
| 71 // Kicks the sync backend if necessary with showing spinner dialog until it | 78 // Kicks the sync backend if necessary with showing spinner dialog until it |
| 72 // gets ready. | 79 // gets ready. |
| 73 void OpenConfigureSync(); | 80 void OpenConfigureSync(); |
| 74 | 81 |
| 75 // Terminates the sync setup flow. | 82 // Terminates the sync setup flow. |
| 76 void CloseSyncSetup(); | 83 void CloseSyncSetup(); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 | 118 |
| 112 // Helper routine that gets the ProfileSyncService associated with the parent | 119 // Helper routine that gets the ProfileSyncService associated with the parent |
| 113 // profile. | 120 // profile. |
| 114 ProfileSyncService* GetSyncService() const; | 121 ProfileSyncService* GetSyncService() const; |
| 115 | 122 |
| 116 // Returns the LoginUIService for the parent profile. | 123 // Returns the LoginUIService for the parent profile. |
| 117 LoginUIService* GetLoginUIService() const; | 124 LoginUIService* GetLoginUIService() const; |
| 118 | 125 |
| 119 private: | 126 private: |
| 120 // Callbacks from the page. | 127 // Callbacks from the page. |
| 128 void HandleGetProfileInfo(const base::ListValue* args); |
| 121 void OnDidClosePage(const base::ListValue* args); | 129 void OnDidClosePage(const base::ListValue* args); |
| 122 void HandleConfigure(const base::ListValue* args); | 130 void HandleConfigure(const base::ListValue* args); |
| 123 void HandlePassphraseEntry(const base::ListValue* args); | 131 void HandlePassphraseEntry(const base::ListValue* args); |
| 124 void HandlePassphraseCancel(const base::ListValue* args); | 132 void HandlePassphraseCancel(const base::ListValue* args); |
| 125 void HandleShowSetupUI(const base::ListValue* args); | 133 void HandleShowSetupUI(const base::ListValue* args); |
| 126 void HandleDoSignOutOnAuthError(const base::ListValue* args); | 134 void HandleDoSignOutOnAuthError(const base::ListValue* args); |
| 127 void HandleStartSignin(const base::ListValue* args); | 135 void HandleStartSignin(const base::ListValue* args); |
| 128 void HandleStopSyncing(const base::ListValue* args); | 136 void HandleStopSyncing(const base::ListValue* args); |
| 129 void HandleCloseTimeout(const base::ListValue* args); | 137 void HandleCloseTimeout(const base::ListValue* args); |
| 130 void HandleGetSyncStatus(const base::ListValue* args); | 138 void HandleGetSyncStatus(const base::ListValue* args); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 200 |
| 193 // Manages observer lifetime. | 201 // Manages observer lifetime. |
| 194 ScopedObserver<ProfileSyncService, PeopleHandler> sync_service_observer_; | 202 ScopedObserver<ProfileSyncService, PeopleHandler> sync_service_observer_; |
| 195 | 203 |
| 196 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); | 204 DISALLOW_COPY_AND_ASSIGN(PeopleHandler); |
| 197 }; | 205 }; |
| 198 | 206 |
| 199 } // namespace settings | 207 } // namespace settings |
| 200 | 208 |
| 201 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ | 209 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_PEOPLE_HANDLER_H_ |
| OLD | NEW |