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

Side by Side Diff: chrome/browser/resources/options/startup_overlay.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 months 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 */ var ArrayDataModel = cr.ui.ArrayDataModel; 6 /** @const */ var ArrayDataModel = cr.ui.ArrayDataModel;
7 /** @const */ var SettingsDialog = options.SettingsDialog; 7 /** @const */ var SettingsDialog = options.SettingsDialog;
8 8
9 /** 9 /**
10 * StartupOverlay class 10 * StartupOverlay class
11 * Encapsulated handling of the 'Set Startup pages' overlay page. 11 * Encapsulated handling of the 'Set Startup pages' overlay page.
12 * @constructor 12 * @constructor
13 * @extends {options.SettingsDialog} 13 * @extends {options.SettingsDialog}
14 */ 14 */
15 function StartupOverlay() { 15 function StartupOverlay() {
16 SettingsDialog.call(this, 'startup', 16 SettingsDialog.call(
17 loadTimeData.getString('startupPagesOverlayTabTitle'), 17 this, 'startup', loadTimeData.getString('startupPagesOverlayTabTitle'),
18 'startup-overlay', 18 'startup-overlay',
19 assertInstanceof($('startup-overlay-confirm'), HTMLButtonElement), 19 assertInstanceof($('startup-overlay-confirm'), HTMLButtonElement),
20 assertInstanceof($('startup-overlay-cancel'), HTMLButtonElement)); 20 assertInstanceof($('startup-overlay-cancel'), HTMLButtonElement));
21 } 21 }
22 22
23 cr.addSingletonGetter(StartupOverlay); 23 cr.addSingletonGetter(StartupOverlay);
24 24
25 StartupOverlay.prototype = { 25 StartupOverlay.prototype = {
26 __proto__: SettingsDialog.prototype, 26 __proto__: SettingsDialog.prototype,
27 27
28 /** 28 /**
29 * An autocomplete list that can be attached to a text field during editing. 29 * An autocomplete list that can be attached to a text field during editing.
30 * @type {HTMLElement} 30 * @type {HTMLElement}
31 * @private 31 * @private
32 */ 32 */
33 autocompleteList_: null, 33 autocompleteList_: null,
34 34
35 startup_pages_pref_: { 35 startup_pages_pref_: {'name': 'session.startup_urls', 'disabled': false},
36 'name': 'session.startup_urls',
37 'disabled': false
38 },
39 36
40 /** @override */ 37 /** @override */
41 initializePage: function() { 38 initializePage: function() {
42 SettingsDialog.prototype.initializePage.call(this); 39 SettingsDialog.prototype.initializePage.call(this);
43 40
44 var self = this; 41 var self = this;
45 42
46 var startupPagesList = $('startupPagesList'); 43 var startupPagesList = $('startupPagesList');
47 options.browser_options.StartupPageList.decorate(startupPagesList); 44 options.browser_options.StartupPageList.decorate(startupPagesList);
48 startupPagesList.autoExpands = true; 45 startupPagesList.autoExpands = true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 }, 77 },
81 78
82 /** 79 /**
83 * Sets the enabled state of the custom startup page list 80 * Sets the enabled state of the custom startup page list
84 * @param {boolean} disable True to disable, false to enable 81 * @param {boolean} disable True to disable, false to enable
85 */ 82 */
86 setControlsDisabled: function(disable) { 83 setControlsDisabled: function(disable) {
87 var startupPagesList = $('startupPagesList'); 84 var startupPagesList = $('startupPagesList');
88 startupPagesList.disabled = disable; 85 startupPagesList.disabled = disable;
89 // Explicitly set disabled state for input text elements. 86 // Explicitly set disabled state for input text elements.
90 var inputs = startupPagesList.querySelectorAll("input[type='text']"); 87 var inputs = startupPagesList.querySelectorAll('input[type=\'text\']');
91 for (var i = 0; i < inputs.length; i++) 88 for (var i = 0; i < inputs.length; i++)
92 inputs[i].disabled = disable; 89 inputs[i].disabled = disable;
93 $('startupUseCurrentButton').disabled = disable; 90 $('startupUseCurrentButton').disabled = disable;
94 }, 91 },
95 92
96 /** 93 /**
97 * Enables or disables the the custom startup page list controls 94 * Enables or disables the the custom startup page list controls
98 * based on the whether the 'pages to restore on startup' pref is enabled. 95 * based on the whether the 'pages to restore on startup' pref is enabled.
99 */ 96 */
100 updateControlStates: function() { 97 updateControlStates: function() {
101 this.setControlsDisabled( 98 this.setControlsDisabled(this.startup_pages_pref_.disabled);
102 this.startup_pages_pref_.disabled);
103 }, 99 },
104 100
105 /** 101 /**
106 * Handles change events of the preference 102 * Handles change events of the preference
107 * 'session.startup_urls'. 103 * 'session.startup_urls'.
108 * @param {Event} event Preference changed event. 104 * @param {Event} event Preference changed event.
109 * @private 105 * @private
110 */ 106 */
111 handleStartupPageListChange_: function(event) { 107 handleStartupPageListChange_: function(event) {
112 this.startup_pages_pref_.disabled = event.value.disabled; 108 this.startup_pages_pref_.disabled = event.value.disabled;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 }, 149 },
154 }; 150 };
155 151
156 // Forward public APIs to private implementations. 152 // Forward public APIs to private implementations.
157 cr.makePublic(StartupOverlay, [ 153 cr.makePublic(StartupOverlay, [
158 'updateStartupPages', 154 'updateStartupPages',
159 'updateAutocompleteSuggestions', 155 'updateAutocompleteSuggestions',
160 ]); 156 ]);
161 157
162 // Export 158 // Export
163 return { 159 return {StartupOverlay: StartupOverlay};
164 StartupOverlay: StartupOverlay
165 };
166 }); 160 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698