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

Unified Diff: chrome/browser/resources/options/startup_page_manager.js

Issue 5685003: DOMUI Prefs: Add a deletable item list type, and use it for startup pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nits fixed Created 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/options/startup_page_manager.js
diff --git a/chrome/browser/resources/options/startup_page_manager.js b/chrome/browser/resources/options/startup_page_manager.js
index 54e1148def2ddab06cfea9405c1c85777fe436f5..56771f85d0b4103a9e88485d253a5a17ca792647 100644
--- a/chrome/browser/resources/options/startup_page_manager.js
+++ b/chrome/browser/resources/options/startup_page_manager.js
@@ -32,22 +32,15 @@ cr.define('options', function() {
list.autoExpands = true;
list.selectionModel = new ListSelectionModel;
- list.selectionModel.addEventListener(
- 'change', this.updateRemoveButtonState_.bind(this));
-
// Wire up controls.
$('startupAddButton').onclick = function(event) {
OptionsPage.showOverlay('addStartupPageOverlay');
};
- $('startupRemoveButton').onclick =
- this.removeSelectedStartupPages_.bind(this);
// Remove Windows-style accelerators from button labels.
// TODO(stuartmorgan): Remove this once the strings are updated.
$('startupAddButton').textContent =
localStrings.getStringWithoutAccelerator('startupAddButton');
- $('startupRemoveButton').textContent =
- localStrings.getStringWithoutAccelerator('startupRemoveButton');
},
/**
@@ -57,27 +50,16 @@ cr.define('options', function() {
*/
updateStartupPages_: function(pages) {
$('startupPagesFullList').dataModel = new ArrayDataModel(pages);
- this.updateRemoveButtonState_();
- },
-
- /**
- * Sets the enabled state of the startup page Remove button based on
- * the current selection in the startup pages list.
- * @private
- */
- updateRemoveButtonState_: function() {
- $('startupRemoveButton').disabled =
- $('startupPagesFullList').selectionModel.selectedIndex == -1;
},
/**
- * Removes the selected startup pages.
+ * Adds the given startup page at the current selection point.
* @private
*/
- removeSelectedStartupPages_: function() {
- var selections =
- $('startupPagesFullList').selectionModel.selectedIndexes.map(String);
- chrome.send('removeStartupPages', selections);
+ addStartupPage_: function(url) {
+ var firstSelection =
+ $('startupPagesFullList').selectionModel.selectedIndex;
+ chrome.send('addStartupPage', [url, String(firstSelection)]);
},
};
@@ -85,6 +67,10 @@ cr.define('options', function() {
StartupPageManager.getInstance().updateStartupPages_(pages);
};
+ StartupPageManager.addStartupPage = function(url) {
+ StartupPageManager.getInstance().addStartupPage_(url);
+ };
+
// Export
return {
StartupPageManager: StartupPageManager
« no previous file with comments | « chrome/browser/resources/options/startup_page_manager.html ('k') | chrome/browser/resources/shared/js/cr/ui/list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698