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

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: Addressing comments. 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
17 /** @override */ 19 /** @private {!settings.ResetBrowserProxy} */
18 attached: function() { 20 browserProxy_: null,
19 cr.define('SettingsResetPage', function() {
20 return {
21 doneResetting: function() {
22 this.$.resetSpinner.active = false;
23 this.$.dialog.close();
24 this.dispatchResetDoneEvent();
25 }.bind(this),
26
27 setFeedbackInfo: function(data) {
28 this.set('feedbackInfo_', data.feedbackInfo);
29 }.bind(this),
30 };
31 }.bind(this));
32 },
33 21
34 /** @override */ 22 /** @override */
35 ready: function() { 23 ready: function() {
24 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance();
25
36 this.addEventListener('iron-overlay-canceled', function() { 26 this.addEventListener('iron-overlay-canceled', function() {
37 chrome.send('onHideResetProfileDialog'); 27 this.browserProxy_.onHideResetProfileDialog();
38 }); 28 }.bind(this));
39 },
40 29
41 dispatchResetDoneEvent: function() { 30 this.addWebUIListener('feedback-info-changed', function(feedbackInfo) {
42 this.dispatchEvent(new CustomEvent('reset-done')); 31 this.feedbackInfo_ = feedbackInfo;
32 }.bind(this));
43 }, 33 },
44 34
45 open: function() { 35 open: function() {
46 this.$.dialog.open(); 36 this.$.dialog.open();
47 chrome.send('onShowResetProfileDialog'); 37 this.browserProxy_.onShowResetProfileDialog();
48 }, 38 },
49 39
50 /** @private */ 40 /** @private */
51 onCancelTap_: function() { 41 onCancelTap_: function() {
52 this.$.dialog.cancel(); 42 this.$.dialog.cancel();
53 }, 43 },
54 44
55 /** @private */ 45 /** @private */
56 onResetTap_: function() { 46 onResetTap_: function() {
57 this.$.resetSpinner.active = true; 47 this.$.resetSpinner.active = true;
58 chrome.send('performResetProfileSettings', [this.$.sendSettings.checked]); 48 this.browserProxy_.performResetProfileSettings(
49 this.$.sendSettings.checked).then(function() {
50 this.$.resetSpinner.active = false;
51 this.$.dialog.close();
52 this.dispatchEvent(new CustomEvent('reset-done'));
53 }.bind(this));
59 }, 54 },
60 55
61 /** @private */ 56 /** @private */
62 onSendSettingsChange_: function() { 57 onSendSettingsChange_: function() {
63 // TODO(dpapad): Update how settings info is surfaced when final mocks 58 // TODO(dpapad): Update how settings info is surfaced when final mocks
64 // exist. 59 // exist.
65 this.$.settings.hidden = !this.$.sendSettings.checked; 60 this.$.settings.hidden = !this.$.sendSettings.checked;
66 this.$.dialog.center(); 61 this.$.dialog.center();
67 }, 62 },
68 }); 63 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698