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

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: 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;
csilv 2012/02/07 00:56:57 it's const better for these?
csilv 2012/02/07 00:58:05 of course, i meant to say "isn't const better for
James Hawkins 2012/02/07 01:28:00 No, const is not valid JS and V8 is slower when co
Dan Beam 2012/02/07 09:33:53 We're not using ES5-strict any where options2, so
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 $('defaultSearchManageEnginesButton').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 129
132 // Text fields may change widths when the window changes size, so make 130 // Text fields may change widths when the window changes size, so make
133 // sure the suggestion list stays in sync. 131 // sure the suggestion list stays in sync.
132 var self = this;
134 window.addEventListener('resize', function() { 133 window.addEventListener('resize', function() {
135 self.autocompleteList_.syncWidthToInput(); 134 self.autocompleteList_.syncWidthToInput();
136 }); 135 });
137 136
138 if (cr.commandLine && cr.commandLine.options['--bwsi']) {
139 // Hide the startup section in Guest mode.
140 $('startupSection').hidden = true;
141 }
142
143 var suggestionList = new cr.ui.AutocompleteList(); 137 var suggestionList = new cr.ui.AutocompleteList();
144 suggestionList.autoExpands = true; 138 suggestionList.autoExpands = true;
145 suggestionList.suggestionUpdateRequestCallback = 139 suggestionList.suggestionUpdateRequestCallback =
146 this.requestAutocompleteSuggestions_.bind(this); 140 this.requestAutocompleteSuggestions_.bind(this);
147 $('main-content').appendChild(suggestionList); 141 $('main-content').appendChild(suggestionList);
148 this.autocompleteList_ = suggestionList; 142 this.autocompleteList_ = suggestionList;
149 143
150 // Users section. 144 // Users section.
151 var profilesList = $('profiles-list'); 145 var profilesList = $('profiles-list');
152 options.browser_options.ProfileList.decorate(profilesList); 146 options.browser_options.ProfileList.decorate(profilesList);
153 profilesList.autoExpands = true; 147 profilesList.autoExpands = true;
154 148
155 profilesList.addEventListener('change', 149 profilesList.addEventListener('change',
156 self.setProfileViewButtonsStatus_); 150 this.setProfileViewButtonsStatus_);
157 $('profiles-create').addEventListener('click', function(event) { 151 $('profiles-create').onclick = function(event) {
158 chrome.send('createProfile'); 152 chrome.send('createProfile');
159 }); 153 };
160 $('profiles-manage').addEventListener('click', function(event) { 154 $('profiles-manage').onclick = function(event) {
161 var selectedProfile = self.getSelectedProfileItem_(); 155 var selectedProfile = self.getSelectedProfileItem_();
162 if (selectedProfile) 156 if (selectedProfile)
163 ManageProfileOverlay.showManageDialog(selectedProfile); 157 ManageProfileOverlay.showManageDialog(selectedProfile);
164 }); 158 };
165 $('profiles-delete').addEventListener('click', function(event) { 159 $('profiles-delete').onclick = function(event) {
166 var selectedProfile = self.getSelectedProfileItem_(); 160 var selectedProfile = self.getSelectedProfileItem_();
167 if (selectedProfile) 161 if (selectedProfile)
168 ManageProfileOverlay.showDeleteDialog(selectedProfile); 162 ManageProfileOverlay.showDeleteDialog(selectedProfile);
169 }); 163 };
170 164
171 if (cr.isChromeOS) { 165 if (cr.isChromeOS) {
172 // Username (canonical email) of the currently logged in user or 166 // Username (canonical email) of the currently logged in user or
173 // |kGuestUser| if a guest session is active. 167 // |kGuestUser| if a guest session is active.
174 this.username_ = localStrings.getString('username'); 168 this.username_ = localStrings.getString('username');
175 169
176 $('change-picture-button').addEventListener('click', function(event) { 170 $('change-picture-button').onclick = function(event) {
177 OptionsPage.navigateToPage('changePicture'); 171 OptionsPage.navigateToPage('changePicture');
178 }); 172 };
179 this.updateAccountPicture_(); 173 this.updateAccountPicture_();
180 174
181 if (cr.commandLine && cr.commandLine.options['--bwsi']) { 175 if (cr.commandLine && cr.commandLine.options['--bwsi']) {
182 // Disable the screen lock checkbox and change-picture-button in 176 // Disable the screen lock checkbox and change-picture-button in
183 // guest mode. 177 // guest mode.
184 $('enable-screen-lock').disabled = true; 178 $('enable-screen-lock').disabled = true;
185 $('change-picture-button').disabled = true; 179 $('change-picture-button').disabled = true;
180
181 // Hide the startup section in Guest mode.
182 $('startup-section').hidden = true;
186 } 183 }
187 184
188 $('manage-accounts-button').addEventListener('click', function(event) { 185 $('manage-accounts-button').onclick, function(event) {
189 OptionsPage.navigateToPage('accounts'); 186 OptionsPage.navigateToPage('accounts');
190 chrome.send('coreOptionsUserMetricsAction', 187 chrome.send('coreOptionsUserMetricsAction',
191 ['Options_ManageAccounts']); 188 ['Options_ManageAccounts']);
192 }); 189 };
193 } else { 190 } else {
194 $('import-data').addEventListener('click', function(event) { 191 $('import-data').onclick = function(event) {
195 // Make sure that any previous import success message is hidden, and 192 // Make sure that any previous import success message is hidden, and
196 // we're showing the UI to import further data. 193 // we're showing the UI to import further data.
197 $('import-data-configure').hidden = false; 194 $('import-data-configure').hidden = false;
198 $('import-data-success').hidden = true; 195 $('import-data-success').hidden = true;
199 OptionsPage.navigateToPage('importData'); 196 OptionsPage.navigateToPage('importData');
200 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']); 197 chrome.send('coreOptionsUserMetricsAction', ['Import_ShowDlg']);
201 }); 198 };
202 199
203 if ($('themes-GTK-button')) { 200 if ($('themes-GTK-button')) {
204 $('themes-GTK-button').addEventListener('click', function(event) { 201 $('themes-GTK-button').onclick = function(event) {
205 chrome.send('themesSetGTK'); 202 chrome.send('themesSetGTK');
206 }); 203 };
207 } 204 }
208 } 205 }
209 206
210 // Default browser section. 207 // Default browser section.
211 if (!cr.isChromeOS) { 208 if (!cr.isChromeOS) {
212 $('defaultBrowserUseAsDefaultButton').addEventListener('click', 209 $('set-as-default-browser').onclick = function(event) {
213 function(event) { 210 chrome.send('becomeDefaultBrowser');
214 chrome.send('becomeDefaultBrowser'); 211 };
215 });
216 } 212 }
217 213
218 // Under the hood section. 214 // Under the hood section.
219 $('advancedOptionsButton').addEventListener('click', function(event) { 215 $('advanced-settings').onclick = function(event) {
220 OptionsPage.navigateToPage('advanced'); 216 OptionsPage.navigateToPage('advanced');
221 chrome.send('coreOptionsUserMetricsAction', 217 chrome.send('coreOptionsUserMetricsAction',
222 ['Options_OpenUnderTheHood']); 218 ['Options_OpenUnderTheHood']);
223 }); 219 };
224 }, 220 },
225 221
226 /** 222 /**
227 * Initializes a button for controlling screen brightness. 223 * Initializes a button for controlling screen brightness.
228 * @param {string} id Button ID. 224 * @param {string} id Button ID.
229 * @param {string} callback Name of the callback function. 225 * @param {string} callback Name of the callback function.
230 */ 226 */
231 initBrightnessButton_: function(id, callback) { 227 initBrightnessButton_: function(id, callback) {
232 var button = $(id); 228 var button = $(id);
233 cr.ui.decorate(button, RepeatingButton); 229 cr.ui.decorate(button, RepeatingButton);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 onInstantEnabledChanged_: function(event) { 337 onInstantEnabledChanged_: function(event) {
342 chrome.send('getInstantFieldTrialStatus'); 338 chrome.send('getInstantFieldTrialStatus');
343 }, 339 },
344 340
345 /** 341 /**
346 * Called to set the Instant field trial status. 342 * Called to set the Instant field trial status.
347 * @param {boolean} enabled If true, the experiment is enabled. 343 * @param {boolean} enabled If true, the experiment is enabled.
348 * @private 344 * @private
349 */ 345 */
350 setInstantFieldTrialStatus_: function(enabled) { 346 setInstantFieldTrialStatus_: function(enabled) {
351 $('instantEnabledCheckbox').hidden = enabled; 347 $('instant-enabled-control').hidden = enabled;
352 $('instantFieldTrialCheckbox').hidden = !enabled; 348 $('instant-field-trial-control').hidden = !enabled;
353 $('instantLabel').htmlFor = enabled ? 'instantFieldTrialCheckbox' 349 $('instant-label').htmlFor = enabled ? 'instant-field-trial-control'
354 : 'instantEnabledCheckbox'; 350 : 'instant-enabled-control';
355 }, 351 },
356 352
357 /** 353 /**
358 * Update the Default Browsers section based on the current state. 354 * Update the Default Browsers section based on the current state.
359 * @param {string} statusString Description of the current default state. 355 * @param {string} statusString Description of the current default state.
360 * @param {boolean} isDefault Whether or not the browser is currently 356 * @param {boolean} isDefault Whether or not the browser is currently
361 * default. 357 * default.
362 * @param {boolean} canBeDefault Whether or not the browser can be default. 358 * @param {boolean} canBeDefault Whether or not the browser can be default.
363 * @private 359 * @private
364 */ 360 */
365 updateDefaultBrowserState_: function(statusString, isDefault, 361 updateDefaultBrowserState_: function(statusString, isDefault,
366 canBeDefault) { 362 canBeDefault) {
367 var label = $('defaultBrowserState'); 363 var label = $('default-browser-state');
368 label.textContent = statusString; 364 label.textContent = statusString;
369 365
370 $('defaultBrowserUseAsDefaultButton').hidden = !canBeDefault || isDefault; 366 $('set-as-default-browser').hidden = !canBeDefault || isDefault;
371 }, 367 },
372 368
373 /** 369 /**
374 * Clears the search engine popup. 370 * Clears the search engine popup.
375 * @private 371 * @private
376 */ 372 */
377 clearSearchEngines_: function() { 373 clearSearchEngines_: function() {
378 $('defaultSearchEngine').textContent = ''; 374 $('default-search-engine').textContent = '';
379 }, 375 },
380 376
381 /** 377 /**
382 * Updates the search engine popup with the given entries. 378 * Updates the search engine popup with the given entries.
383 * @param {Array} engines List of available search engines. 379 * @param {Array} engines List of available search engines.
384 * @param {number} defaultValue The value of the current default engine. 380 * @param {number} defaultValue The value of the current default engine.
385 * @param {boolean} defaultManaged Whether the default search provider is 381 * @param {boolean} defaultManaged Whether the default search provider is
386 * managed. If true, the default search provider can't be changed. 382 * managed. If true, the default search provider can't be changed.
387 * @private 383 * @private
388 */ 384 */
389 updateSearchEngines_: function(engines, defaultValue, defaultManaged) { 385 updateSearchEngines_: function(engines, defaultValue, defaultManaged) {
390 this.clearSearchEngines_(); 386 this.clearSearchEngines_();
391 engineSelect = $('defaultSearchEngine'); 387 engineSelect = $('default-search-engine');
392 engineSelect.disabled = defaultManaged; 388 engineSelect.disabled = defaultManaged;
393 engineCount = engines.length; 389 engineCount = engines.length;
394 var defaultIndex = -1; 390 var defaultIndex = -1;
395 for (var i = 0; i < engineCount; i++) { 391 for (var i = 0; i < engineCount; i++) {
396 var engine = engines[i]; 392 var engine = engines[i];
397 var option = new Option(engine['name'], engine['index']); 393 var option = new Option(engine['name'], engine['index']);
398 if (defaultValue == option.value) 394 if (defaultValue == option.value)
399 defaultIndex = i; 395 defaultIndex = i;
400 engineSelect.appendChild(option); 396 engineSelect.appendChild(option);
401 } 397 }
402 if (defaultIndex >= 0) 398 if (defaultIndex >= 0)
403 engineSelect.selectedIndex = defaultIndex; 399 engineSelect.selectedIndex = defaultIndex;
404 }, 400 },
405 401
406 /** 402 /**
407 * Returns true if the custom startup page control block should 403 * Returns true if the custom startup page control block should
408 * be enabled. 404 * be enabled.
409 * @returns {boolean} Whether the startup page controls should be 405 * @returns {boolean} Whether the startup page controls should be
410 * enabled. 406 * enabled.
411 */ 407 */
412 shouldEnableCustomStartupPageControls: function(pages) { 408 shouldEnableCustomStartupPageControls: function(pages) {
413 return $('startupShowPagesButton').checked && 409 return $('startup-show-pages').checked &&
414 !this.startup_pages_pref_.disabled; 410 !this.startup_pages_pref_.disabled;
415 }, 411 },
416 412
417 /** 413 /**
418 * Sets the enabled state of the custom startup page list controls 414 * Sets the enabled state of the custom startup page list controls
419 * based on the current startup radio button selection. 415 * based on the current startup radio button selection.
420 * @private 416 * @private
421 */ 417 */
422 updateCustomStartupPageControlStates_: function() { 418 updateCustomStartupPageControlStates_: function() {
423 var disable = !this.shouldEnableCustomStartupPageControls(); 419 var disable = !this.shouldEnableCustomStartupPageControls();
424 var startupPagesList = $('startupPagesList'); 420 var startupPagesList = $('startupPagesList');
425 startupPagesList.disabled = disable; 421 startupPagesList.disabled = disable;
426 startupPagesList.setAttribute('tabindex', disable ? -1 : 0); 422 startupPagesList.setAttribute('tabindex', disable ? -1 : 0);
427 // Explicitly set disabled state for input text elements. 423 // Explicitly set disabled state for input text elements.
428 var inputs = startupPagesList.querySelectorAll("input[type='text']"); 424 var inputs = startupPagesList.querySelectorAll("input[type='text']");
429 for (var i = 0; i < inputs.length; i++) 425 for (var i = 0; i < inputs.length; i++)
430 inputs[i].disabled = disable; 426 inputs[i].disabled = disable;
431 $('startupUseCurrentButton').disabled = disable; 427 $('startupUseCurrentButton').disabled = disable;
432 }, 428 },
433 429
434 /** 430 /**
435 * Set the default search engine based on the popup selection. 431 * Set the default search engine based on the popup selection.
436 * @private 432 * @private
437 */ 433 */
438 setDefaultSearchEngine_: function() { 434 setDefaultSearchEngine_: function() {
439 var engineSelect = $('defaultSearchEngine'); 435 var engineSelect = $('default-search-engine');
440 var selectedIndex = engineSelect.selectedIndex; 436 var selectedIndex = engineSelect.selectedIndex;
441 if (selectedIndex >= 0) { 437 if (selectedIndex >= 0) {
442 var selection = engineSelect.options[selectedIndex]; 438 var selection = engineSelect.options[selectedIndex];
443 chrome.send('setDefaultSearchEngine', [String(selection.value)]); 439 chrome.send('setDefaultSearchEngine', [String(selection.value)]);
444 } 440 }
445 }, 441 },
446 442
447 /** 443 /**
448 * Sends an asynchronous request for new autocompletion suggestions for the 444 * Sends an asynchronous request for new autocompletion suggestions for the
449 * the given query. When new suggestions are available, the C++ handler will 445 * the given query. When new suggestions are available, the C++ handler will
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
537 */ 533 */
538 setProfilesInfo_: function(profiles) { 534 setProfilesInfo_: function(profiles) {
539 this.setProfileViewSingle_(profiles.length); 535 this.setProfileViewSingle_(profiles.length);
540 // add it to the list, even if the list is hidden so we can access it 536 // add it to the list, even if the list is hidden so we can access it
541 // later. 537 // later.
542 $('profiles-list').dataModel = new ArrayDataModel(profiles); 538 $('profiles-list').dataModel = new ArrayDataModel(profiles);
543 this.setProfileViewButtonsStatus_(); 539 this.setProfileViewButtonsStatus_();
544 }, 540 },
545 541
546 setGtkThemeButtonEnabled_: function(enabled) { 542 setGtkThemeButtonEnabled_: function(enabled) {
547 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) { 543 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i))
548 $('themes-GTK-button').disabled = !enabled; 544 $('themes-GTK-button').disabled = !enabled;
549 }
550 }, 545 },
551 546
552 setThemesResetButtonEnabled_: function(enabled) { 547 setThemesResetButtonEnabled_: function(enabled) {
553 $('themes-reset').disabled = !enabled; 548 $('themes-reset').disabled = !enabled;
554 }, 549 },
555 550
556 /** 551 /**
557 * (Re)loads IMG element with current user account picture. 552 * (Re)loads IMG element with current user account picture.
553 * @private
558 */ 554 */
559 updateAccountPicture_: function() { 555 updateAccountPicture_: function() {
560 var picture = $('account-picture'); 556 var picture = $('account-picture');
561 if (picture) { 557 if (picture) {
562 picture.src = 'chrome://userimage/' + this.username_ + '?id=' + 558 picture.src = 'chrome://userimage/' + this.username_ + '?id=' +
563 Date.now(); 559 Date.now();
564 } 560 }
565 }, 561 },
566 }; 562 };
567 563
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 // TODO(jhawkins): Investigate the use case for this method. 610 // TODO(jhawkins): Investigate the use case for this method.
615 BrowserOptions.getLoggedInUsername = function() { 611 BrowserOptions.getLoggedInUsername = function() {
616 return BrowserOptions.getInstance().username_; 612 return BrowserOptions.getInstance().username_;
617 }; 613 };
618 } 614 }
619 615
620 // Export 616 // Export
621 return { 617 return {
622 BrowserOptions: BrowserOptions 618 BrowserOptions: BrowserOptions
623 }; 619 };
624
625 }); 620 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698