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

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

Issue 5594006: DOMUI Prefs: Add a subpage for startup page management. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-add changes lost during merge to trunk 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
« no previous file with comments | « chrome/browser/resources/options/startup_page_manager.html ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..54e1148def2ddab06cfea9405c1c85777fe436f5
--- /dev/null
+++ b/chrome/browser/resources/options/startup_page_manager.js
@@ -0,0 +1,94 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+cr.define('options', function() {
+ const OptionsPage = options.OptionsPage;
+ const ArrayDataModel = cr.ui.ArrayDataModel;
+ const ListSelectionModel = cr.ui.ListSelectionModel;
+
+ /**
+ * Encapsulated handling of startup page management page.
+ * @constructor
+ */
+ function StartupPageManager() {
+ this.activeNavTab = null;
+ OptionsPage.call(this, 'startupPages',
+ templateData.StartupPageManagerPage,
+ 'startupPageManagerPage');
+ }
+
+ cr.addSingletonGetter(StartupPageManager);
+
+ StartupPageManager.prototype = {
+ __proto__: OptionsPage.prototype,
+ list_: null,
+
+ initializePage: function() {
+ OptionsPage.prototype.initializePage.call(this);
+
+ var list = $('startupPagesFullList');
+ options.browser_options.StartupPageList.decorate(list);
+ 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');
+ },
+
+ /**
+ * Updates the startup pages list with the given entries.
+ * @param {Array} pages List of startup pages.
+ * @private
+ */
+ 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.
+ * @private
+ */
+ removeSelectedStartupPages_: function() {
+ var selections =
+ $('startupPagesFullList').selectionModel.selectedIndexes.map(String);
+ chrome.send('removeStartupPages', selections);
+ },
+ };
+
+ StartupPageManager.updateStartupPages = function(pages) {
+ StartupPageManager.getInstance().updateStartupPages_(pages);
+ };
+
+ // Export
+ return {
+ StartupPageManager: StartupPageManager
+ };
+
+});
+
« no previous file with comments | « chrome/browser/resources/options/startup_page_manager.html ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698