Index: chrome/browser/resources/options/automatic_settings_reset_banner.js |
diff --git a/chrome/browser/resources/options/automatic_settings_reset_banner.js b/chrome/browser/resources/options/automatic_settings_reset_banner.js |
index 2a1573eb3f3b14f8b038effde6896c2768dd7047..3da6f5d791f04489167cbed5b311b03fd560dddd 100644 |
--- a/chrome/browser/resources/options/automatic_settings_reset_banner.js |
+++ b/chrome/browser/resources/options/automatic_settings_reset_banner.js |
@@ -12,6 +12,7 @@ cr.define('options', function() { |
* AutomaticSettingsResetBanner class |
* Provides encapsulated handling of the Reset Profile Settings banner. |
* @constructor |
+ * @extends {options.SettingsBannerBase} |
*/ |
function AutomaticSettingsResetBanner() {} |
@@ -47,18 +48,36 @@ cr.define('options', function() { |
PageManager.showPageByName('resetProfileSettings'); |
}; |
}, |
+ |
+ /** |
+ * Called by the native code to show the banner if needed. |
+ * @private |
+ */ |
+ show_: function() { |
+ if (!this.hadBeenDismissed_) { |
+ chrome.send('metricsHandler:recordAction', [this.showMetricName_]); |
+ this.setVisibility(true); |
+ } |
+ }, |
+ |
+ /** |
+ * Called when the banner should be closed as a result of something taking |
+ * place on the WebUI page, i.e. when its close button is pressed, or when |
+ * the confirmation dialog for the profile settings reset feature is opened. |
+ * @private |
+ */ |
+ dismiss_: function() { |
+ chrome.send(this.dismissNativeCallbackName_); |
+ this.hadBeenDismissed_ = true; |
+ this.setVisibility(false); |
+ }, |
}; |
// Forward public APIs to private implementations. |
- [ |
+ cr.makePublic(AutomaticSettingsResetBanner, [ |
'show', |
'dismiss', |
- ].forEach(function(name) { |
- AutomaticSettingsResetBanner[name] = function() { |
- var instance = AutomaticSettingsResetBanner.getInstance(); |
- return instance[name + '_'].apply(instance, arguments); |
- }; |
- }); |
+ ]); |
// Export |
return { |