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

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

Issue 2236663002: Add origin of settings reset request to feedback reports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Dan's comments, take 2 Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 cr.define('options', function() { 5 cr.define('options', function() {
6 var Page = cr.ui.pageManager.Page; 6 var Page = cr.ui.pageManager.Page;
7 7
8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner; 8 var AutomaticSettingsResetBanner = options.AutomaticSettingsResetBanner;
9 9
10 /** 10 /**
11 * ResetProfileSettingsOverlay class 11 * ResetProfileSettingsOverlay class
12 * Encapsulated handling of the 'Reset Profile Settings' overlay page. 12 * Encapsulated handling of the 'Reset Profile Settings' overlay page.
13 * @constructor 13 * @constructor
14 * @extends {cr.ui.pageManager.Page} 14 * @extends {cr.ui.pageManager.Page}
15 */ 15 */
16 function ResetProfileSettingsOverlay() { 16 function ResetProfileSettingsOverlay() {
17 Page.call(this, 'resetProfileSettings', 17 Page.call(this, 'resetProfileSettings',
18 loadTimeData.getString('resetProfileSettingsOverlayTabTitle'), 18 loadTimeData.getString('resetProfileSettingsOverlayTabTitle'),
19 'reset-profile-settings-overlay'); 19 'reset-profile-settings-overlay');
20 } 20 }
21 21
22 cr.addSingletonGetter(ResetProfileSettingsOverlay); 22 cr.addSingletonGetter(ResetProfileSettingsOverlay);
Dan Beam 2016/09/13 18:42:09 remove this addSingletonGetter() call. it's not r
alito 2016/09/16 02:10:37 Done.
23 23
24 ResetProfileSettingsOverlay.prototype = { 24 ResetProfileSettingsOverlay.prototype = {
25 // Inherit ResetProfileSettingsOverlay from Page. 25 // Inherit ResetProfileSettingsOverlay from Page.
26 __proto__: Page.prototype, 26 __proto__: Page.prototype,
27 27
28 /** @private {string} */
Dan Beam 2016/09/06 19:35:18 this should be protected
Dan Beam 2016/09/13 18:42:09 do this
alito 2016/09/16 02:10:37 resetRequestOrigin_ is now a static variable.
29 resetRequestOrigin_: '',
30
28 /** @override */ 31 /** @override */
29 initializePage: function() { 32 initializePage: function() {
30 Page.prototype.initializePage.call(this); 33 Page.prototype.initializePage.call(this);
31 34
32 $('reset-profile-settings-dismiss').onclick = function(e) { 35 $('reset-profile-settings-dismiss').onclick = function(e) {
33 ResetProfileSettingsOverlay.dismiss(); 36 ResetProfileSettingsOverlay.dismiss();
34 }; 37 };
35 $('reset-profile-settings-commit').onclick = function(e) { 38 $('reset-profile-settings-commit').onclick = function(e) {
36 ResetProfileSettingsOverlay.setResettingState(true); 39 ResetProfileSettingsOverlay.setResettingState(true);
37 chrome.send('performResetProfileSettings', 40 chrome.send('performResetProfileSettings',
38 [$('send-settings').checked]); 41 [$('send-settings').checked,
42 ResetProfileSettingsOverlay.getInstance()
Dan Beam 2016/09/06 19:35:18 if ResetProfileSettingsOverlay.getInstance() != th
alito 2016/09/13 02:02:00 The reason that ResetProfileSettingsOverlay.getIns
Dan Beam 2016/09/13 18:42:09 tl;dr
43 .resetRequestOrigin_]);
Dan Beam 2016/09/06 19:35:18 this.resetRequestOrigin_
Dan Beam 2016/09/13 18:42:09 do this
alito 2016/09/16 02:10:37 resetRequestOrigin_ is now a static variable.
39 }; 44 };
Dan Beam 2016/09/06 19:35:18 }.bind(this);
Dan Beam 2016/09/13 18:42:09 do this
alito 2016/09/16 02:10:37 No longer needed.
40 $('expand-feedback').onclick = function(e) { 45 $('expand-feedback').onclick = function(e) {
41 var feedbackTemplate = $('feedback-template'); 46 var feedbackTemplate = $('feedback-template');
42 feedbackTemplate.hidden = !feedbackTemplate.hidden; 47 feedbackTemplate.hidden = !feedbackTemplate.hidden;
43 e.preventDefault(); 48 e.preventDefault();
44 }; 49 };
45 }, 50 },
46 51
47 /** 52 /**
48 * @override 53 * @override
49 * @suppress {checkTypes} 54 * @suppress {checkTypes}
50 * TODO(vitalyp): remove the suppression. See the explanation in 55 * TODO(vitalyp): remove the suppression. See the explanation in
51 * chrome/browser/resources/options/automatic_settings_reset_banner.js. 56 * chrome/browser/resources/options/automatic_settings_reset_banner.js.
52 */ 57 */
53 didShowPage: function() { 58 didShowPage: function() {
59 // A '#userclick' hash indicates that the reset request came from the
60 // user clicking on the reset settings button. This hash is set by the
61 // browser_options page.
62 //
63 // A '#cct' hash indicates that the reset request came from the CCT by
64 // launching Chrome with the startup URL
65 // chrome://settings/resetProfileSettings#cct.
66 var hash = this.hash.slice(1).toLowerCase();
67 this.resetRequestOrigin_ =
68 hash == 'cct' || hash == 'userclick' ? hash : '';
69 this.setHash('');
70
54 $('reset-profile-settings-title').textContent = 71 $('reset-profile-settings-title').textContent =
55 loadTimeData.getString('resetProfileSettingsOverlay'); 72 loadTimeData.getString('resetProfileSettingsOverlay');
56 $('reset-profile-settings-explanation').textContent = 73 $('reset-profile-settings-explanation').textContent =
57 loadTimeData.getString('resetProfileSettingsExplanation'); 74 loadTimeData.getString('resetProfileSettingsExplanation');
58 75
59 chrome.send('onShowResetProfileDialog'); 76 chrome.send('onShowResetProfileDialog');
60 }, 77 },
61 78
62 /** @override */ 79 /** @override */
63 didClosePage: function() { 80 didClosePage: function() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 var input = new JsEvalContext(feedbackListData); 117 var input = new JsEvalContext(feedbackListData);
101 var output = $('feedback-template'); 118 var output = $('feedback-template');
102 jstProcess(input, output); 119 jstProcess(input, output);
103 }; 120 };
104 121
105 // Export 122 // Export
106 return { 123 return {
107 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay 124 ResetProfileSettingsOverlay: ResetProfileSettingsOverlay
108 }; 125 };
109 }); 126 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698