1 // Copyright 2014 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 AutomaticSettingsResetHandler.
7 cr
.define('options', function() {
8 /** @const */ var SettingsBannerBase
= options
.SettingsBannerBase
;
9 /** @const */ var PageManager
= cr
.ui
.pageManager
.PageManager
;
12 * AutomaticSettingsResetBanner class
13 * Provides encapsulated handling of the Reset Profile Settings banner.
15 * @extends {options.SettingsBannerBase}
17 function AutomaticSettingsResetBanner() {}
19 cr
.addSingletonGetter(AutomaticSettingsResetBanner
);
21 AutomaticSettingsResetBanner
.prototype = {
22 __proto__
: SettingsBannerBase
.prototype,
25 * Initializes the banner's event handlers.
27 initialize: function() {
28 this.showMetricName
= 'AutomaticSettingsReset_WebUIBanner_BannerShown';
30 this.dismissNativeCallbackName
=
31 'onDismissedAutomaticSettingsResetBanner';
33 this.visibilityDomElement
= $('automatic-settings-reset-banner');
35 $('automatic-settings-reset-banner-close').onclick = function(event
) {
36 chrome
.send('metricsHandler:recordAction',
37 ['AutomaticSettingsReset_WebUIBanner_ManuallyClosed']);
38 AutomaticSettingsResetBanner
.dismiss();
40 $('automatic-settings-reset-learn-more').onclick = function(event
) {
41 chrome
.send('metricsHandler:recordAction',
42 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']);
44 $('automatic-settings-reset-banner-activate-reset').onclick
=
46 chrome
.send('metricsHandler:recordAction',
47 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']);
48 PageManager
.showPageByName('resetProfileSettings');
53 // Forward public APIs to protected implementations.
57 ].forEach(function(name
) {
58 AutomaticSettingsResetBanner
[name
] = function() {
59 var instance
= AutomaticSettingsResetBanner
.getInstance();
60 return instance
[name
].apply(instance
, arguments
);
66 AutomaticSettingsResetBanner
: AutomaticSettingsResetBanner