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 | 10 |
10 /** | 11 /** |
11 * AutomaticSettingsResetBanner class | 12 * AutomaticSettingsResetBanner class |
12 * Provides encapsulated handling of the Reset Profile Settings banner. | 13 * Provides encapsulated handling of the Reset Profile Settings banner. |
13 * @constructor | 14 * @constructor |
14 */ | 15 */ |
15 function AutomaticSettingsResetBanner() {} | 16 function AutomaticSettingsResetBanner() {} |
16 | 17 |
17 cr.addSingletonGetter(AutomaticSettingsResetBanner); | 18 cr.addSingletonGetter(AutomaticSettingsResetBanner); |
18 | 19 |
(...skipping 17 matching lines...) Expand all Loading... |
36 AutomaticSettingsResetBanner.dismiss(); | 37 AutomaticSettingsResetBanner.dismiss(); |
37 }; | 38 }; |
38 $('automatic-settings-reset-learn-more').onclick = function(event) { | 39 $('automatic-settings-reset-learn-more').onclick = function(event) { |
39 chrome.send('metricsHandler:recordAction', | 40 chrome.send('metricsHandler:recordAction', |
40 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']); | 41 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']); |
41 }; | 42 }; |
42 $('automatic-settings-reset-banner-activate-reset').onclick = | 43 $('automatic-settings-reset-banner-activate-reset').onclick = |
43 function(event) { | 44 function(event) { |
44 chrome.send('metricsHandler:recordAction', | 45 chrome.send('metricsHandler:recordAction', |
45 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']); | 46 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']); |
46 OptionsPage.navigateToPage('resetProfileSettings'); | 47 PageManager.showPageByName('resetProfileSettings'); |
47 }; | 48 }; |
48 }, | 49 }, |
49 }; | 50 }; |
50 | 51 |
51 // Forward public APIs to private implementations. | 52 // Forward public APIs to private implementations. |
52 [ | 53 [ |
53 'show', | 54 'show', |
54 'dismiss', | 55 'dismiss', |
55 ].forEach(function(name) { | 56 ].forEach(function(name) { |
56 AutomaticSettingsResetBanner[name] = function() { | 57 AutomaticSettingsResetBanner[name] = function() { |
57 var instance = AutomaticSettingsResetBanner.getInstance(); | 58 var instance = AutomaticSettingsResetBanner.getInstance(); |
58 return instance[name + '_'].apply(instance, arguments); | 59 return instance[name + '_'].apply(instance, arguments); |
59 }; | 60 }; |
60 }); | 61 }); |
61 | 62 |
62 // Export | 63 // Export |
63 return { | 64 return { |
64 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner | 65 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner |
65 }; | 66 }; |
66 }); | 67 }); |
OLD | NEW |