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 OptionsPage = options.OptionsPage;
9 /** @const */ var SettingsBannerBase = options.SettingsBannerBase;
12 * ResetProfileSettingsBanner class
13 * Provides encapsulated handling of the Reset Profile Settings banner.
16 function ResetProfileSettingsBanner() {}
18 cr.addSingletonGetter(ResetProfileSettingsBanner);
20 ResetProfileSettingsBanner.prototype = {
21 __proto__: SettingsBannerBase.prototype,
24 * Initializes the banner's event handlers.
26 initialize: function() {
27 this.showMetricName_ = 'AutomaticReset_WebUIBanner_BannerShown';
29 this.dismissNativeCallbackName_ =
30 'onDismissedResetProfileSettingsBanner';
32 this.setVisibilibyDomElement_ = $('reset-profile-settings-banner');
34 $('reset-profile-settings-banner-close').onclick = function(event) {
35 chrome.send('metricsHandler:recordAction',
36 ['AutomaticReset_WebUIBanner_ManuallyClosed']);
37 ResetProfileSettingsBanner.dismiss();
39 $('reset-profile-settings-banner-activate').onclick = function(event) {
40 chrome.send('metricsHandler:recordAction',
41 ['AutomaticReset_WebUIBanner_ResetClicked']);
42 OptionsPage.navigateToPage('resetProfileSettings');
47 // Forward public APIs to private implementations.
51 ].forEach(function(name) {
52 ResetProfileSettingsBanner[name] = function() {
53 var instance = ResetProfileSettingsBanner.getInstance();
54 return instance[name + '_'].apply(instance, arguments);
60 ResetProfileSettingsBanner: ResetProfileSettingsBanner