Chromium Code Reviews| Index: chrome/browser/resources/options/automatic_settings_reset_banner.js |
| diff --git a/chrome/browser/resources/options/reset_profile_settings_banner.js b/chrome/browser/resources/options/automatic_settings_reset_banner.js |
| similarity index 63% |
| copy from chrome/browser/resources/options/reset_profile_settings_banner.js |
| copy to chrome/browser/resources/options/automatic_settings_reset_banner.js |
| index 4517e9151c7fed0d4ba41775df3337f2c710d506..873b8742dee602f2f19363d4cddb712c67b79401 100644 |
| --- a/chrome/browser/resources/options/reset_profile_settings_banner.js |
| +++ b/chrome/browser/resources/options/automatic_settings_reset_banner.js |
| @@ -1,31 +1,31 @@ |
| -// Copyright 2013 The Chromium Authors. All rights reserved. |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -// Note: the native-side handler for this is ResetProfileSettingsHandler. |
| +// Note: the native-side handler for this is AutomaticSettingsResetHandler. |
| cr.define('options', function() { |
| /** @const */ var OptionsPage = options.OptionsPage; |
| /** |
| - * ResetProfileSettingsBanner class |
| + * AutomaticSettingsResetBanner class |
| * Provides encapsulated handling of the Reset Profile Settings banner. |
| * @constructor |
| */ |
| - function ResetProfileSettingsBanner() {} |
| + function AutomaticSettingsResetBanner() {} |
|
Bernhard Bauer
2014/02/07 08:14:53
Same here. Maybe a shared base class?
robertshield
2014/02/07 19:08:28
Extracted most things to a base class. intialize()
Bernhard Bauer
2014/02/08 17:38:46
Yes, it's fine this way. Thanks!
|
| - cr.addSingletonGetter(ResetProfileSettingsBanner); |
| + cr.addSingletonGetter(AutomaticSettingsResetBanner); |
| - ResetProfileSettingsBanner.prototype = { |
| + AutomaticSettingsResetBanner.prototype = { |
| /** |
| * Whether or not the banner has already been dismissed. |
| * |
| * This is needed because of the surprising ordering of asynchronous |
| * JS<->native calls when the settings page is opened with specifying a |
| - * given sub-page, e.g. chrome://settings/resetProfileSettings. |
| + * given sub-page, e.g. chrome://settings/AutomaticSettingsReset. |
| * |
| - * In such a case, ResetProfileSettingsOverlay's didShowPage(), which calls |
| - * our dismiss() method, would be called before the native Handlers' |
| + * In such a case, AutomaticSettingsResetOverlay's didShowPage(), which |
| + * calls our dismiss() method, would be called before the native Handlers' |
| * InitalizePage() methods have an effect in the JS, which includes calling |
| * our show() method. This would mean that the banner would be first |
| * dismissed, then shown. We want to prevent this. |
| @@ -39,15 +39,14 @@ cr.define('options', function() { |
| * Initializes the banner's event handlers. |
| */ |
| initialize: function() { |
| - $('reset-profile-settings-banner-close').onclick = function(event) { |
| + $('automatic-settings-reset-banner-close').onclick = function(event) { |
| chrome.send('metricsHandler:recordAction', |
| - ['AutomaticReset_WebUIBanner_ManuallyClosed']); |
| - ResetProfileSettingsBanner.dismiss(); |
| + ['AutomaticSettingsReset_WebUIBanner_ManuallyClosed']); |
| + AutomaticSettingsResetBanner.dismiss(); |
| }; |
| - $('reset-profile-settings-banner-activate').onclick = function(event) { |
| + $('automatic-settings-reset-learn-more').onclick = function(event) { |
| chrome.send('metricsHandler:recordAction', |
| - ['AutomaticReset_WebUIBanner_ResetClicked']); |
| - OptionsPage.navigateToPage('resetProfileSettings'); |
| + ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']); |
| }; |
| }, |
| @@ -58,7 +57,7 @@ cr.define('options', function() { |
| show_: function() { |
| if (!this.hadBeenDismissed_) { |
| chrome.send('metricsHandler:recordAction', |
| - ['AutomaticReset_WebUIBanner_BannerShown']); |
| + ['AutomaticSettingsReset_WebUIBanner_BannerShown']); |
| this.setVisibility_(true); |
| } |
| }, |
| @@ -70,7 +69,7 @@ cr.define('options', function() { |
| * @private |
| */ |
| dismiss_: function() { |
| - chrome.send('onDismissedResetProfileSettingsBanner'); |
| + chrome.send('onDismissedAutomaticSettingsResetBanner'); |
| this.hadBeenDismissed_ = true; |
| this.setVisibility_(false); |
| }, |
| @@ -81,7 +80,7 @@ cr.define('options', function() { |
| * @private |
| */ |
| setVisibility_: function(show) { |
| - $('reset-profile-settings-banner').hidden = !show; |
| + $('automatic-settings-reset-banner').hidden = !show; |
| } |
| }; |
| @@ -90,14 +89,14 @@ cr.define('options', function() { |
| 'show', |
| 'dismiss', |
| ].forEach(function(name) { |
| - ResetProfileSettingsBanner[name] = function() { |
| - var instance = ResetProfileSettingsBanner.getInstance(); |
| + AutomaticSettingsResetBanner[name] = function() { |
| + var instance = AutomaticSettingsResetBanner.getInstance(); |
| return instance[name + '_'].apply(instance, arguments); |
| }; |
| }); |
| // Export |
| return { |
| - ResetProfileSettingsBanner: ResetProfileSettingsBanner |
| + AutomaticSettingsResetBanner: AutomaticSettingsResetBanner |
| }; |
| }); |