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

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

Issue 533183002: Revert "Eliminate all code related to the AutomaticProfileResetter." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 3 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/reset_profile_settings_banner.js
diff --git a/chrome/browser/resources/options/reset_profile_settings_banner.js b/chrome/browser/resources/options/reset_profile_settings_banner.js
new file mode 100644
index 0000000000000000000000000000000000000000..e54be257b7c012dfaafcea47b2b8deed910f3157
--- /dev/null
+++ b/chrome/browser/resources/options/reset_profile_settings_banner.js
@@ -0,0 +1,62 @@
+// Copyright 2013 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.
+
+cr.define('options', function() {
+ /** @const */ var PageManager = cr.ui.pageManager.PageManager;
+ /** @const */ var SettingsBannerBase = options.SettingsBannerBase;
+
+ /**
+ * ResetProfileSettingsBanner class
+ * Provides encapsulated handling of the Reset Profile Settings banner.
+ * @constructor
+ */
+ function ResetProfileSettingsBanner() {}
+
+ cr.addSingletonGetter(ResetProfileSettingsBanner);
+
+ ResetProfileSettingsBanner.prototype = {
+ __proto__: SettingsBannerBase.prototype,
+
+ /**
+ * Initializes the banner's event handlers.
+ */
+ initialize: function() {
+ this.showMetricName = 'AutomaticReset_WebUIBanner_BannerShown';
+
+ this.dismissNativeCallbackName =
+ 'onDismissedResetProfileSettingsBanner';
+
+ this.visibilityDomElement = $('reset-profile-settings-banner');
+
+ $('reset-profile-settings-banner-close').onclick = function(event) {
+ chrome.send('metricsHandler:recordAction',
+ ['AutomaticReset_WebUIBanner_ManuallyClosed']);
+ ResetProfileSettingsBanner.dismiss();
+ };
+ $('reset-profile-settings-banner-activate').onclick = function(event) {
+ chrome.send('metricsHandler:recordAction',
+ ['AutomaticReset_WebUIBanner_ResetClicked']);
+ PageManager.showPageByName('resetProfileSettings');
+ };
+ },
+ };
+
+ // Forward public APIs to protected implementations.
+ [
+ 'show',
+ 'dismiss',
+ ].forEach(function(name) {
+ ResetProfileSettingsBanner[name] = function() {
+ var instance = ResetProfileSettingsBanner.getInstance();
+ return instance[name].apply(instance, arguments);
+ };
+ });
+
+ // Export
+ return {
+ ResetProfileSettingsBanner: ResetProfileSettingsBanner
+ };
+});

Powered by Google App Engine
This is Rietveld 408576698