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