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

Side by Side Diff: chrome/browser/resources/options2/browser_options.js

Issue 9317114: Settings: Clean up browser_options page according to style guide. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes. Created 8 years, 10 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 | Annotate | Revision Log
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 OptionsPage = options.OptionsPage; 6 var OptionsPage = options.OptionsPage;
7 const ArrayDataModel = cr.ui.ArrayDataModel; 7 var ArrayDataModel = cr.ui.ArrayDataModel;
8 const RepeatingButton = cr.ui.RepeatingButton; 8 var RepeatingButton = cr.ui.RepeatingButton;
9 9
10 // 10 //
11 // BrowserOptions class 11 // BrowserOptions class
12 // Encapsulated handling of browser options page. 12 // Encapsulated handling of browser options page.
13 // 13 //
14 function BrowserOptions() { 14 function BrowserOptions() {
15 OptionsPage.call(this, 'browser', 15 OptionsPage.call(this, 'settings', templateData.settingsTitle,
16 templateData.browserPageTabTitle, 16 'settings');
17 'browserPage');
18 } 17 }
19 18
20 cr.addSingletonGetter(BrowserOptions); 19 cr.addSingletonGetter(BrowserOptions);
21 20
22 BrowserOptions.prototype = { 21 BrowserOptions.prototype = {
23 // Inherit BrowserOptions from OptionsPage.
24 __proto__: options.OptionsPage.prototype, 22 __proto__: options.OptionsPage.prototype,
25 23
26 // State variables. 24 // State variables.
27 syncEnabled: false, 25 syncEnabled: false,
28 syncSetupCompleted: false, 26 syncSetupCompleted: false,
29 27
30 /** 28 /**
31 * An autocomplete list that can be attached to the homepage URL text field 29 * An autocomplete list that can be attached to the homepage URL text field
32 * during editing. 30 * during editing.
33 * @type {HTMLElement} 31 * @type {HTMLElement}
34 * @private 32 * @private
35 */ 33 */
36 autocompleteList_: null, 34 autocompleteList_: null,
37 35
38 // The cached value of the instant.confirm_dialog_shown preference. 36 /**
37 * The cached value of the instant.confirm_dialog_shown preference.
38 * @type {bool}
39 * @private
40 */
39 instantConfirmDialogShown_: false, 41 instantConfirmDialogShown_: false,
40 42
41 /** 43 /**
42 * Initialize BrowserOptions page. 44 * @inheritDoc
43 */ 45 */
44 initializePage: function() { 46 initializePage: function() {
45 // Call base class implementation to start preference initialization.
46 OptionsPage.prototype.initializePage.call(this); 47 OptionsPage.prototype.initializePage.call(this);
47 48
48 var self = this;
49
50 // Sync (Sign in) section. 49 // Sync (Sign in) section.
51 $('sync-action-link').addEventListener('click', function(event) { 50 $('sync-action-link').onclick = function(event) {
52 SyncSetupOverlay.showErrorUI(); 51 SyncSetupOverlay.showErrorUI();
53 }); 52 };
54 $('start-stop-sync').addEventListener('click', function(event) { 53 $('start-stop-sync').onclick = function(event) {
55 if (self.syncSetupCompleted) 54 if (self.syncSetupCompleted)
56 SyncSetupOverlay.showStopSyncingUI(); 55 SyncSetupOverlay.showStopSyncingUI();
57 else 56 else
58 SyncSetupOverlay.showSetupUI(); 57 SyncSetupOverlay.showSetupUI();
59 }); 58 };
60 $('customize-sync').addEventListener('click', function(event) { 59 $('customize-sync').onclick = function(event) {
61 SyncSetupOverlay.showSetupUI(); 60 SyncSetupOverlay.showSetupUI();
62 }); 61 };
63 62
64 // Internet connection section (ChromeOS only). 63 // Internet connection section (ChromeOS only).
65 if (cr.isChromeOS) { 64 if (cr.isChromeOS) {
66 $('internet-options-button').addEventListener('click', function(event) { 65 $('internet-options-button').onclick = function(event) {
67 OptionsPage.navigateToPage('internet'); 66 OptionsPage.navigateToPage('internet');
68 chrome.send('coreOptionsUserMetricsAction', 67 chrome.send('coreOptionsUserMetricsAction',
69 ['Options_InternetOptions']); 68 ['Options_InternetOptions']);
70 }); 69 };
71 } 70 }
72 71
73 // On Startup section. 72 // On Startup section.
74 $('startupSetPages').addEventListener('click', function() { 73 $('startup-set-pages').onclick = function() {
75 OptionsPage.navigateToPage('startup'); 74 OptionsPage.navigateToPage('startup');
76 }); 75 };
77 76
78 // Appearance section. 77 // Appearance section.
79 $('change-home-page').addEventListener('click', function(event) { 78 $('change-home-page').onclick = function(event) {
80 OptionsPage.navigateToPage('homePageOverlay'); 79 OptionsPage.navigateToPage('homePageOverlay');
81 }); 80 };
82 $('themes-gallery').addEventListener('click', function(event) { 81 $('themes-gallery').onclick = function(event) {
83 window.open(localStrings.getString('themesGalleryURL')); 82 window.open(localStrings.getString('themesGalleryURL'));
84 }); 83 };
85 $('themes-reset').addEventListener('click', function(event) { 84 $('themes-reset').onclick = function(event) {
86 chrome.send('themesReset'); 85 chrome.send('themesReset');
87 }); 86 };
88 87
89 // Device section (ChromeOS only). 88 // Device section (ChromeOS only).
90 if (cr.isChromeOS) { 89 if (cr.isChromeOS) {
91 $('keyboard-settings-button').addEventListener('click', function(evt) { 90 $('keyboard-settings-button').onclick = function(evt) {
92 OptionsPage.navigateToPage('keyboard-overlay'); 91 OptionsPage.navigateToPage('keyboard-overlay');
93 }); 92 };
94 $('pointer-settings-button').addEventListener('click', function(evt) { 93 $('pointer-settings-button').onclick = function(evt) {
95 OptionsPage.navigateToPage('pointer-overlay'); 94 OptionsPage.navigateToPage('pointer-overlay');
96 }); 95 };
97 this.initBrightnessButton_('brightness-decrease-button', 96 this.initBrightnessButton_('brightness-decrease-button',
98 'decreaseScreenBrightness'); 97 'decreaseScreenBrightness');
99 this.initBrightnessButton_('brightness-increase-button', 98 this.initBrightnessButton_('brightness-increase-button',
100 'increaseScreenBrightness'); 99 'increaseScreenBrightness');
101 } 100 }
102 101
103 // Search section. 102 // Search section.
104 $('defaultSearchManageEnginesButton').addEventListener('click', 103 $('manage-default-search-engines').onclick = function(event) {
105 function(event) { 104 OptionsPage.navigateToPage('searchEngines');
106 OptionsPage.navigateToPage('searchEngines'); 105 chrome.send('coreOptionsUserMetricsAction',
107 chrome.send('coreOptionsUserMetricsAction', 106 ['Options_ManageSearchEngines']);
108 ['Options_ManageSearchEngines']); 107 };
109 }); 108 $('default-search-engine').addEventListener('change',
110 $('defaultSearchEngine').addEventListener('change',
111 this.setDefaultSearchEngine_); 109 this.setDefaultSearchEngine_);
112 $('instantEnabledCheckbox').customChangeHandler = function(event) { 110 $('instant-enabled-control').customChangeHandler = function(event) {
113 if (this.checked) { 111 if (this.checked) {
114 if (self.instantConfirmDialogShown_) 112 if (self.instantConfirmDialogShown_)
115 chrome.send('enableInstant'); 113 chrome.send('enableInstant');
116 else 114 else
117 OptionsPage.navigateToPage('instantConfirm'); 115 OptionsPage.navigateToPage('instantConfirm');
118 } else { 116 } else {
119 chrome.send('disableInstant'); 117 chrome.send('disableInstant');
120 } 118 }
121 return true; 119 return true;
122 }; 120 };
123 $('instantFieldTrialCheckbox').addEventListener('change', function(evt) { 121 $('instant-field-trial-control').onchange = function(evt) {
124 this.checked = true; 122 this.checked = true;
125 chrome.send('disableInstant'); 123 chrome.send('disableInstant');
126 }); 124 };
127 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown', 125 Preferences.getInstance().addEventListener('instant.confirm_dialog_shown',
128 this.onInstantConfirmDialogShownChanged_.bind(this)); 126 this.onInstantConfirmDialogShownChanged_.bind(this));
129 Preferences.getInstance().addEventListener('instant.enabled', 127 Preferences.getInstance().addEventListener('instant.enabled',
130 this.onInstantEnabledChanged_.bind(this)); 128 this.onInstantEnabledChanged_.bind(this));
131 Preferences.getInstance().addEventListener( 129 Preferences.getInstance().addEventListener(
132 "session.restore_on_startup", 130 "session.restore_on_startup",
133 this.onSessionRestoreSelectedChanged_.bind(this)); 131 this.onSessionRestoreSelectedChanged_.bind(this));
134 Preferences.getInstance().addEventListener( 132 Preferences.getInstance().addEventListener(
135 "restore_session_state.dialog_shown", 133 "restore_session_state.dialog_shown",
136 this.onSessionRestoreDialogShownChanged_.bind(this)); 134 this.onSessionRestoreDialogShownChanged_.bind(this));
137 135
138 // Text fields may change widths when the window changes size, so make 136 // Text fields may change widths when the window changes size, so make
139 // sure the suggestion list stays in sync. 137 // sure the suggestion list stays in sync.
138 var self = this;
140 window.addEventListener('resize', function() { 139 window.addEventListener('resize', function() {
141 self.autocompleteList_.syncWidthToInput(); 140 self.autocompleteList_.syncWidthToInput();
142 }); 141 });
143 142
144 if (cr.commandLine && cr.commandLine.options['--bwsi']) {
145 // Hide the startup section in Guest mode.
146 $('startupSection').hidden = true;
147 }
148
149 var suggestionList = new cr.ui.AutocompleteList(); 143 var suggestionList = new cr.ui.AutocompleteList();
150 suggestionList.autoExpands = true; 144 suggestionList.autoExpands = true;
151 suggestionList.suggestionUpdateRequestCallback = 145 suggestionList.suggestionUpdateRequestCallback =
152 this.requestAutocompleteSuggestions_.bind(this); 146 this.requestAutocompleteSuggestions_.bind(this);
153 $('main-content').appendChild(suggestionList); 147 $('main-content').appendChild(suggestionList);
154 this.autocompleteList_ = suggestionList; 148 this.autocompleteList_ = suggestionList;
155 149
156 // Users section. 150 // Users section.
157 var profilesList = $('profiles-list'); 151 var profilesList = $('profiles-list');
158 options.browser_options.ProfileList.decorate(profilesList); 152 options.browser_options.ProfileList.decorate(profilesList);
159 profilesList.autoExpands = true; 153 profilesList.autoExpands = true;
160 154
161 profilesList.addEventListener('change', 155 profilesList.addEventListener('change',
162 self.setProfileViewButtonsStatus_); 156 this.setProfileViewButtonsStatus_);
163 $('profiles-create').addEventListener('click', function(event) { 157 $('profiles-create').onclick = function(event) {
164 chrome.send('createProfile'); 158 chrome.send('createProfile');
165 }); 159 };
166 $('profiles-manage').addEventListener('click', function(event) { 160 $('profiles-manage').onclick = function(event) {
167 var selectedProfile = self.getSelectedProfileItem_(); 161 var selectedProfile = self.getSelectedProfileItem_();
168 if (selectedProfile) 162 if (selectedProfile)
169 ManageProfileOverlay.showManageDialog(selectedProfile); 163 ManageProfileOverlay.showManageDialog(selectedProfile);
170 }); 164 };
171 $('profiles-delete').addEventListener('click', function(event) { 165 $('profiles-delete').onclick = function(event) {
172 var selectedProfile = self.getSelectedProfileItem_(); 166 var selectedProfile = self.getSelectedProfileItem_();
173 if (selectedProfile) 167 if (selectedProfile)
174 ManageProfileOverlay.showDeleteDialog(selectedProfile); 168 ManageProfileOverlay.showDeleteDialog(selectedProfile);
175 }); 169 };
176 170
177 if (cr.isChromeOS) { 171 if (cr.isChromeOS) {
178 // Username (canonical email) of the currently logged in user or 172 // Username (canonical email) of the currently logged in user or
179 // |kGuestUser| if a guest session is active. 173 // |kGuestUser| if a guest session is active.
180 this.username_ = localStrings.getString('username'); 174 this.username_ = localStrings.getString('username');
181 175
182 $('change-picture-button').addEventListener('click', function(event) { 176 $('change-picture-button').onclick = function(event) {
183 OptionsPage.navigateToPage('changePicture'); 177 OptionsPage.navigateToPage('changePicture');
184 }); 178 };
185 this.updateAccountPicture_(); 179 this.updateAccountPicture_();
186 180
187 if (cr.commandLine && cr.commandLine.options['--bwsi']) { 181 if (cr.commandLine && cr.commandLine.options['--bwsi']) {
188 // Disable the screen lock checkbox and change-picture-button in 182 // Disable the screen lock checkbox and change-picture-button in
189 // guest mode. 183 // guest mode.
190 $('enable-screen-lock').disabled = true; 184 $('enable-screen-lock').disabled = true;
191 $('change-picture-button').disabled = true; 185 $('change-picture-button').disabled = true;
186
187 // Hide the startup section in Guest mode.
188 $('startup-section').hidden = true;
192 } 189 }
193 190
194 $('manage-accounts-button').addEventListener('click', function(event) { 191 $('manage-accounts-button').onclick, function(event) {
195 OptionsPage.navigateToPage('accounts'); 192 OptionsPage.navigateToPage('accounts');
196 chrome.send('coreOptionsUserMetricsAction', 193 chrome.send('coreOptionsUserMetricsAction',
197 ['Options_ManageAccounts']); 194 ['Options_ManageAccounts']);
198 }); 195 };
199 } else { 196 } else {
200 $('import-data').addEventListener('click', function(event) { 197 $('import-data').onclick = function(event) {
201 // Make sure that any previous import success message is hidden, and 198 // Make sure that any previous import success message is hidden, and
202 // we're showing the UI to import further data. 199 // we're showing the UI to import further data.
203 $('import-data-configure').hidden = false; 200 $('import-data-configure').hidden = false;
204 $('import-data-success').hidden = true; 201 $('import-data-success').hidden = true;
205 OptionsPage.navigateToPage('importData'); 202 OptionsPage.navigateToPage('importData');
206 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); 203 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']);
207 }); 204 };
208 205
209 if ($('themes-GTK-button')) { 206 if ($('themes-GTK-button')) {
210 $('themes-GTK-button').addEventListener('click', function(event) { 207 $('themes-GTK-button').onclick = function(event) {
211 chrome.send('themesSetGTK'); 208 chrome.send('themesSetGTK');
212 }); 209 };
213 } 210 }
214 } 211 }
215 212
216 // Default browser section. 213 // Default browser section.
217 if (!cr.isChromeOS) { 214 if (!cr.isChromeOS) {
218 $('defaultBrowserUseAsDefaultButton').addEventListener('click', 215 $('set-as-default-browser').onclick = function(event) {
219 function(event) { 216 chrome.send('becomeDefaultBrowser');
220 chrome.send('becomeDefaultBrowser'); 217 };
221 });
222 } 218 }
223 219
224 // Under the hood section. 220 // Under the hood section.
225 $('advancedOptionsButton').addEventListener('click', function(event) { 221 $('advanced-settings').onclick = function(event) {
226 OptionsPage.navigateToPage('advanced'); 222 OptionsPage.navigateToPage('advanced');
227 chrome.send('coreOptionsUserMetricsAction', 223 chrome.send('coreOptionsUserMetricsAction',
228 ['Options_OpenUnderTheHood']); 224 ['Options_OpenUnderTheHood']);
229 }); 225 };
230 226
231 this.sessionRestoreEnabled_ = templateData.enable_restore_session_state; 227 this.sessionRestoreEnabled_ = templateData.enable_restore_session_state;
232 if (this.sessionRestoreEnabled_) { 228 if (this.sessionRestoreEnabled_) {
233 $('old-startup-last-text').hidden = true; 229 $('old-startup-last-text').hidden = true;
234 $('new-startup-last-text').hidden = false; 230 $('new-startup-last-text').hidden = false;
235 } 231 }
236 }, 232 },
237 233
238 /** 234 /**
239 * Initializes a button for controlling screen brightness. 235 * Initializes a button for controlling screen brightness.
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 onInstantEnabledChanged_: function(event) { 349 onInstantEnabledChanged_: function(event) {
354 chrome.send('getInstantFieldTrialStatus'); 350 chrome.send('getInstantFieldTrialStatus');
355 }, 351 },
356 352
357 /** 353 /**
358 * Called to set the Instant field trial status. 354 * Called to set the Instant field trial status.
359 * @param {boolean} enabled If true, the experiment is enabled. 355 * @param {boolean} enabled If true, the experiment is enabled.
360 * @private 356 * @private
361 */ 357 */
362 setInstantFieldTrialStatus_: function(enabled) { 358 setInstantFieldTrialStatus_: function(enabled) {
363 $('instantEnabledCheckbox').hidden = enabled; 359 $('instant-enabled-control').hidden = enabled;
364 $('instantFieldTrialCheckbox').hidden = !enabled; 360 $('instant-field-trial-control').hidden = !enabled;
365 $('instantLabel').htmlFor = enabled ? 'instantFieldTrialCheckbox' 361 $('instant-label').htmlFor = enabled ? 'instant-field-trial-control'
366 : 'instantEnabledCheckbox'; 362 : 'instant-enabled-control';
367 }, 363 },
368 364
369 onSessionRestoreSelectedChanged_ : function(event) { 365 onSessionRestoreSelectedChanged_ : function(event) {
370 this.sessionRestoreSelected_ = event.value['value'] == 1; 366 this.sessionRestoreSelected_ = event.value['value'] == 1;
371 this.maybeShowSessionRestoreDialog_(); 367 this.maybeShowSessionRestoreDialog_();
372 }, 368 },
373 369
374 onSessionRestoreDialogShownChanged_ : function(event) { 370 onSessionRestoreDialogShownChanged_ : function(event) {
375 this.sessionRestoreDialogShown_ = event.value['value']; 371 this.sessionRestoreDialogShown_ = event.value['value'];
376 this.maybeShowSessionRestoreDialog_(); 372 this.maybeShowSessionRestoreDialog_();
(...skipping 14 matching lines...) Expand all
391 /** 387 /**
392 * Update the Default Browsers section based on the current state. 388 * Update the Default Browsers section based on the current state.
393 * @param {string} statusString Description of the current default state. 389 * @param {string} statusString Description of the current default state.
394 * @param {boolean} isDefault Whether or not the browser is currently 390 * @param {boolean} isDefault Whether or not the browser is currently
395 * default. 391 * default.
396 * @param {boolean} canBeDefault Whether or not the browser can be default. 392 * @param {boolean} canBeDefault Whether or not the browser can be default.
397 * @private 393 * @private
398 */ 394 */
399 updateDefaultBrowserState_: function(statusString, isDefault, 395 updateDefaultBrowserState_: function(statusString, isDefault,
400 canBeDefault) { 396 canBeDefault) {
401 var label = $('defaultBrowserState'); 397 var label = $('default-browser-state');
402 label.textContent = statusString; 398 label.textContent = statusString;
403 399
404 $('defaultBrowserUseAsDefaultButton').hidden = !canBeDefault || isDefault; 400 $('set-as-default-browser').hidden = !canBeDefault || isDefault;
405 }, 401 },
406 402
407 /** 403 /**
408 * Clears the search engine popup. 404 * Clears the search engine popup.
409 * @private 405 * @private
410 */ 406 */
411 clearSearchEngines_: function() { 407 clearSearchEngines_: function() {
412 $('defaultSearchEngine').textContent = ''; 408 $('default-search-engine').textContent = '';
413 }, 409 },
414 410
415 /** 411 /**
416 * Updates the search engine popup with the given entries. 412 * Updates the search engine popup with the given entries.
417 * @param {Array} engines List of available search engines. 413 * @param {Array} engines List of available search engines.
418 * @param {number} defaultValue The value of the current default engine. 414 * @param {number} defaultValue The value of the current default engine.
419 * @param {boolean} defaultManaged Whether the default search provider is 415 * @param {boolean} defaultManaged Whether the default search provider is
420 * managed. If true, the default search provider can't be changed. 416 * managed. If true, the default search provider can't be changed.
421 * @private 417 * @private
422 */ 418 */
423 updateSearchEngines_: function(engines, defaultValue, defaultManaged) { 419 updateSearchEngines_: function(engines, defaultValue, defaultManaged) {
424 this.clearSearchEngines_(); 420 this.clearSearchEngines_();
425 engineSelect = $('defaultSearchEngine'); 421 engineSelect = $('default-search-engine');
426 engineSelect.disabled = defaultManaged; 422 engineSelect.disabled = defaultManaged;
427 engineCount = engines.length; 423 engineCount = engines.length;
428 var defaultIndex = -1; 424 var defaultIndex = -1;
429 for (var i = 0; i < engineCount; i++) { 425 for (var i = 0; i < engineCount; i++) {
430 var engine = engines[i]; 426 var engine = engines[i];
431 var option = new Option(engine['name'], engine['index']); 427 var option = new Option(engine['name'], engine['index']);
432 if (defaultValue == option.value) 428 if (defaultValue == option.value)
433 defaultIndex = i; 429 defaultIndex = i;
434 engineSelect.appendChild(option); 430 engineSelect.appendChild(option);
435 } 431 }
436 if (defaultIndex >= 0) 432 if (defaultIndex >= 0)
437 engineSelect.selectedIndex = defaultIndex; 433 engineSelect.selectedIndex = defaultIndex;
438 }, 434 },
439 435
440 /** 436 /**
441 * Returns true if the custom startup page control block should 437 * Returns true if the custom startup page control block should
442 * be enabled. 438 * be enabled.
443 * @returns {boolean} Whether the startup page controls should be 439 * @returns {boolean} Whether the startup page controls should be
444 * enabled. 440 * enabled.
445 */ 441 */
446 shouldEnableCustomStartupPageControls: function(pages) { 442 shouldEnableCustomStartupPageControls: function(pages) {
447 return $('startupShowPagesButton').checked && 443 return $('startup-show-pages').checked &&
448 !this.startup_pages_pref_.disabled; 444 !this.startup_pages_pref_.disabled;
449 }, 445 },
450 446
451 /** 447 /**
452 * Sets the enabled state of the custom startup page list controls 448 * Sets the enabled state of the custom startup page list controls
453 * based on the current startup radio button selection. 449 * based on the current startup radio button selection.
454 * @private 450 * @private
455 */ 451 */
456 updateCustomStartupPageControlStates_: function() { 452 updateCustomStartupPageControlStates_: function() {
457 var disable = !this.shouldEnableCustomStartupPageControls(); 453 var disable = !this.shouldEnableCustomStartupPageControls();
458 var startupPagesList = $('startupPagesList'); 454 var startupPagesList = $('startupPagesList');
459 startupPagesList.disabled = disable; 455 startupPagesList.disabled = disable;
460 startupPagesList.setAttribute('tabindex', disable ? -1 : 0); 456 startupPagesList.setAttribute('tabindex', disable ? -1 : 0);
461 // Explicitly set disabled state for input text elements. 457 // Explicitly set disabled state for input text elements.
462 var inputs = startupPagesList.querySelectorAll("input[type='text']"); 458 var inputs = startupPagesList.querySelectorAll("input[type='text']");
463 for (var i = 0; i < inputs.length; i++) 459 for (var i = 0; i < inputs.length; i++)
464 inputs[i].disabled = disable; 460 inputs[i].disabled = disable;
465 $('startupUseCurrentButton').disabled = disable; 461 $('startupUseCurrentButton').disabled = disable;
466 }, 462 },
467 463
468 /** 464 /**
469 * Set the default search engine based on the popup selection. 465 * Set the default search engine based on the popup selection.
470 * @private 466 * @private
471 */ 467 */
472 setDefaultSearchEngine_: function() { 468 setDefaultSearchEngine_: function() {
473 var engineSelect = $('defaultSearchEngine'); 469 var engineSelect = $('default-search-engine');
474 var selectedIndex = engineSelect.selectedIndex; 470 var selectedIndex = engineSelect.selectedIndex;
475 if (selectedIndex >= 0) { 471 if (selectedIndex >= 0) {
476 var selection = engineSelect.options[selectedIndex]; 472 var selection = engineSelect.options[selectedIndex];
477 chrome.send('setDefaultSearchEngine', [String(selection.value)]); 473 chrome.send('setDefaultSearchEngine', [String(selection.value)]);
478 } 474 }
479 }, 475 },
480 476
481 /** 477 /**
482 * Sends an asynchronous request for new autocompletion suggestions for the 478 * Sends an asynchronous request for new autocompletion suggestions for the
483 * the given query. When new suggestions are available, the C++ handler will 479 * the given query. When new suggestions are available, the C++ handler will
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 */ 567 */
572 setProfilesInfo_: function(profiles) { 568 setProfilesInfo_: function(profiles) {
573 this.setProfileViewSingle_(profiles.length); 569 this.setProfileViewSingle_(profiles.length);
574 // add it to the list, even if the list is hidden so we can access it 570 // add it to the list, even if the list is hidden so we can access it
575 // later. 571 // later.
576 $('profiles-list').dataModel = new ArrayDataModel(profiles); 572 $('profiles-list').dataModel = new ArrayDataModel(profiles);
577 this.setProfileViewButtonsStatus_(); 573 this.setProfileViewButtonsStatus_();
578 }, 574 },
579 575
580 setGtkThemeButtonEnabled_: function(enabled) { 576 setGtkThemeButtonEnabled_: function(enabled) {
581 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { 577 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i))
582 $('themes-GTK-button').disabled = !enabled; 578 $('themes-GTK-button').disabled = !enabled;
583 }
584 }, 579 },
585 580
586 setThemesResetButtonEnabled_: function(enabled) { 581 setThemesResetButtonEnabled_: function(enabled) {
587 $('themes-reset').disabled = !enabled; 582 $('themes-reset').disabled = !enabled;
588 }, 583 },
589 584
590 /** 585 /**
591 * (Re)loads IMG element with current user account picture. 586 * (Re)loads IMG element with current user account picture.
587 * @private
592 */ 588 */
593 updateAccountPicture_: function() { 589 updateAccountPicture_: function() {
594 var picture = $('account-picture'); 590 var picture = $('account-picture');
595 if (picture) { 591 if (picture) {
596 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + 592 picture.src = 'chrome://userimage/' + this.username_ + '?id=' +
597 Date.now(); 593 Date.now();
598 } 594 }
599 }, 595 },
600 }; 596 };
601 597
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 // TODO(jhawkins): Investigate the use case for this method. 644 // TODO(jhawkins): Investigate the use case for this method.
649 BrowserOptions.getLoggedInUsername = function() { 645 BrowserOptions.getLoggedInUsername = function() {
650 return BrowserOptions.getInstance().username_; 646 return BrowserOptions.getInstance().username_;
651 }; 647 };
652 } 648 }
653 649
654 // Export 650 // Export
655 return { 651 return {
656 BrowserOptions: BrowserOptions 652 BrowserOptions: BrowserOptions
657 }; 653 };
658
659 }); 654 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698