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

Unified Diff: chrome/browser/resources/options/automatic_settings_reset_banner.js

Issue 151003004: Add an automatic settings reset banner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Gab's nits. Created 6 years, 10 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/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
new file mode 100644
index 0000000000000000000000000000000000000000..a494aee8f8a63ba53e20621aed469f3275dd36c7
--- /dev/null
+++ b/chrome/browser/resources/options/automatic_settings_reset_banner.js
@@ -0,0 +1,60 @@
+// 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 AutomaticSettingsResetHandler.
+
+cr.define('options', function() {
+ /** @const */ var SettingsBannerBase = options.SettingsBannerBase;
+
+ /**
+ * AutomaticSettingsResetBanner class
+ * Provides encapsulated handling of the Reset Profile Settings banner.
+ * @constructor
+ */
+ function AutomaticSettingsResetBanner() {}
+
+ cr.addSingletonGetter(AutomaticSettingsResetBanner);
+
+ AutomaticSettingsResetBanner.prototype = {
+ __proto__: SettingsBannerBase.prototype,
+
+ /**
+ * Initializes the banner's event handlers.
+ */
+ initialize: function() {
+ this.showMetricName_ = 'AutomaticSettingsReset_WebUIBanner_BannerShown';
+
+ this.dismissNativeCallbackName_ =
+ 'onDismissedAutomaticSettingsResetBanner';
+
+ this.setVisibilibyDomElementSelector_ = 'automatic-settings-reset-banner';
+
+ $('automatic-settings-reset-banner-close').onclick = function(event) {
+ chrome.send('metricsHandler:recordAction',
+ ['AutomaticSettingsReset_WebUIBanner_ManuallyClosed']);
+ AutomaticSettingsResetBanner.dismiss();
+ };
+ $('automatic-settings-reset-learn-more').onclick = function(event) {
+ chrome.send('metricsHandler:recordAction',
+ ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']);
+ };
+ },
+ };
+
+ // Forward public APIs to private implementations.
+ [
+ 'show',
+ 'dismiss',
+ ].forEach(function(name) {
+ AutomaticSettingsResetBanner[name] = function() {
+ var instance = AutomaticSettingsResetBanner.getInstance();
+ return instance[name + '_'].apply(instance, arguments);
+ };
+ });
+
+ // Export
+ return {
+ AutomaticSettingsResetBanner: AutomaticSettingsResetBanner
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698