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.
16 function AutomaticSettingsResetBanner() {}
18 cr.addSingletonGetter(AutomaticSettingsResetBanner);
20 AutomaticSettingsResetBanner.prototype = {
21 __proto__: SettingsBannerBase.prototype,
24 * Initializes the banner's event handlers.
26 initialize: function() {
27 this.showMetricName_ = 'AutomaticSettingsReset_WebUIBanner_BannerShown';
29 this.dismissNativeCallbackName_ =
30 'onDismissedAutomaticSettingsResetBanner';
32 this.setVisibilibyDomElement_ = $('automatic-settings-reset-banner');
34 $('automatic-settings-reset-banner-close').onclick = function(event) {
35 chrome.send('metricsHandler:recordAction',
36 ['AutomaticSettingsReset_WebUIBanner_ManuallyClosed']);
37 AutomaticSettingsResetBanner.dismiss();
39 $('automatic-settings-reset-learn-more').onclick = function(event) {
40 chrome.send('metricsHandler:recordAction',
41 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']);
43 $('automatic-settings-reset-banner-activate-reset').onclick =
45 chrome.send('metricsHandler:recordAction',
46 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']);
47 PageManager.showPageByName('resetProfileSettings');
52 // Forward public APIs to private implementations.
56 ].forEach(function(name) {
57 AutomaticSettingsResetBanner[name] = function() {
58 var instance = AutomaticSettingsResetBanner.getInstance();
59 return instance[name + '_'].apply(instance, arguments);
65 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner