Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Unified Diff: chrome/browser/ui/webui/options/browser_options_handler.cc

Issue 17494005: linux_aura: Three fixes for switching themes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/options/browser_options_handler.cc
diff --git a/chrome/browser/ui/webui/options/browser_options_handler.cc b/chrome/browser/ui/webui/options/browser_options_handler.cc
index d7fa0726261eb87f1e04744b4a2cd63d6b18cfc0..1dd4ce398966e266ed89c3b8fb2eeee08e50b508 100644
--- a/chrome/browser/ui/webui/options/browser_options_handler.cc
+++ b/chrome/browser/ui/webui/options/browser_options_handler.cc
@@ -114,10 +114,6 @@
#include "chrome/installer/util/auto_launch_util.h"
#endif // defined(OS_WIN)
-#if defined(TOOLKIT_GTK)
-#include "chrome/browser/ui/gtk/gtk_theme_service.h"
-#endif // defined(TOOLKIT_GTK)
-
using content::BrowserContext;
using content::BrowserThread;
using content::DownloadManager;
@@ -336,9 +332,9 @@ void BrowserOptionsHandler::GetLocalizedValues(DictionaryValue* values) {
{ "toolbarShowHomeButton", IDS_OPTIONS_TOOLBAR_SHOW_HOME_BUTTON },
{ "translateEnableTranslate",
IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE },
-#if defined(TOOLKIT_GTK)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
{ "showWindowDecorations", IDS_SHOW_WINDOW_DECORATIONS },
- { "themesGTKButton", IDS_THEMES_GTK_BUTTON },
+ { "themesNativeButton", IDS_THEMES_GTK_BUTTON },
{ "themesSetClassic", IDS_THEMES_SET_CLASSIC },
#else
{ "themes", IDS_THEMES_GROUP_NAME },
@@ -578,10 +574,10 @@ void BrowserOptionsHandler::RegisterMessages() {
"themesReset",
base::Bind(&BrowserOptionsHandler::ThemesReset,
base::Unretained(this)));
-#if defined(TOOLKIT_GTK)
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
web_ui()->RegisterMessageCallback(
- "themesSetGTK",
- base::Bind(&BrowserOptionsHandler::ThemesSetGTK,
+ "themesSetNative",
+ base::Bind(&BrowserOptionsHandler::ThemesSetNative,
base::Unretained(this)));
#endif
web_ui()->RegisterMessageCallback(
@@ -1319,18 +1315,19 @@ void BrowserOptionsHandler::CancelProfileRegistration(bool user_initiated) {
void BrowserOptionsHandler::ObserveThemeChanged() {
Profile* profile = Profile::FromWebUI(web_ui());
bool profile_is_managed = ManagedUserService::ProfileIsManaged(profile);
-#if defined(TOOLKIT_GTK)
- GtkThemeService* theme_service = GtkThemeService::GetFrom(profile);
- bool is_gtk_theme = theme_service->UsingNativeTheme();
- base::FundamentalValue gtk_enabled(!is_gtk_theme && !profile_is_managed);
- web_ui()->CallJavascriptFunction("BrowserOptions.setGtkThemeButtonEnabled",
- gtk_enabled);
-#else
ThemeService* theme_service = ThemeServiceFactory::GetForProfile(profile);
- bool is_gtk_theme = false;
+ bool is_native_theme = false;
+
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ is_native_theme = theme_service->UsingNativeTheme();
+ base::FundamentalValue native_theme_enabled(!is_native_theme &&
+ !profile_is_managed);
+ web_ui()->CallJavascriptFunction("BrowserOptions.setNativeThemeButtonEnabled",
+ native_theme_enabled);
#endif
- bool is_classic_theme = !is_gtk_theme && theme_service->UsingDefaultTheme();
+ bool is_classic_theme = !is_native_theme &&
+ theme_service->UsingDefaultTheme();
base::FundamentalValue enabled(!is_classic_theme && !profile_is_managed);
web_ui()->CallJavascriptFunction("BrowserOptions.setThemesResetButtonEnabled",
enabled);
@@ -1344,8 +1341,8 @@ void BrowserOptionsHandler::ThemesReset(const ListValue* args) {
ThemeServiceFactory::GetForProfile(profile)->UseDefaultTheme();
}
-#if defined(TOOLKIT_GTK)
-void BrowserOptionsHandler::ThemesSetGTK(const ListValue* args) {
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+void BrowserOptionsHandler::ThemesSetNative(const ListValue* args) {
content::RecordAction(UserMetricsAction("Options_GtkThemeSet"));
Profile* profile = Profile::FromWebUI(web_ui());
ThemeServiceFactory::GetForProfile(profile)->SetNativeTheme();

Powered by Google App Engine
This is Rietveld 408576698