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