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

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

Issue 8729009: Implement an AutoLaunch experiment for Chrome for certain brand codes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 // Ensure that changes are committed when closing the page. 106 // Ensure that changes are committed when closing the page.
107 window.addEventListener('unload', function() { 107 window.addEventListener('unload', function() {
108 if (document.activeElement == homepageField) 108 if (document.activeElement == homepageField)
109 homepageField.blur(); 109 homepageField.blur();
110 }); 110 });
111 111
112 if (!cr.isChromeOS) { 112 if (!cr.isChromeOS) {
113 $('defaultBrowserUseAsDefaultButton').onclick = function(event) { 113 $('defaultBrowserUseAsDefaultButton').onclick = function(event) {
114 chrome.send('becomeDefaultBrowser'); 114 chrome.send('becomeDefaultBrowser');
115 }; 115 };
116
117 $('autoLaunch').addEventListener('click',
118 this.handleAutoLaunchChanged_);
116 } 119 }
117 120
118 var startupPagesList = $('startupPagesList'); 121 var startupPagesList = $('startupPagesList');
119 options.browser_options.StartupPageList.decorate(startupPagesList); 122 options.browser_options.StartupPageList.decorate(startupPagesList);
120 startupPagesList.autoExpands = true; 123 startupPagesList.autoExpands = true;
121 124
122 // Check if we are in the guest mode. 125 // Check if we are in the guest mode.
123 if (cr.commandLine.options['--bwsi']) { 126 if (cr.commandLine.options['--bwsi']) {
124 // Hide the startup section. 127 // Hide the startup section.
125 $('startupSection').hidden = true; 128 $('startupSection').hidden = true;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 setDefaultSearchEngine_: function() { 300 setDefaultSearchEngine_: function() {
298 var engineSelect = $('defaultSearchEngine'); 301 var engineSelect = $('defaultSearchEngine');
299 var selectedIndex = engineSelect.selectedIndex; 302 var selectedIndex = engineSelect.selectedIndex;
300 if (selectedIndex >= 0) { 303 if (selectedIndex >= 0) {
301 var selection = engineSelect.options[selectedIndex]; 304 var selection = engineSelect.options[selectedIndex];
302 chrome.send('setDefaultSearchEngine', [String(selection.value)]); 305 chrome.send('setDefaultSearchEngine', [String(selection.value)]);
303 } 306 }
304 }, 307 },
305 308
306 /** 309 /**
310 * Set or clear whether Chrome should Auto-launch on computer startup.
stuartmorgan 2011/12/01 10:11:44 s/Set/Sets/ (the previous two functions are incorr
311 */
312 handleAutoLaunchChanged_: function() {
313 chrome.send('toggleAutoLaunch', [Boolean($('autoLaunch').checked)]);
314 },
315
316 /**
307 * Sends an asynchronous request for new autocompletion suggestions for the 317 * Sends an asynchronous request for new autocompletion suggestions for the
308 * the given query. When new suggestions are available, the C++ handler will 318 * the given query. When new suggestions are available, the C++ handler will
309 * call updateAutocompleteSuggestions_. 319 * call updateAutocompleteSuggestions_.
310 * @param {string} query List of autocomplete suggestions. 320 * @param {string} query List of autocomplete suggestions.
311 * @private 321 * @private
312 */ 322 */
313 requestAutocompleteSuggestions_: function(query) { 323 requestAutocompleteSuggestions_: function(query) {
314 chrome.send('requestAutocompleteSuggestions', [query]); 324 chrome.send('requestAutocompleteSuggestions', [query]);
315 }, 325 },
316 326
317 /** 327 /**
318 * Updates the autocomplete suggestion list with the given entries. 328 * Updates the autocomplete suggestion list with the given entries.
319 * @param {Array} pages List of autocomplete suggestions. 329 * @param {Array} pages List of autocomplete suggestions.
320 * @private 330 * @private
321 */ 331 */
322 updateAutocompleteSuggestions_: function(suggestions) { 332 updateAutocompleteSuggestions_: function(suggestions) {
323 var list = this.autocompleteList_; 333 var list = this.autocompleteList_;
324 // If the trigger for this update was a value being selected from the 334 // If the trigger for this update was a value being selected from the
325 // current list, do nothing. 335 // current list, do nothing.
326 if (list.targetInput && list.selectedItem && 336 if (list.targetInput && list.selectedItem &&
327 list.selectedItem['url'] == list.targetInput.value) 337 list.selectedItem['url'] == list.targetInput.value)
328 return; 338 return;
329 list.suggestions = suggestions; 339 list.suggestions = suggestions;
330 }, 340 },
341
342 /**
343 * A handler for the C++ code to call us and and let us know whether the
344 * auto-launch option should be visible and what its value should be.
stuartmorgan 2011/12/01 10:11:44 This comment doesn't match the implementation. If
345 */
346 updateAutoLaunchState_: function(enabled) {
347 $('autoLaunchOption').hidden = false;
348 $('autoLaunch').checked = enabled;
349 },
331 }; 350 };
332 351
333 BrowserOptions.updateDefaultBrowserState = function(statusString, isDefault, 352 BrowserOptions.updateDefaultBrowserState = function(statusString, isDefault,
334 canBeDefault) { 353 canBeDefault) {
335 if (!cr.isChromeOS) { 354 if (!cr.isChromeOS) {
336 BrowserOptions.getInstance().updateDefaultBrowserState_(statusString, 355 BrowserOptions.getInstance().updateDefaultBrowserState_(statusString,
337 isDefault, 356 isDefault,
338 canBeDefault); 357 canBeDefault);
339 } 358 }
340 }; 359 };
341 360
342 BrowserOptions.updateSearchEngines = function(engines, defaultValue, 361 BrowserOptions.updateSearchEngines = function(engines, defaultValue,
343 defaultManaged) { 362 defaultManaged) {
344 BrowserOptions.getInstance().updateSearchEngines_(engines, defaultValue, 363 BrowserOptions.getInstance().updateSearchEngines_(engines, defaultValue,
345 defaultManaged); 364 defaultManaged);
346 }; 365 };
347 366
348 BrowserOptions.updateStartupPages = function(pages) { 367 BrowserOptions.updateStartupPages = function(pages) {
349 BrowserOptions.getInstance().updateStartupPages_(pages); 368 BrowserOptions.getInstance().updateStartupPages_(pages);
350 }; 369 };
351 370
352 BrowserOptions.updateAutocompleteSuggestions = function(suggestions) { 371 BrowserOptions.updateAutocompleteSuggestions = function(suggestions) {
353 BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions); 372 BrowserOptions.getInstance().updateAutocompleteSuggestions_(suggestions);
354 }; 373 };
355 374
375 BrowserOptions.updateAutoLaunchState = function(enabled) {
376 BrowserOptions.getInstance().updateAutoLaunchState_(enabled);
377 };
378
356 BrowserOptions.setInstantFieldTrialStatus = function(enabled) { 379 BrowserOptions.setInstantFieldTrialStatus = function(enabled) {
357 BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled); 380 BrowserOptions.getInstance().setInstantFieldTrialStatus_(enabled);
358 }; 381 };
359 382
360 // Export 383 // Export
361 return { 384 return {
362 BrowserOptions: BrowserOptions 385 BrowserOptions: BrowserOptions
363 }; 386 };
364 387
365 }); 388 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698