1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Note: the native-side handler for this is ResetProfileSettingsHandler.
7 cr
.define('options', function() {
8 /** @const */ var PageManager
= cr
.ui
.pageManager
.PageManager
;
9 /** @const */ var SettingsBannerBase
= options
.SettingsBannerBase
;
12 * ResetProfileSettingsBanner class
13 * Provides encapsulated handling of the Reset Profile Settings banner.
15 * @extends {options.SettingsBannerBase}
17 function ResetProfileSettingsBanner() {}
19 cr
.addSingletonGetter(ResetProfileSettingsBanner
);
21 ResetProfileSettingsBanner
.prototype = {
22 __proto__
: SettingsBannerBase
.prototype,
25 * Initializes the banner's event handlers.
26 * @suppress {checkTypes}
27 * TODO(vitalyp): remove the suppression. See the explanation in
28 * chrome/browser/resources/options/automatic_settings_reset_banner.js.
30 initialize: function() {
31 this.showMetricName
= 'AutomaticReset_WebUIBanner_BannerShown';
33 this.dismissNativeCallbackName
=
34 'onDismissedResetProfileSettingsBanner';
36 this.visibilityDomElement
= $('reset-profile-settings-banner');
38 $('reset-profile-settings-banner-close').onclick = function(event
) {
39 chrome
.send('metricsHandler:recordAction',
40 ['AutomaticReset_WebUIBanner_ManuallyClosed']);
41 ResetProfileSettingsBanner
.dismiss();
43 $('reset-profile-settings-banner-activate').onclick = function(event
) {
44 chrome
.send('metricsHandler:recordAction',
45 ['AutomaticReset_WebUIBanner_ResetClicked']);
46 PageManager
.showPageByName('resetProfileSettings');
51 // Forward public APIs to protected implementations.
55 ].forEach(function(name
) {
56 ResetProfileSettingsBanner
[name
] = function() {
57 var instance
= ResetProfileSettingsBanner
.getInstance();
58 return instance
[name
].apply(instance
, arguments
);
64 ResetProfileSettingsBanner
: ResetProfileSettingsBanner