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

Side by Side Diff: chrome/browser/resources/flags.js

Issue 12276012: Add reset all button to flags page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use ResetAllFlags throughout Created 7 years, 10 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
« no previous file with comments | « chrome/browser/resources/flags.html ('k') | chrome/browser/ui/webui/flags_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 * This variable structure is here to document the structure that the template 6 * This variable structure is here to document the structure that the template
7 * expects to correctly populate the page. 7 * expects to correctly populate the page.
8 */ 8 */
9 9
10 /** 10 /**
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 elements[i].onclick = function() { 42 elements[i].onclick = function() {
43 handleEnableExperiment(this, true); 43 handleEnableExperiment(this, true);
44 return false; 44 return false;
45 }; 45 };
46 } 46 }
47 47
48 elements = document.getElementsByClassName('experiment-restart-button'); 48 elements = document.getElementsByClassName('experiment-restart-button');
49 for (var i = 0; i < elements.length; ++i) { 49 for (var i = 0; i < elements.length; ++i) {
50 elements[i].onclick = restartBrowser; 50 elements[i].onclick = restartBrowser;
51 } 51 }
52
53 $('experiment-reset-all').onclick = resetAllFlags;
52 } 54 }
53 55
54 /** 56 /**
55 * Asks the C++ FlagsDOMHandler to get details about the available experiments 57 * Asks the C++ FlagsDOMHandler to get details about the available experiments
56 * and return detailed data about the configuration. The FlagsDOMHandler 58 * and return detailed data about the configuration. The FlagsDOMHandler
57 * should reply to returnFlagsExperiments() (below). 59 * should reply to returnFlagsExperiments() (below).
58 */ 60 */
59 function requestFlagsExperimentsData() { 61 function requestFlagsExperimentsData() {
60 chrome.send('requestFlagsExperiments'); 62 chrome.send('requestFlagsExperiments');
61 } 63 }
62 64
63 /** 65 /**
64 * Asks the C++ FlagsDOMHandler to restart the browser (restoring tabs). 66 * Asks the C++ FlagsDOMHandler to restart the browser (restoring tabs).
65 */ 67 */
66 function restartBrowser() { 68 function restartBrowser() {
67 chrome.send('restartBrowser'); 69 chrome.send('restartBrowser');
68 } 70 }
69 71
70 /** 72 /**
73 * Reset all flags to their default values and refresh the UI.
74 */
75 function resetAllFlags() {
76 // Asks the C++ FlagsDOMHandler to reset all flags to default values.
77 chrome.send('resetAllFlags');
78 requestFlagsExperimentsData();
79 }
80
81 /**
71 * Called by the WebUI to re-populate the page with data representing the 82 * Called by the WebUI to re-populate the page with data representing the
72 * current state of installed experiments. 83 * current state of installed experiments.
73 * @param {Object} flagsExperimentsData Information about available experiments 84 * @param {Object} flagsExperimentsData Information about available experiments
74 * in the following format: 85 * in the following format:
75 * { 86 * {
76 * flagsExperiments: [ 87 * flagsExperiments: [
77 * { 88 * {
78 * internal_name: 'Experiment ID string', 89 * internal_name: 'Experiment ID string',
79 * name: 'Experiment Name', 90 * name: 'Experiment Name',
80 * description: 'description', 91 * description: 'description',
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 function handleSelectChoiceExperiment(node, index) { 136 function handleSelectChoiceExperiment(node, index) {
126 // Tell the C++ FlagsDOMHandler to enable the selected choice. 137 // Tell the C++ FlagsDOMHandler to enable the selected choice.
127 chrome.send('enableFlagsExperiment', 138 chrome.send('enableFlagsExperiment',
128 [String(node.internal_name) + '@' + index, 'true']); 139 [String(node.internal_name) + '@' + index, 'true']);
129 requestFlagsExperimentsData(); 140 requestFlagsExperimentsData();
130 } 141 }
131 142
132 // Get data and have it displayed upon loading. 143 // Get data and have it displayed upon loading.
133 document.addEventListener('DOMContentLoaded', requestFlagsExperimentsData); 144 document.addEventListener('DOMContentLoaded', requestFlagsExperimentsData);
134 145
OLDNEW
« no previous file with comments | « chrome/browser/resources/flags.html ('k') | chrome/browser/ui/webui/flags_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698