From 52426e4c3b775666fa9fd52e1c52f8dbbbaadd49 Mon Sep 17 00:00:00 2001 From: "jhawkins@chromium.org" Date: Tue, 23 Nov 2010 00:26:56 +0000 Subject: DOMUI: Properly disabled the 'Reset theme' button when the current theme is the classic theme. BUG=59080 TEST=none Review URL: http://codereview.chromium.org/5282001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67028 0039d316-1c4b-4281-b951-d872f2087c98 --- .../dom_ui/options/personal_options_handler.cc | 8 +++--- .../resources/options/personal_options.html | 6 ++-- .../browser/resources/options/personal_options.js | 33 ++++++++-------------- 3 files changed, 19 insertions(+), 28 deletions(-) diff --git a/chrome/browser/dom_ui/options/personal_options_handler.cc b/chrome/browser/dom_ui/options/personal_options_handler.cc index 3a39b10..84b3fd3 100644 --- a/chrome/browser/dom_ui/options/personal_options_handler.cc +++ b/chrome/browser/dom_ui/options/personal_options_handler.cc @@ -101,7 +101,7 @@ void PersonalOptionsHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_APPEARANCE_GROUP_NAME)); localized_strings->SetString("themes_GTK_button", l10n_util::GetStringUTF16(IDS_THEMES_GTK_BUTTON)); - localized_strings->SetString("themes_set_classic", + localized_strings->SetString("themesSetClassic", l10n_util::GetStringUTF16(IDS_THEMES_SET_CLASSIC)); localized_strings->SetString("showWindow_decorations_radio", l10n_util::GetStringUTF16(IDS_SHOW_WINDOW_DECORATIONS_RADIO)); @@ -110,7 +110,7 @@ void PersonalOptionsHandler::GetLocalizedValues( #else localized_strings->SetString("themes", l10n_util::GetStringUTF16(IDS_THEMES_GROUP_NAME)); - localized_strings->SetString("themes_reset", + localized_strings->SetString("themesReset", l10n_util::GetStringUTF16(IDS_THEMES_RESET_BUTTON)); localized_strings->SetString("themes_default", l10n_util::GetStringUTF16(IDS_THEMES_DEFAULT_THEME_LABEL)); @@ -245,9 +245,9 @@ void PersonalOptionsHandler::ObserveThemeChanged() { #endif bool is_classic_theme = !is_gtk_theme && provider->GetThemeID().empty(); - FundamentalValue classic_enabled(!is_classic_theme); + FundamentalValue enabled(!is_classic_theme); dom_ui_->CallJavascriptFunction( - L"options.PersonalOptions.setClassicThemeButtonEnabled", classic_enabled); + L"options.PersonalOptions.setThemesResetButtonEnabled", enabled); } void PersonalOptionsHandler::Initialize() { diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html index 440bbda..48bd944 100644 --- a/chrome/browser/resources/options/personal_options.html +++ b/chrome/browser/resources/options/personal_options.html @@ -72,8 +72,8 @@
- +
@@ -96,7 +96,7 @@

- +
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js index 58a5481..266cce9 100644 --- a/chrome/browser/resources/options/personal_options.js +++ b/chrome/browser/resources/options/personal_options.js @@ -58,30 +58,23 @@ cr.define('options', function() { chrome.send('coreOptionsUserMetricsAction', ['Options_ShowAutoFillSettings']); }; + $('themes-reset').onclick = function(event) { + chrome.send('themesReset'); + }; if (!cr.isChromeOS) { $('import_data').onclick = function(event) { OptionsPage.showOverlay('importDataOverlay'); chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); }; - } - if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { - $('themes_GTK_button').onclick = function(event) { - chrome.send('themesSetGTK'); - }; - $('themes_set_classic').onclick = function(event) { - chrome.send('themesReset'); - }; + if (navigator.platform.match(/linux|BSD/i)) { + $('themes_GTK_button').onclick = function(event) { + chrome.send('themesSetGTK'); + }; + } } - - if (cr.isMac || cr.isWindows || cr.isChromeOS) { - $('themes_reset').onclick = function(event) { - chrome.send('themesReset'); - }; - } - - if (cr.isChromeOS) { + else { chrome.send('loadAccountPicture'); } }, @@ -173,10 +166,8 @@ cr.define('options', function() { } }, - setClassicThemeButtonEnabled_: function(enabled) { - if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { - $('themes_set_classic').disabled = !enabled; - } + setThemesResetButtonEnabled_: function(enabled) { + $('themes-reset').disabled = !enabled; }, hideSyncSection_: function() { @@ -201,7 +192,7 @@ cr.define('options', function() { 'setCustomizeButtonEnabled', 'setCustomizeButtonLabel', 'setGtkThemeButtonEnabled', - 'setClassicThemeButtonEnabled', + 'setThemesResetButtonEnabled', 'hideSyncSection', ].forEach(function(name) { PersonalOptions[name] = function(value) { -- cgit v1.1