| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 ListSelectionModel = cr.ui.ListSelectionModel; | 8 const ListSelectionModel = cr.ui.ListSelectionModel; |
| 9 | 9 |
| 10 // | 10 // |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 * @private | 346 * @private |
| 347 */ | 347 */ |
| 348 updateCustomStartupPageControlStates_: function() { | 348 updateCustomStartupPageControlStates_: function() { |
| 349 var disable = !this.shouldEnableCustomStartupPageControls_(); | 349 var disable = !this.shouldEnableCustomStartupPageControls_(); |
| 350 $('startupPagesShortList').disabled = disable; | 350 $('startupPagesShortList').disabled = disable; |
| 351 $('startupUseCurrentButton').disabled = disable; | 351 $('startupUseCurrentButton').disabled = disable; |
| 352 $('startupPageManagerButton').disabled = disable; | 352 $('startupPageManagerButton').disabled = disable; |
| 353 }, | 353 }, |
| 354 | 354 |
| 355 /** | 355 /** |
| 356 * Removes the selected startup pages. | |
| 357 * @private | |
| 358 */ | |
| 359 removeSelectedStartupPages_: function() { | |
| 360 var selections = | |
| 361 $('startupPagesShortList').selectionModel.selectedIndexes.map(String); | |
| 362 chrome.send('removeStartupPages', selections); | |
| 363 }, | |
| 364 | |
| 365 /** | |
| 366 * Adds the given startup page at the current selection point. | |
| 367 * @private | |
| 368 */ | |
| 369 addStartupPage_: function(url) { | |
| 370 var firstSelection = | |
| 371 $('startupPagesShortList').selectionModel.selectedIndex; | |
| 372 chrome.send('addStartupPage', [url, String(firstSelection)]); | |
| 373 }, | |
| 374 | |
| 375 /** | |
| 376 * Set the default search engine based on the popup selection. | 356 * Set the default search engine based on the popup selection. |
| 377 */ | 357 */ |
| 378 setDefaultSearchEngine: function() { | 358 setDefaultSearchEngine: function() { |
| 379 var engineSelect = $('defaultSearchEngine'); | 359 var engineSelect = $('defaultSearchEngine'); |
| 380 var selectedIndex = engineSelect.selectedIndex; | 360 var selectedIndex = engineSelect.selectedIndex; |
| 381 if (selectedIndex >= 0) { | 361 if (selectedIndex >= 0) { |
| 382 var selection = engineSelect.options[selectedIndex]; | 362 var selection = engineSelect.options[selectedIndex]; |
| 383 chrome.send('setDefaultSearchEngine', [String(selection.value)]); | 363 chrome.send('setDefaultSearchEngine', [String(selection.value)]); |
| 384 } | 364 } |
| 385 }, | 365 }, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 396 | 376 |
| 397 BrowserOptions.updateSearchEngines = function(engines, defaultValue) { | 377 BrowserOptions.updateSearchEngines = function(engines, defaultValue) { |
| 398 BrowserOptions.getInstance().updateSearchEngines_(engines, defaultValue); | 378 BrowserOptions.getInstance().updateSearchEngines_(engines, defaultValue); |
| 399 }; | 379 }; |
| 400 | 380 |
| 401 BrowserOptions.updateStartupPages = function(pages) { | 381 BrowserOptions.updateStartupPages = function(pages) { |
| 402 BrowserOptions.getInstance().updateStartupPages_(pages); | 382 BrowserOptions.getInstance().updateStartupPages_(pages); |
| 403 StartupPageManager.getInstance().updateStartupPages_(pages); | 383 StartupPageManager.getInstance().updateStartupPages_(pages); |
| 404 }; | 384 }; |
| 405 | 385 |
| 406 BrowserOptions.addStartupPage = function(url) { | |
| 407 BrowserOptions.getInstance().addStartupPage_(url); | |
| 408 }; | |
| 409 | |
| 410 // Export | 386 // Export |
| 411 return { | 387 return { |
| 412 BrowserOptions: BrowserOptions | 388 BrowserOptions: BrowserOptions |
| 413 }; | 389 }; |
| 414 | 390 |
| 415 }); | 391 }); |
| OLD | NEW |