| 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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 var RepeatingButton = cr.ui.RepeatingButton; | 8 var RepeatingButton = cr.ui.RepeatingButton; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 chrome.send('themesSetGTK'); | 208 chrome.send('themesSetGTK'); |
| 209 }; | 209 }; |
| 210 } | 210 } |
| 211 } | 211 } |
| 212 | 212 |
| 213 // Default browser section. | 213 // Default browser section. |
| 214 if (!cr.isChromeOS) { | 214 if (!cr.isChromeOS) { |
| 215 $('set-as-default-browser').onclick = function(event) { | 215 $('set-as-default-browser').onclick = function(event) { |
| 216 chrome.send('becomeDefaultBrowser'); | 216 chrome.send('becomeDefaultBrowser'); |
| 217 }; | 217 }; |
| 218 |
| 219 $('auto-launch').onclick = this.handleAutoLaunchChanged_; |
| 218 } | 220 } |
| 219 | 221 |
| 220 // Under the hood section. | 222 // Under the hood section. |
| 221 $('advanced-settings').onclick = function(event) { | 223 $('advanced-settings').onclick = function(event) { |
| 222 OptionsPage.navigateToPage('advanced'); | 224 OptionsPage.navigateToPage('advanced'); |
| 223 chrome.send('coreOptionsUserMetricsAction', | 225 chrome.send('coreOptionsUserMetricsAction', |
| 224 ['Options_OpenUnderTheHood']); | 226 ['Options_OpenUnderTheHood']); |
| 225 }; | 227 }; |
| 226 | 228 |
| 227 this.sessionRestoreEnabled_ = templateData.enable_restore_session_state; | 229 this.sessionRestoreEnabled_ = templateData.enable_restore_session_state; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 /** | 326 /** |
| 325 * Sets the label for the 'Show Home page' input. | 327 * Sets the label for the 'Show Home page' input. |
| 326 * @param {string} label The HTML of the input label. | 328 * @param {string} label The HTML of the input label. |
| 327 * @private | 329 * @private |
| 328 */ | 330 */ |
| 329 updateHomePageLabel_: function(label) { | 331 updateHomePageLabel_: function(label) { |
| 330 $('home-page-label').innerHTML = label; | 332 $('home-page-label').innerHTML = label; |
| 331 }, | 333 }, |
| 332 | 334 |
| 333 /** | 335 /** |
| 336 * Shows the autoLaunch preference and initializes its checkbox value. |
| 337 * @param {bool} enabled Whether autolaunch is enabled or or not. |
| 338 * @private |
| 339 */ |
| 340 updateAutoLaunchState_: function(enabled) { |
| 341 $('auto-launch-option').hidden = false; |
| 342 $('auto-launch').checked = enabled; |
| 343 }, |
| 344 |
| 345 /** |
| 334 * Called when the value of the instant.confirm_dialog_shown preference | 346 * Called when the value of the instant.confirm_dialog_shown preference |
| 335 * changes. Cache this value. | 347 * changes. Cache this value. |
| 336 * @param {Event} event Change event. | 348 * @param {Event} event Change event. |
| 337 * @private | 349 * @private |
| 338 */ | 350 */ |
| 339 onInstantConfirmDialogShownChanged_: function(event) { | 351 onInstantConfirmDialogShownChanged_: function(event) { |
| 340 this.instantConfirmDialogShown_ = event.value['value']; | 352 this.instantConfirmDialogShown_ = event.value['value']; |
| 341 }, | 353 }, |
| 342 | 354 |
| 343 /** | 355 /** |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 setDefaultSearchEngine_: function() { | 480 setDefaultSearchEngine_: function() { |
| 469 var engineSelect = $('default-search-engine'); | 481 var engineSelect = $('default-search-engine'); |
| 470 var selectedIndex = engineSelect.selectedIndex; | 482 var selectedIndex = engineSelect.selectedIndex; |
| 471 if (selectedIndex >= 0) { | 483 if (selectedIndex >= 0) { |
| 472 var selection = engineSelect.options[selectedIndex]; | 484 var selection = engineSelect.options[selectedIndex]; |
| 473 chrome.send('setDefaultSearchEngine', [String(selection.value)]); | 485 chrome.send('setDefaultSearchEngine', [String(selection.value)]); |
| 474 } | 486 } |
| 475 }, | 487 }, |
| 476 | 488 |
| 477 /** | 489 /** |
| 490 * Sets or clear whether Chrome should Auto-launch on computer startup. |
| 491 * @private |
| 492 */ |
| 493 handleAutoLaunchChanged_: function() { |
| 494 chrome.send('toggleAutoLaunch', [$('auto-launch').checked]); |
| 495 }, |
| 496 |
| 497 /** |
| 478 * Sends an asynchronous request for new autocompletion suggestions for the | 498 * Sends an asynchronous request for new autocompletion suggestions for the |
| 479 * the given query. When new suggestions are available, the C++ handler will | 499 * the given query. When new suggestions are available, the C++ handler will |
| 480 * call updateAutocompleteSuggestions_. | 500 * call updateAutocompleteSuggestions_. |
| 481 * @param {string} query List of autocomplete suggestions. | 501 * @param {string} query List of autocomplete suggestions. |
| 482 * @private | 502 * @private |
| 483 */ | 503 */ |
| 484 requestAutocompleteSuggestions_: function(query) { | 504 requestAutocompleteSuggestions_: function(query) { |
| 485 chrome.send('requestAutocompleteSuggestions', [query]); | 505 chrome.send('requestAutocompleteSuggestions', [query]); |
| 486 }, | 506 }, |
| 487 | 507 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 'setStartStopButtonVisible', | 630 'setStartStopButtonVisible', |
| 611 'setSyncActionLinkEnabled', | 631 'setSyncActionLinkEnabled', |
| 612 'setSyncActionLinkLabel', | 632 'setSyncActionLinkLabel', |
| 613 'setSyncEnabled', | 633 'setSyncEnabled', |
| 614 'setSyncSetupCompleted', | 634 'setSyncSetupCompleted', |
| 615 'setSyncStatus', | 635 'setSyncStatus', |
| 616 'setSyncStatusErrorVisible', | 636 'setSyncStatusErrorVisible', |
| 617 'setThemesResetButtonEnabled', | 637 'setThemesResetButtonEnabled', |
| 618 'updateAccountPicture', | 638 'updateAccountPicture', |
| 619 'updateAutocompleteSuggestions', | 639 'updateAutocompleteSuggestions', |
| 640 'updateAutoLaunchState', |
| 620 'updateHomePageLabel', | 641 'updateHomePageLabel', |
| 621 'updateSearchEngines', | 642 'updateSearchEngines', |
| 622 'updateStartupPages', | 643 'updateStartupPages', |
| 623 ].forEach(function(name) { | 644 ].forEach(function(name) { |
| 624 BrowserOptions[name] = function() { | 645 BrowserOptions[name] = function() { |
| 625 var instance = BrowserOptions.getInstance(); | 646 var instance = BrowserOptions.getInstance(); |
| 626 return instance[name + '_'].apply(instance, arguments); | 647 return instance[name + '_'].apply(instance, arguments); |
| 627 }; | 648 }; |
| 628 }); | 649 }); |
| 629 | 650 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 645 BrowserOptions.getLoggedInUsername = function() { | 666 BrowserOptions.getLoggedInUsername = function() { |
| 646 return BrowserOptions.getInstance().username_; | 667 return BrowserOptions.getInstance().username_; |
| 647 }; | 668 }; |
| 648 } | 669 } |
| 649 | 670 |
| 650 // Export | 671 // Export |
| 651 return { | 672 return { |
| 652 BrowserOptions: BrowserOptions | 673 BrowserOptions: BrowserOptions |
| 653 }; | 674 }; |
| 654 }); | 675 }); |
| OLD | NEW |