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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/resources/options/startup_page_manager.html ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 cr.define('options', function() {
6 const OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel;
8 const ListSelectionModel = cr.ui.ListSelectionModel;
9
10 /**
11 * Encapsulated handling of startup page management page.
12 * @constructor
13 */
14 function StartupPageManager() {
15 this.activeNavTab = null;
16 OptionsPage.call(this, 'startupPages',
17 templateData.StartupPageManagerPage,
18 'startupPageManagerPage');
19 }
20
21 cr.addSingletonGetter(StartupPageManager);
22
23 StartupPageManager.prototype = {
24 __proto__: OptionsPage.prototype,
25 list_: null,
26
27 initializePage: function() {
28 OptionsPage.prototype.initializePage.call(this);
29
30 var list = $('startupPagesFullList');
31 options.browser_options.StartupPageList.decorate(list);
32 list.autoExpands = true;
33 list.selectionModel = new ListSelectionModel;
34
35 list.selectionModel.addEventListener(
36 'change', this.updateRemoveButtonState_.bind(this));
37
38 // Wire up controls.
39 $('startupAddButton').onclick = function(event) {
40 OptionsPage.showOverlay('addStartupPageOverlay');
41 };
42 $('startupRemoveButton').onclick =
43 this.removeSelectedStartupPages_.bind(this);
44
45 // Remove Windows-style accelerators from button labels.
46 // TODO(stuartmorgan): Remove this once the strings are updated.
47 $('startupAddButton').textContent =
48 localStrings.getStringWithoutAccelerator('startupAddButton');
49 $('startupRemoveButton').textContent =
50 localStrings.getStringWithoutAccelerator('startupRemoveButton');
51 },
52
53 /**
54 * Updates the startup pages list with the given entries.
55 * @param {Array} pages List of startup pages.
56 * @private
57 */
58 updateStartupPages_: function(pages) {
59 $('startupPagesFullList').dataModel = new ArrayDataModel(pages);
60 this.updateRemoveButtonState_();
61 },
62
63 /**
64 * Sets the enabled state of the startup page Remove button based on
65 * the current selection in the startup pages list.
66 * @private
67 */
68 updateRemoveButtonState_: function() {
69 $('startupRemoveButton').disabled =
70 $('startupPagesFullList').selectionModel.selectedIndex == -1;
71 },
72
73 /**
74 * Removes the selected startup pages.
75 * @private
76 */
77 removeSelectedStartupPages_: function() {
78 var selections =
79 $('startupPagesFullList').selectionModel.selectedIndexes.map(String);
80 chrome.send('removeStartupPages', selections);
81 },
82 };
83
84 StartupPageManager.updateStartupPages = function(pages) {
85 StartupPageManager.getInstance().updateStartupPages_(pages);
86 };
87
88 // Export
89 return {
90 StartupPageManager: StartupPageManager
91 };
92
93 });
94
OLDNEW
« 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