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

Side by Side Diff: chrome/browser/resources/settings/reset_page/reset_profile_dialog.js

Issue 1853413002: MD Settings: Convert reset_page/ to use browser proxy pattern. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ChromeOS tests. Created 4 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile 7 * 'settings-reset-profile-dialog' is the dialog shown for clearing profile
8 * settings. 8 * settings.
9 */ 9 */
10 Polymer({ 10 Polymer({
11 is: 'settings-reset-profile-dialog', 11 is: 'settings-reset-profile-dialog',
12 12
13 behaviors: [WebUIListenerBehavior],
14
13 properties: { 15 properties: {
14 feedbackInfo_: String, 16 feedbackInfo_: String,
15 }, 17 },
16 18
19 /** @private {!settings.ResetBrowserProxy} */
20 browserProxy_: null,
tommycli 2016/04/05 18:46:28 I thought private members were still supposed to b
dpapad 2016/04/05 19:23:12 The debate was not exactly about private VS public
21
17 /** @override */ 22 /** @override */
18 attached: function() { 23 ready: function() {
19 cr.define('SettingsResetPage', function() { 24 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance();
20 return {
21 doneResetting: function() {
22 this.$.resetSpinner.active = false;
23 this.$.dialog.close();
24 this.dispatchResetDoneEvent();
25 }.bind(this),
26 25
27 setFeedbackInfo: function(data) { 26 this.addEventListener('iron-overlay-canceled', function() {
28 this.set('feedbackInfo_', data.feedbackInfo); 27 this.browserProxy_.onHideResetProfileDialog();
29 }.bind(this), 28 }.bind(this));
30 }; 29
30 this.addWebUIListener('feedback-info-changed', function(feedbackInfo) {
31 this.set('feedbackInfo_', feedbackInfo);
tommycli 2016/04/05 18:46:28 nit:Is the .set usage necessary for first-level pr
dpapad 2016/04/05 19:23:12 Done, it was not necessary.
31 }.bind(this)); 32 }.bind(this));
32 }, 33 },
33 34
34 /** @override */
35 ready: function() {
36 this.addEventListener('iron-overlay-canceled', function() {
37 chrome.send('onHideResetProfileDialog');
38 });
39 },
40
41 dispatchResetDoneEvent: function() { 35 dispatchResetDoneEvent: function() {
tommycli 2016/04/05 18:46:28 nit: It looks like this method is only non-inlined
dpapad 2016/04/05 19:23:12 Done.
42 this.dispatchEvent(new CustomEvent('reset-done')); 36 this.dispatchEvent(new CustomEvent('reset-done'));
43 }, 37 },
44 38
45 open: function() { 39 open: function() {
46 this.$.dialog.open(); 40 this.$.dialog.open();
47 chrome.send('onShowResetProfileDialog'); 41 this.browserProxy_.onShowResetProfileDialog();
48 }, 42 },
49 43
50 /** @private */ 44 /** @private */
51 onCancelTap_: function() { 45 onCancelTap_: function() {
52 this.$.dialog.cancel(); 46 this.$.dialog.cancel();
53 }, 47 },
54 48
55 /** @private */ 49 /** @private */
56 onResetTap_: function() { 50 onResetTap_: function() {
57 this.$.resetSpinner.active = true; 51 this.$.resetSpinner.active = true;
58 chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]); 52 this.browserProxy_.performResetProfileSettings(
53 this.$.sendSettings.checked).then(function() {
54 this.$.resetSpinner.active = false;
55 this.$.dialog.close();
56 this.dispatchResetDoneEvent();
57 }.bind(this));
59 }, 58 },
60 59
61 /** @private */ 60 /** @private */
62 onSendSettingsChange_: function() { 61 onSendSettingsChange_: function() {
63 // TODO(dpapad): Update how settings info is surfaced when final mocks 62 // TODO(dpapad): Update how settings info is surfaced when final mocks
64 // exist. 63 // exist.
65 this.$.settings.hidden = !this.$.sendSettings.checked; 64 this.$.settings.hidden = !this.$.sendSettings.checked;
66 this.$.dialog.center(); 65 this.$.dialog.center();
67 }, 66 },
68 }); 67 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698