OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Note: the native-side handler for this is AutomaticSettingsResetHandler. | 5 // Note: the native-side handler for this is AutomaticSettingsResetHandler. |
6 | 6 |
7 cr.define('options', function() { | 7 cr.define('options', function() { |
8 /** @const */ var SettingsBannerBase = options.SettingsBannerBase; | 8 /** @const */ var SettingsBannerBase = options.SettingsBannerBase; |
9 /** @const */ var PageManager = cr.ui.pageManager.PageManager; | 9 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
10 | 10 |
11 /** | 11 /** |
12 * AutomaticSettingsResetBanner class | 12 * AutomaticSettingsResetBanner class |
13 * Provides encapsulated handling of the Reset Profile Settings banner. | 13 * Provides encapsulated handling of the Reset Profile Settings banner. |
14 * @constructor | 14 * @constructor |
15 * @extends {options.SettingsBannerBase} | 15 * @extends {options.SettingsBannerBase} |
16 */ | 16 */ |
17 function AutomaticSettingsResetBanner() {} | 17 function AutomaticSettingsResetBanner() {} |
18 | 18 |
19 cr.addSingletonGetter(AutomaticSettingsResetBanner); | 19 cr.addSingletonGetter(AutomaticSettingsResetBanner); |
20 | 20 |
21 AutomaticSettingsResetBanner.prototype = { | 21 AutomaticSettingsResetBanner.prototype = { |
22 __proto__: SettingsBannerBase.prototype, | 22 __proto__: SettingsBannerBase.prototype, |
23 | 23 |
24 /** | 24 /** |
25 * Initializes the banner's event handlers. | 25 * Initializes the banner's event handlers. |
| 26 * @suppress {checkTypes} |
| 27 * TODO(vitalyp): remove the suppression. Suppression is needed because |
| 28 * method dismiss() is attached to AutomaticSettingsResetBanner at run-time |
| 29 * via "Forward public APIs to protected implementations" pattern (see |
| 30 * below). Currently the compiler pass and cr.js handles only forwarding to |
| 31 * private implementations using cr.makePublic(). |
26 */ | 32 */ |
27 initialize: function() { | 33 initialize: function() { |
28 this.showMetricName = 'AutomaticSettingsReset_WebUIBanner_BannerShown'; | 34 this.showMetricName = 'AutomaticSettingsReset_WebUIBanner_BannerShown'; |
29 | 35 |
30 this.dismissNativeCallbackName = | 36 this.dismissNativeCallbackName = |
31 'onDismissedAutomaticSettingsResetBanner'; | 37 'onDismissedAutomaticSettingsResetBanner'; |
32 | 38 |
33 this.visibilityDomElement = $('automatic-settings-reset-banner'); | 39 this.visibilityDomElement = $('automatic-settings-reset-banner'); |
34 | 40 |
35 $('automatic-settings-reset-banner-close').onclick = function(event) { | 41 $('automatic-settings-reset-banner-close').onclick = function(event) { |
(...skipping 23 matching lines...) Expand all Loading... |
59 var instance = AutomaticSettingsResetBanner.getInstance(); | 65 var instance = AutomaticSettingsResetBanner.getInstance(); |
60 return instance[name].apply(instance, arguments); | 66 return instance[name].apply(instance, arguments); |
61 }; | 67 }; |
62 }); | 68 }); |
63 | 69 |
64 // Export | 70 // Export |
65 return { | 71 return { |
66 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner | 72 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner |
67 }; | 73 }; |
68 }); | 74 }); |
OLD | NEW |