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

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

Issue 7337007: Introduce a field trial for Instant. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Diff against 7396025 Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 const OptionsPage = options.OptionsPage; 6 const OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel; 7 const ArrayDataModel = cr.ui.ArrayDataModel;
8 8
9 // 9 //
10 // BrowserOptions class 10 // BrowserOptions class
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 OptionsPage.navigateToPage('instantConfirm'); 79 OptionsPage.navigateToPage('instantConfirm');
80 } else { 80 } else {
81 chrome.send('disableInstant'); 81 chrome.send('disableInstant');
82 } 82 }
83 return true; 83 return true;
84 }; 84 };
85 85
86 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', 86 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown',
87 this.onInstantConfirmDialogShownChanged_.bind(this)); 87 this.onInstantConfirmDialogShownChanged_.bind(this));
88 88
89 Preferences.getInstance().addEventListener('instant.enabled',
90 this.onInstantEnabledChanged_.bind(this));
91
89 var homepageField = $('homepageURL'); 92 var homepageField = $('homepageURL');
90 $('homepageUseNTPButton').onchange = 93 $('homepageUseNTPButton').onchange =
91 this.handleHomepageUseNTPButtonChange_.bind(this); 94 this.handleHomepageUseNTPButtonChange_.bind(this);
92 $('homepageUseURLButton').onchange = 95 $('homepageUseURLButton').onchange =
93 this.handleHomepageUseURLButtonChange_.bind(this); 96 this.handleHomepageUseURLButtonChange_.bind(this);
94 var homepageChangeHandler = this.handleHomepageURLChange_.bind(this); 97 var homepageChangeHandler = this.handleHomepageURLChange_.bind(this);
95 homepageField.addEventListener('change', homepageChangeHandler); 98 homepageField.addEventListener('change', homepageChangeHandler);
96 homepageField.addEventListener('input', homepageChangeHandler); 99 homepageField.addEventListener('input', homepageChangeHandler);
97 homepageField.addEventListener('focus', function(event) { 100 homepageField.addEventListener('focus', function(event) {
98 self.autocompleteList_.attachToInput(homepageField); 101 self.autocompleteList_.attachToInput(homepageField);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 * Called when the value of the instant.confirm_dialog_shown preference 165 * Called when the value of the instant.confirm_dialog_shown preference
163 * changes. Cache this value. 166 * changes. Cache this value.
164 * @param {Event} event Change event. 167 * @param {Event} event Change event.
165 * @private 168 * @private
166 */ 169 */
167 onInstantConfirmDialogShownChanged_: function(event) { 170 onInstantConfirmDialogShownChanged_: function(event) {
168 this.instantConfirmDialogShown_ = event.value['value']; 171 this.instantConfirmDialogShown_ = event.value['value'];
169 }, 172 },
170 173
171 /** 174 /**
175 * Called when the value of the instant.enabled preference changes. Request
176 * the state of the Instant field trial experiment.
177 * @param {Event} event Change event.
178 * @private
179 */
180 onInstantEnabledChanged_: function(event) {
181 chrome.send('getInstantFieldTrialStatus');
182 },
183
184 /**
185 * Called to set the Instant field trial status.
186 * @param {boolean} enabled If true, the experiment is enabled.
187 * @private
188 */
189 setInstantFieldTrialStatus_: function(enabled) {
190 var experiment_checkbox = $('instantFieldTrialCheckbox');
191 var preference_checkbox = $('instantEnabledCheckbox');
192 if (enabled) {
193 experiment_checkbox.checked = true;
Evan Stade 2011/07/26 00:10:21 this should always start as true. Thus it can be p
sreeram 2011/07/26 02:45:53 Done.
194 experiment_checkbox.style.display = "inline";
195 preference_checkbox.style.display = "none";
Evan Stade 2011/07/26 00:10:21 foo.hidden = true/false
sreeram 2011/07/26 02:45:53 Done.
196 } else {
197 experiment_checkbox.style.display = "none";
198 preference_checkbox.style.display = "inline";
199 }
200 },
201
202 /**
172 * Update the Default Browsers section based on the current state. 203 * Update the Default Browsers section based on the current state.
173 * @param {string} statusString Description of the current default state. 204 * @param {string} statusString Description of the current default state.
174 * @param {boolean} isDefault Whether or not the browser is currently 205 * @param {boolean} isDefault Whether or not the browser is currently
175 * default. 206 * default.
176 * @param {boolean} canBeDefault Whether or not the browser can be default. 207 * @param {boolean} canBeDefault Whether or not the browser can be default.
177 * @private 208 * @private
178 */ 209 */
179 updateDefaultBrowserState_: function(statusString, isDefault, 210 updateDefaultBrowserState_: function(statusString, isDefault,
180 canBeDefault) { 211 canBeDefault) {
181 var label = $('defaultBrowserState'); 212 var label = $('defaultBrowserState');
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 }; 513 };
483 514
484 BrowserOptions.updateStartupPages = function(pages) { 515 BrowserOptions.updateStartupPages = function(pages) {
485 BrowserOptions.getInstance().updateStartupPages_(pages); 516 BrowserOptions.getInstance().updateStartupPages_(pages);
486 }; 517 };
487 518
488 BrowserOptions.updateAutocompleteSuggestions = function(suggestions) { 519 BrowserOptions.updateAutocompleteSuggestions = function(suggestions) {
489 BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions); 520 BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions);
490 }; 521 };
491 522
523 BrowserOptions.setInstantFieldTrialStatus = function(enabled) {
524 BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled);
525 };
526
492 // Export 527 // Export
493 return { 528 return {
494 BrowserOptions: BrowserOptions 529 BrowserOptions: BrowserOptions
495 }; 530 };
496 531
497 }); 532 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698