Move Webstore URL concepts to //extensions and out
[chromium-blink-merge.git] / chrome / browser / resources / options / automatic_settings_reset_banner.js
blobb16f6cbe0694c5bedf05740a86af564ba33e771e
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;
11 /**
12 * AutomaticSettingsResetBanner class
13 * Provides encapsulated handling of the Reset Profile Settings banner.
14 * @constructor
15 * @extends {options.SettingsBannerBase}
17 function AutomaticSettingsResetBanner() {}
19 cr.addSingletonGetter(AutomaticSettingsResetBanner);
21 AutomaticSettingsResetBanner.prototype = {
22 __proto__: SettingsBannerBase.prototype,
24 /**
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 =
45 function(event) {
46 chrome.send('metricsHandler:recordAction',
47 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']);
48 PageManager.showPageByName('resetProfileSettings');
53 // Forward public APIs to protected implementations.
55 'show',
56 'dismiss',
57 ].forEach(function(name) {
58 AutomaticSettingsResetBanner[name] = function() {
59 var instance = AutomaticSettingsResetBanner.getInstance();
60 return instance[name].apply(instance, arguments);
62 });
64 // Export
65 return {
66 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner
68 });