Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: chrome/browser/resources/options/automatic_settings_reset_banner.js

Issue 577843003: Revert of Add public API generation with cr.makePublic() and handle it in compiler pass (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_3
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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}
16 */ 15 */
17 function AutomaticSettingsResetBanner() {} 16 function AutomaticSettingsResetBanner() {}
18 17
19 cr.addSingletonGetter(AutomaticSettingsResetBanner); 18 cr.addSingletonGetter(AutomaticSettingsResetBanner);
20 19
21 AutomaticSettingsResetBanner.prototype = { 20 AutomaticSettingsResetBanner.prototype = {
22 __proto__: SettingsBannerBase.prototype, 21 __proto__: SettingsBannerBase.prototype,
23 22
24 /** 23 /**
25 * Initializes the banner's event handlers. 24 * Initializes the banner's event handlers.
(...skipping 15 matching lines...) Expand all
41 chrome.send('metricsHandler:recordAction', 40 chrome.send('metricsHandler:recordAction',
42 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']); 41 ['AutomaticSettingsReset_WebUIBanner_LearnMoreClicked']);
43 }; 42 };
44 $('automatic-settings-reset-banner-activate-reset').onclick = 43 $('automatic-settings-reset-banner-activate-reset').onclick =
45 function(event) { 44 function(event) {
46 chrome.send('metricsHandler:recordAction', 45 chrome.send('metricsHandler:recordAction',
47 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']); 46 ['AutomaticSettingsReset_WebUIBanner_ResetClicked']);
48 PageManager.showPageByName('resetProfileSettings'); 47 PageManager.showPageByName('resetProfileSettings');
49 }; 48 };
50 }, 49 },
51
52 /**
53 * Called by the native code to show the banner if needed.
54 * @private
55 */
56 show_: function() {
57 if (!this.hadBeenDismissed_) {
58 chrome.send('metricsHandler:recordAction', [this.showMetricName_]);
59 this.setVisibility(true);
60 }
61 },
62
63 /**
64 * Called when the banner should be closed as a result of something taking
65 * place on the WebUI page, i.e. when its close button is pressed, or when
66 * the confirmation dialog for the profile settings reset feature is opened.
67 * @private
68 */
69 dismiss_: function() {
70 chrome.send(this.dismissNativeCallbackName_);
71 this.hadBeenDismissed_ = true;
72 this.setVisibility(false);
73 },
74 }; 50 };
75 51
76 // Forward public APIs to private implementations. 52 // Forward public APIs to private implementations.
77 cr.makePublic(AutomaticSettingsResetBanner, [ 53 [
78 'show', 54 'show',
79 'dismiss', 55 'dismiss',
80 ]); 56 ].forEach(function(name) {
57 AutomaticSettingsResetBanner[name] = function() {
58 var instance = AutomaticSettingsResetBanner.getInstance();
59 return instance[name + '_'].apply(instance, arguments);
60 };
61 });
81 62
82 // Export 63 // Export
83 return { 64 return {
84 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner 65 AutomaticSettingsResetBanner: AutomaticSettingsResetBanner
85 }; 66 };
86 }); 67 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/chromeos/login/oobe_screen_user_image.js ('k') | chrome/browser/resources/options/browser_options.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698