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

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

Issue 1911573003: MD Settings: Reset profile dialog, display settings in new tab. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. 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], 13 behaviors: [WebUIListenerBehavior],
14 14
15 properties: {
16 feedbackInfo_: String,
17 },
18
19 /** @private {!settings.ResetBrowserProxy} */ 15 /** @private {!settings.ResetBrowserProxy} */
20 browserProxy_: null, 16 browserProxy_: null,
21 17
22 /** @override */ 18 /** @override */
23 ready: function() { 19 ready: function() {
24 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance(); 20 this.browserProxy_ = settings.ResetBrowserProxyImpl.getInstance();
25 21
26 this.addEventListener('iron-overlay-canceled', function() { 22 this.addEventListener('iron-overlay-canceled', function() {
27 this.browserProxy_.onHideResetProfileDialog(); 23 this.browserProxy_.onHideResetProfileDialog();
28 }.bind(this)); 24 }.bind(this));
29
30 this.addWebUIListener('feedback-info-changed', function(feedbackInfo) {
31 this.feedbackInfo_ = feedbackInfo;
32 }.bind(this));
33 }, 25 },
34 26
35 open: function() { 27 open: function() {
36 this.$.dialog.open(); 28 this.$.dialog.open();
37 this.browserProxy_.onShowResetProfileDialog(); 29 this.browserProxy_.onShowResetProfileDialog();
38 }, 30 },
39 31
40 /** @private */ 32 /** @private */
41 onCancelTap_: function() { 33 onCancelTap_: function() {
42 this.$.dialog.cancel(); 34 this.$.dialog.cancel();
43 }, 35 },
44 36
45 /** @private */ 37 /** @private */
46 onResetTap_: function() { 38 onResetTap_: function() {
47 this.$.resetSpinner.active = true; 39 this.$.resetSpinner.active = true;
48 this.browserProxy_.performResetProfileSettings( 40 this.browserProxy_.performResetProfileSettings(
49 this.$.sendSettings.checked).then(function() { 41 this.$.sendSettings.checked).then(function() {
50 this.$.resetSpinner.active = false; 42 this.$.resetSpinner.active = false;
51 this.$.dialog.close(); 43 this.$.dialog.close();
52 this.dispatchEvent(new CustomEvent('reset-done')); 44 this.dispatchEvent(new CustomEvent('reset-done'));
53 }.bind(this)); 45 }.bind(this));
54 }, 46 },
55 47
56 /** @private */ 48 /**
57 onSendSettingsChange_: function() { 49 * Displays the settings that will be reported in a new tab.
58 // TODO(dpapad): Update how settings info is surfaced when final mocks 50 * @private
59 // exist. 51 */
60 this.$.settings.hidden = !this.$.sendSettings.checked; 52 onShowReportedSettingsTap_: function() {
61 this.$.dialog.center(); 53 this.browserProxy_.getReportedSettings().then(function(settings) {
54 var feedbackObj = {};
55 settings.forEach(function(entry) {
tommycli 2016/04/20 23:23:18 Maybe add a comment that says something like: Repl
dpapad 2016/04/21 00:27:10 Added comment.
56 var values = entry.value.split('\n');
57 feedbackObj[entry.key] = values.length == 1 ? values[0] : values;
58 });
59 var win = window.open('about:blank');
60 var div = win.document.createElement('div');
61 div.textContent = JSON.stringify(feedbackObj, null, 2 /* spaces */);
62 div.style.whiteSpace = 'pre';
tommycli 2016/04/20 23:23:18 Optional: Since you are styling it, should we just
dpapad 2016/04/21 00:27:10 Does it not already line up (see http://i.imgur.co
63 win.document.body.appendChild(div);
64 });
62 }, 65 },
63 }); 66 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698