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

Unified Diff: chrome/browser/resources/options/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
« no previous file with comments | « chrome/browser/resources/options/settings_banner.css ('k') | chrome/browser/ui/profile_reset_bubble.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/options/settings_banner.js
diff --git a/chrome/browser/resources/options/settings_banner.js b/chrome/browser/resources/options/settings_banner.js
index 5d030a4a309195e60571112345daaeac22f7d553..666aaf2aa500c29ce3b68ee685923fc23bf104ea 100644
--- a/chrome/browser/resources/options/settings_banner.js
+++ b/chrome/browser/resources/options/settings_banner.js
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(engedy): AutomaticSettingsResetBanner is the sole class to derive from
-// SettingsBannerBase. Refactor this into automatic_settings_reset_banner.js.
-
cr.define('options', function() {
/**
@@ -36,26 +33,52 @@ cr.define('options', function() {
/**
* Metric name to send when a show event occurs.
+ * @protected
*/
- showMetricName_: '',
+ showMetricName: '',
/**
* Name of the native callback invoked when the banner is dismised.
+ * @protected
*/
- dismissNativeCallbackName_: '',
+ dismissNativeCallbackName: '',
/**
* DOM element whose visibility is set when setVisibility_ is called.
+ * @protected
+ */
+ visibilityDomElement: null,
+
+ /**
+ * Called by the native code to show the banner if needed.
+ * @protected
*/
- setVisibilibyDomElement_: null,
+ 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.
+ * @protected
+ */
+ dismiss: function() {
+ chrome.send(this.dismissNativeCallbackName);
+ this.hadBeenDismissed_ = true;
+ this.setVisibility_(false);
+ },
/**
* Sets whether or not the reset profile settings banner shall be visible.
* @param {boolean} show Whether or not to show the banner.
- * @protected
+ * @private
*/
- setVisibility: function(show) {
- this.setVisibilibyDomElement_.hidden = !show;
+ setVisibility_: function(show) {
+ this.visibilityDomElement.hidden = !show;
},
};
« no previous file with comments | « chrome/browser/resources/options/settings_banner.css ('k') | chrome/browser/ui/profile_reset_bubble.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698