| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_OPTIONS_MANAGE_PROFILE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "base/prefs/pref_change_registrar.h" | 11 #include "base/prefs/pref_change_registrar.h" |
| 12 #include "chrome/browser/profiles/profile_info_cache_observer.h" |
| 12 #include "chrome/browser/sync/profile_sync_service_observer.h" | 13 #include "chrome/browser/sync/profile_sync_service_observer.h" |
| 13 #include "chrome/browser/ui/webui/options/options_ui.h" | 14 #include "chrome/browser/ui/webui/options/options_ui.h" |
| 14 #include "content/public/browser/notification_observer.h" | |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 class StringValue; | 17 class StringValue; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace options { | 20 namespace options { |
| 21 | 21 |
| 22 // Chrome personal stuff profiles manage overlay UI handler. | 22 // Chrome personal stuff profiles manage overlay UI handler. |
| 23 class ManageProfileHandler : public OptionsPageUIHandler, | 23 class ManageProfileHandler : public OptionsPageUIHandler, |
| 24 public content::NotificationObserver, | 24 public ProfileInfoCacheObserver, |
| 25 public ProfileSyncServiceObserver { | 25 public ProfileSyncServiceObserver { |
| 26 public: | 26 public: |
| 27 ManageProfileHandler(); | 27 ManageProfileHandler(); |
| 28 ~ManageProfileHandler() override; | 28 ~ManageProfileHandler() override; |
| 29 | 29 |
| 30 // OptionsPageUIHandler: | 30 // OptionsPageUIHandler: |
| 31 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; | 31 void GetLocalizedValues(base::DictionaryValue* localized_strings) override; |
| 32 void InitializeHandler() override; | 32 void InitializeHandler() override; |
| 33 void InitializePage() override; | 33 void InitializePage() override; |
| 34 void Uninitialize() override; | 34 void Uninitialize() override; |
| 35 | 35 |
| 36 // WebUIMessageHandler: | 36 // WebUIMessageHandler: |
| 37 void RegisterMessages() override; | 37 void RegisterMessages() override; |
| 38 | 38 |
| 39 // content::NotificationObserver: | 39 // ProfileInfoCacheObserver: |
| 40 void Observe(int type, | 40 void OnProfileAdded(const base::FilePath& profile_path) override; |
| 41 const content::NotificationSource& source, | 41 void OnProfileWasRemoved(const base::FilePath& profile_path, |
| 42 const content::NotificationDetails& details) override; | 42 const base::string16& profile_name) override; |
| 43 void OnProfileNameChanged(const base::FilePath& profile_path, |
| 44 const base::string16& old_profile_name) override; |
| 45 void OnProfileAvatarChanged(const base::FilePath& profile_path) override; |
| 43 | 46 |
| 44 // ProfileSyncServiceObserver: | 47 // ProfileSyncServiceObserver: |
| 45 void OnStateChanged() override; | 48 void OnStateChanged() override; |
| 46 | 49 |
| 47 private: | 50 private: |
| 48 // This function creates signed in user specific strings in loadTimeData. | 51 // This function creates signed in user specific strings in loadTimeData. |
| 49 void GenerateSignedinUserSpecificStrings(base::DictionaryValue* dictionary); | 52 void GenerateSignedinUserSpecificStrings(base::DictionaryValue* dictionary); |
| 50 | 53 |
| 51 // Callback for the "requestDefaultProfileIcons" message. | 54 // Callback for the "requestDefaultProfileIcons" message. |
| 52 // Sends the array of default profile icon URLs and profile names to WebUI. | 55 // Sends the array of default profile icon URLs and profile names to WebUI. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 141 |
| 139 // For generating weak pointers to itself for callbacks. | 142 // For generating weak pointers to itself for callbacks. |
| 140 base::WeakPtrFactory<ManageProfileHandler> weak_factory_; | 143 base::WeakPtrFactory<ManageProfileHandler> weak_factory_; |
| 141 | 144 |
| 142 DISALLOW_COPY_AND_ASSIGN(ManageProfileHandler); | 145 DISALLOW_COPY_AND_ASSIGN(ManageProfileHandler); |
| 143 }; | 146 }; |
| 144 | 147 |
| 145 } // namespace options | 148 } // namespace options |
| 146 | 149 |
| 147 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ | 150 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_MANAGE_PROFILE_HANDLER_H_ |
| OLD | NEW |