diff options
author | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-11 21:47:40 +0000 |
---|---|---|
committer | thestig@chromium.org <thestig@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-11 21:47:40 +0000 |
commit | 169a2c94b7962fa8ae2a3236d4f68c2492ab871d (patch) | |
tree | b370a842e4dfd423f69f223d4b519bf1ea435bfa /chrome | |
parent | 2efc3118e5132ed7d3497f98d82cfb693490d552 (diff) | |
download | chromium_src-169a2c94b7962fa8ae2a3236d4f68c2492ab871d.zip chromium_src-169a2c94b7962fa8ae2a3236d4f68c2492ab871d.tar.gz chromium_src-169a2c94b7962fa8ae2a3236d4f68c2492ab871d.tar.bz2 |
Revert 68919 - Remove the 'restart required' alert when enabling the metrics reporting option, the alert is obsolete.
BUG=none
TEST=Green tree and no 'restart required' alerts when enabling metrics in Chrome builds.
Review URL: http://codereview.chromium.org/4778002
TBR=csilv@chromium.org
Review URL: http://codereview.chromium.org/5752004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68949 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
5 files changed, 48 insertions, 6 deletions
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.cc b/chrome/browser/dom_ui/options/advanced_options_handler.cc index 9add19b..0903dd2 100644 --- a/chrome/browser/dom_ui/options/advanced_options_handler.cc +++ b/chrome/browser/dom_ui/options/advanced_options_handler.cc @@ -179,11 +179,13 @@ void AdvancedOptionsHandler::GetLocalizedValues( l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_OKLABEL)); localized_strings->SetString("optionsResetCancelLabel", l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_CANCELLABEL)); + localized_strings->SetString("optionsRestartRequired", + l10n_util::GetStringUTF16(IDS_OPTIONS_RESTART_REQUIRED)); } void AdvancedOptionsHandler::Initialize() { DCHECK(dom_ui_); - SetupMetricsReportingCheckbox(); + SetupMetricsReportingCheckbox(false); SetupMetricsReportingSettingVisibility(); SetupDefaultZoomLevel(); SetupDownloadLocationPath(); @@ -354,7 +356,9 @@ void AdvancedOptionsHandler::HandleMetricsReportingCheckbox( UserMetricsAction("Options_MetricsReportingCheckbox_Disable")); bool is_enabled = OptionsUtil::ResolveMetricsReportingEnabled(enabled); enable_metrics_recording_.SetValue(is_enabled); - SetupMetricsReportingCheckbox(); + + bool user_changed = (enabled == is_enabled); + SetupMetricsReportingCheckbox(user_changed); #endif } @@ -476,14 +480,14 @@ void AdvancedOptionsHandler::SetupCloudPrintProxySection() { } #endif -void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() { +void AdvancedOptionsHandler::SetupMetricsReportingCheckbox(bool user_changed) { #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) FundamentalValue checked(enable_metrics_recording_.GetValue()); FundamentalValue disabled(enable_metrics_recording_.IsManaged()); FundamentalValue user_has_changed(user_changed); dom_ui_->CallJavascriptFunction( L"options.AdvancedOptions.SetMetricsReportingCheckboxState", checked, - disabled); + disabled, user_has_changed); #endif } diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.h b/chrome/browser/dom_ui/options/advanced_options_handler.h index d75d358..f58f94b 100644 --- a/chrome/browser/dom_ui/options/advanced_options_handler.h +++ b/chrome/browser/dom_ui/options/advanced_options_handler.h @@ -115,7 +115,7 @@ class AdvancedOptionsHandler #endif // Setup the checked state for the metrics reporting checkbox. - void SetupMetricsReportingCheckbox(); + void SetupMetricsReportingCheckbox(bool user_changed); // Setup the visibility for the metrics reporting setting. void SetupMetricsReportingSettingVisibility(); diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc index 21fe182..704f545 100644 --- a/chrome/browser/gtk/options/advanced_contents_gtk.cc +++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc @@ -614,6 +614,10 @@ class PrivacySection : public OptionsPageBase { // permission match the |reporting_enabled_checkbox_|. void ResolveMetricsReportingEnabled(); + // Inform the user that the browser must be restarted for changes to take + // effect. + void ShowRestartMessageBox() const; + // The callback functions for the options widgets. static void OnContentSettingsClicked(GtkButton* button, PrivacySection* privacy_section); @@ -867,6 +871,8 @@ void PrivacySection::OnLoggingChange(GtkWidget* widget, reinterpret_cast<gpointer>(OnLoggingChange), privacy_section); privacy_section->ResolveMetricsReportingEnabled(); + if (enabled == gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) + privacy_section->ShowRestartMessageBox(); g_signal_handlers_unblock_by_func(widget, reinterpret_cast<gpointer>(OnLoggingChange), privacy_section); @@ -933,6 +939,22 @@ void PrivacySection::ResolveMetricsReportingEnabled() { #endif } +void PrivacySection::ShowRestartMessageBox() const { + GtkWidget* dialog = gtk_message_dialog_new( + GTK_WINDOW(gtk_widget_get_toplevel(page_)), + static_cast<GtkDialogFlags>(GTK_DIALOG_MODAL), + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", + l10n_util::GetStringUTF8(IDS_OPTIONS_RESTART_REQUIRED).c_str()); + gtk_util::ApplyMessageDialogQuirks(dialog); + gtk_window_set_title(GTK_WINDOW(dialog), + l10n_util::GetStringUTF8(IDS_PRODUCT_NAME).c_str()); + g_signal_connect_swapped(dialog, "response", G_CALLBACK(gtk_widget_destroy), + dialog); + gtk_util::ShowDialog(dialog); +} + /////////////////////////////////////////////////////////////////////////////// // SecuritySection diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js index e298ef1..f8b1da1 100644 --- a/chrome/browser/resources/options/advanced_options.js +++ b/chrome/browser/resources/options/advanced_options.js @@ -140,6 +140,16 @@ var OptionsPage = options.OptionsPage; chrome.send('showCloudPrintManagePage'); }; } + }, + + /** + * Show a 'restart required' alert. + * @private + */ + showRestartRequiredAlert_: function() { + AlertOverlay.show(undefined, + localStrings.getString('optionsRestartRequired'), + undefined, '', undefined); } }; @@ -149,11 +159,14 @@ var OptionsPage = options.OptionsPage; // Set the checked state of the metrics reporting checkbox. AdvancedOptions.SetMetricsReportingCheckboxState = function( - checked, disabled) { + checked, disabled, user_changed) { $('metricsReportingEnabled').checked = checked; $('metricsReportingEnabled').disabled = disabled; if (disabled) $('metricsReportingEnabledText').className = 'disable-services-span'; + + if (user_changed) + AdvancedOptions.getInstance().showRestartRequiredAlert_(); } AdvancedOptions.SetMetricsReportingSettingVisibility = function(visible) { diff --git a/chrome/browser/ui/views/options/advanced_contents_view.cc b/chrome/browser/ui/views/options/advanced_contents_view.cc index e6588aa..7322f3a 100644 --- a/chrome/browser/ui/views/options/advanced_contents_view.cc +++ b/chrome/browser/ui/views/options/advanced_contents_view.cc @@ -46,6 +46,7 @@ #include "chrome/browser/ui/views/list_background.h" #include "chrome/browser/ui/views/options/content_settings_window_view.h" #include "chrome/browser/ui/views/options/fonts_languages_window_view.h" +#include "chrome/browser/ui/views/restart_message_box.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" @@ -523,6 +524,8 @@ void PrivacySection::ButtonPressed( "Options_MetricsReportingCheckbox_Disable"), profile()->GetPrefs()); ResolveMetricsReportingEnabled(); + if (enabled == reporting_enabled_checkbox_->checked()) + RestartMessageBox::ShowMessageBox(GetWindow()->GetNativeWindow()); enable_metrics_recording_.SetValue(enabled); } else if (sender == content_settings_button_) { UserMetricsRecordAction(UserMetricsAction("Options_ContentSettings"), NULL); |