| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_APPEARANCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_SETTINGS_APPEARANCE_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_APPEARANCE_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_SETTINGS_APPEARANCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" | 9 #include "chrome/browser/ui/webui/settings/settings_page_ui_handler.h" |
| 10 #include "content/public/browser/notification_observer.h" | |
| 11 #include "content/public/browser/notification_registrar.h" | |
| 12 | 10 |
| 13 namespace base { | 11 namespace base { |
| 14 class ListValue; | 12 class ListValue; |
| 15 } | 13 } |
| 16 | 14 |
| 17 namespace content { | 15 namespace content { |
| 18 class WebUI; | 16 class WebUI; |
| 19 } | 17 } |
| 20 | 18 |
| 21 class Profile; | 19 class Profile; |
| 22 | 20 |
| 23 namespace settings { | 21 namespace settings { |
| 24 | 22 |
| 25 // Chrome "Appearance" settings page UI handler. | 23 // Chrome "Appearance" settings page UI handler. |
| 26 class AppearanceHandler : public SettingsPageUIHandler, | 24 class AppearanceHandler : public SettingsPageUIHandler { |
| 27 public content::NotificationObserver { | |
| 28 public: | 25 public: |
| 29 explicit AppearanceHandler(content::WebUI* webui); | 26 explicit AppearanceHandler(content::WebUI* webui); |
| 30 ~AppearanceHandler() override; | 27 ~AppearanceHandler() override; |
| 31 | 28 |
| 32 // SettingsPageUIHandler implementation. | 29 // SettingsPageUIHandler implementation. |
| 33 void RegisterMessages() override; | 30 void RegisterMessages() override; |
| 34 void OnJavascriptAllowed() override; | 31 void OnJavascriptAllowed() override; |
| 35 void OnJavascriptDisallowed() override; | 32 void OnJavascriptDisallowed() override; |
| 36 | 33 |
| 37 private: | 34 private: |
| 38 // content::NotificationObserver implementation. | 35 // Changes the UI theme of the browser to the default theme. |
| 39 void Observe(int type, | 36 void HandleUseDefaultTheme(const base::ListValue* args); |
| 40 const content::NotificationSource& source, | |
| 41 const content::NotificationDetails& details) override; | |
| 42 | 37 |
| 43 // Whether the theme can be reset. | 38 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| 44 bool ResetThemeEnabled() const; | 39 // Changes the UI theme of the browser to the system (GTK+) theme. |
| 45 | 40 void HandleUseSystemTheme(const base::ListValue* args); |
| 46 // Resets the UI theme of the browser to the default theme. | 41 #endif |
| 47 void HandleResetTheme(const base::ListValue* args); | |
| 48 | |
| 49 // Sends the enabled state of the reset-theme control to the JS. | |
| 50 void HandleGetResetThemeEnabled(const base::ListValue* args); | |
| 51 | 42 |
| 52 #if defined(OS_CHROMEOS) | 43 #if defined(OS_CHROMEOS) |
| 53 // Open the wallpaper manager app. | 44 // Open the wallpaper manager app. |
| 54 void HandleOpenWallpaperManager(const base::ListValue* args); | 45 void HandleOpenWallpaperManager(const base::ListValue* args); |
| 55 #endif | 46 #endif |
| 56 | 47 |
| 57 Profile* profile_; // Weak pointer. | 48 Profile* profile_; // Weak pointer. |
| 58 | 49 |
| 59 // Used to register for relevant notifications. | |
| 60 content::NotificationRegistrar registrar_; | |
| 61 | |
| 62 DISALLOW_COPY_AND_ASSIGN(AppearanceHandler); | 50 DISALLOW_COPY_AND_ASSIGN(AppearanceHandler); |
| 63 }; | 51 }; |
| 64 | 52 |
| 65 } // namespace settings | 53 } // namespace settings |
| 66 | 54 |
| 67 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_APPEARANCE_HANDLER_H_ | 55 #endif // CHROME_BROWSER_UI_WEBUI_SETTINGS_APPEARANCE_HANDLER_H_ |
| OLD | NEW |