Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 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 const RepeatingButton = cr.ui.RepeatingButton; | 8 const RepeatingButton = cr.ui.RepeatingButton; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 206 }); | 206 }); |
| 207 } | 207 } |
| 208 } | 208 } |
| 209 | 209 |
| 210 // Default browser section. | 210 // Default browser section. |
| 211 if (!cr.isChromeOS) { | 211 if (!cr.isChromeOS) { |
| 212 $('defaultBrowserUseAsDefaultButton').addEventListener('click', | 212 $('defaultBrowserUseAsDefaultButton').addEventListener('click', |
| 213 function(event) { | 213 function(event) { |
| 214 chrome.send('becomeDefaultBrowser'); | 214 chrome.send('becomeDefaultBrowser'); |
| 215 }); | 215 }); |
| 216 | |
| 217 $('autoLaunch').addEventListener('click', | |
|
James Hawkins
2012/02/06 21:08:01
nit: Use $('xx').onclick = this.handle...
| |
| 218 this.handleAutoLaunchChanged_); | |
| 216 } | 219 } |
| 217 | 220 |
| 218 // Under the hood section. | 221 // Under the hood section. |
| 219 $('advancedOptionsButton').addEventListener('click', function(event) { | 222 $('advancedOptionsButton').addEventListener('click', function(event) { |
| 220 OptionsPage.navigateToPage('advanced'); | 223 OptionsPage.navigateToPage('advanced'); |
| 221 chrome.send('coreOptionsUserMetricsAction', | 224 chrome.send('coreOptionsUserMetricsAction', |
| 222 ['Options_OpenUnderTheHood']); | 225 ['Options_OpenUnderTheHood']); |
| 223 }); | 226 }); |
| 224 }, | 227 }, |
| 225 | 228 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 /** | 319 /** |
| 317 * Sets the label for the 'Show Home page' input. | 320 * Sets the label for the 'Show Home page' input. |
| 318 * @param {string} label The HTML of the input label. | 321 * @param {string} label The HTML of the input label. |
| 319 * @private | 322 * @private |
| 320 */ | 323 */ |
| 321 updateHomePageLabel_: function(label) { | 324 updateHomePageLabel_: function(label) { |
| 322 $('home-page-label').innerHTML = label; | 325 $('home-page-label').innerHTML = label; |
| 323 }, | 326 }, |
| 324 | 327 |
| 325 /** | 328 /** |
| 329 * Shows the autoLaunch preference and initializes its checkbox value. | |
| 330 * @param {bool} enabled Whether autolaunch is enabled or or not. | |
| 331 * @private | |
| 332 */ | |
| 333 updateAutoLaunchState_: function(enabled) { | |
| 334 $('autoLaunchOption').hidden = false; | |
| 335 $('autoLaunch').checked = enabled; | |
| 336 }, | |
| 337 | |
| 338 /** | |
| 326 * Called when the value of the instant.confirm_dialog_shown preference | 339 * Called when the value of the instant.confirm_dialog_shown preference |
| 327 * changes. Cache this value. | 340 * changes. Cache this value. |
| 328 * @param {Event} event Change event. | 341 * @param {Event} event Change event. |
| 329 * @private | 342 * @private |
| 330 */ | 343 */ |
| 331 onInstantConfirmDialogShownChanged_: function(event) { | 344 onInstantConfirmDialogShownChanged_: function(event) { |
| 332 this.instantConfirmDialogShown_ = event.value['value']; | 345 this.instantConfirmDialogShown_ = event.value['value']; |
| 333 }, | 346 }, |
| 334 | 347 |
| 335 /** | 348 /** |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 438 setDefaultSearchEngine_: function() { | 451 setDefaultSearchEngine_: function() { |
| 439 var engineSelect = $('defaultSearchEngine'); | 452 var engineSelect = $('defaultSearchEngine'); |
| 440 var selectedIndex = engineSelect.selectedIndex; | 453 var selectedIndex = engineSelect.selectedIndex; |
| 441 if (selectedIndex >= 0) { | 454 if (selectedIndex >= 0) { |
| 442 var selection = engineSelect.options[selectedIndex]; | 455 var selection = engineSelect.options[selectedIndex]; |
| 443 chrome.send('setDefaultSearchEngine', [String(selection.value)]); | 456 chrome.send('setDefaultSearchEngine', [String(selection.value)]); |
| 444 } | 457 } |
| 445 }, | 458 }, |
| 446 | 459 |
| 447 /** | 460 /** |
| 461 * Sets or clear whether Chrome should Auto-launch on computer startup. | |
|
James Hawkins
2012/02/06 21:08:01
@private
| |
| 462 */ | |
| 463 handleAutoLaunchChanged_: function() { | |
| 464 chrome.send('toggleAutoLaunch', [Boolean($('autoLaunch').checked)]); | |
|
James Hawkins
2012/02/06 21:08:01
Correct me if I'm wrong, but I don't think you nee
| |
| 465 }, | |
| 466 | |
| 467 /** | |
| 448 * Sends an asynchronous request for new autocompletion suggestions for the | 468 * Sends an asynchronous request for new autocompletion suggestions for the |
| 449 * the given query. When new suggestions are available, the C++ handler will | 469 * the given query. When new suggestions are available, the C++ handler will |
| 450 * call updateAutocompleteSuggestions_. | 470 * call updateAutocompleteSuggestions_. |
| 451 * @param {string} query List of autocomplete suggestions. | 471 * @param {string} query List of autocomplete suggestions. |
| 452 * @private | 472 * @private |
| 453 */ | 473 */ |
| 454 requestAutocompleteSuggestions_: function(query) { | 474 requestAutocompleteSuggestions_: function(query) { |
| 455 chrome.send('requestAutocompleteSuggestions', [query]); | 475 chrome.send('requestAutocompleteSuggestions', [query]); |
| 456 }, | 476 }, |
| 457 | 477 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 580 'setStartStopButtonVisible', | 600 'setStartStopButtonVisible', |
| 581 'setSyncActionLinkEnabled', | 601 'setSyncActionLinkEnabled', |
| 582 'setSyncActionLinkLabel', | 602 'setSyncActionLinkLabel', |
| 583 'setSyncEnabled', | 603 'setSyncEnabled', |
| 584 'setSyncSetupCompleted', | 604 'setSyncSetupCompleted', |
| 585 'setSyncStatus', | 605 'setSyncStatus', |
| 586 'setSyncStatusErrorVisible', | 606 'setSyncStatusErrorVisible', |
| 587 'setThemesResetButtonEnabled', | 607 'setThemesResetButtonEnabled', |
| 588 'updateAccountPicture', | 608 'updateAccountPicture', |
| 589 'updateAutocompleteSuggestions', | 609 'updateAutocompleteSuggestions', |
| 610 'updateAutoLaunchState', | |
| 590 'updateHomePageLabel', | 611 'updateHomePageLabel', |
| 591 'updateSearchEngines', | 612 'updateSearchEngines', |
| 592 'updateStartupPages', | 613 'updateStartupPages', |
| 593 ].forEach(function(name) { | 614 ].forEach(function(name) { |
| 594 BrowserOptions[name] = function() { | 615 BrowserOptions[name] = function() { |
| 595 var instance = BrowserOptions.getInstance(); | 616 var instance = BrowserOptions.getInstance(); |
| 596 return instance[name + '_'].apply(instance, arguments); | 617 return instance[name + '_'].apply(instance, arguments); |
| 597 }; | 618 }; |
| 598 }); | 619 }); |
| 599 | 620 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 616 return BrowserOptions.getInstance().username_; | 637 return BrowserOptions.getInstance().username_; |
| 617 }; | 638 }; |
| 618 } | 639 } |
| 619 | 640 |
| 620 // Export | 641 // Export |
| 621 return { | 642 return { |
| 622 BrowserOptions: BrowserOptions | 643 BrowserOptions: BrowserOptions |
| 623 }; | 644 }; |
| 624 | 645 |
| 625 }); | 646 }); |
| OLD | NEW |