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

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

Issue 8773046: [cros] Display emails of users are stored in a separate dictionary in Local State. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 6
7 var OptionsPage = options.OptionsPage; 7 var OptionsPage = options.OptionsPage;
8 var ArrayDataModel = cr.ui.ArrayDataModel; 8 var ArrayDataModel = cr.ui.ArrayDataModel;
9 9
10 /** 10 /**
11 * Encapsulated handling of personal options page. 11 * Encapsulated handling of personal options page.
12 * @constructor 12 * @constructor
13 */ 13 */
14 function PersonalOptions() { 14 function PersonalOptions() {
15 OptionsPage.call(this, 'personal', 15 OptionsPage.call(this, 'personal',
16 templateData.personalPageTabTitle, 16 templateData.personalPageTabTitle,
17 'personal-page'); 17 'personal-page');
18 if (cr.isChromeOS) { 18 if (cr.isChromeOS) {
19 // Email of the currently logged in user (or |kGuestUser|). 19 // Username (canonical email) of the currently logged in user or
20 this.userEmail_ = localStrings.getString('userEmail'); 20 // |kGuestUser| if a guest session is active.
21 this.username_ = localStrings.getString('username');
21 } 22 }
22 } 23 }
23 24
24 cr.addSingletonGetter(PersonalOptions); 25 cr.addSingletonGetter(PersonalOptions);
25 26
26 PersonalOptions.prototype = { 27 PersonalOptions.prototype = {
27 // Inherit PersonalOptions from OptionsPage. 28 // Inherit PersonalOptions from OptionsPage.
28 __proto__: options.OptionsPage.prototype, 29 __proto__: options.OptionsPage.prototype,
29 30
30 // State variables. 31 // State variables.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 */ 299 */
299 getStartStopSyncButton_: function() { 300 getStartStopSyncButton_: function() {
300 return $('start-stop-sync'); 301 return $('start-stop-sync');
301 }, 302 },
302 303
303 /** 304 /**
304 * (Re)loads IMG element with current user account picture. 305 * (Re)loads IMG element with current user account picture.
305 */ 306 */
306 updateAccountPicture_: function() { 307 updateAccountPicture_: function() {
307 $('account-picture').src = 308 $('account-picture').src =
308 'chrome://userimage/' + this.userEmail_ + 309 'chrome://userimage/' + this.username_ +
309 '?id=' + (new Date()).getTime(); 310 '?id=' + (new Date()).getTime();
310 }, 311 },
311 }; 312 };
312 313
313 /** 314 /**
314 * Returns whether the user should be able to manage (view and edit) their 315 * Returns whether the user should be able to manage (view and edit) their
315 * stored passwords. Password management is disabled in guest mode. 316 * stored passwords. Password management is disabled in guest mode.
316 * @return {boolean} True if password management should be disabled. 317 * @return {boolean} True if password management should be disabled.
317 */ 318 */
318 PersonalOptions.disablePasswordManagement = function() { 319 PersonalOptions.disablePasswordManagement = function() {
319 return cr.commandLine.options['--bwsi']; 320 return cr.commandLine.options['--bwsi'];
320 }; 321 };
321 322
322 /** 323 /**
323 * Returns whether the user should be able to manage autofill settings. 324 * Returns whether the user should be able to manage autofill settings.
324 * @return {boolean} True if password management should be disabled. 325 * @return {boolean} True if password management should be disabled.
325 */ 326 */
326 PersonalOptions.disableAutofillManagement = function() { 327 PersonalOptions.disableAutofillManagement = function() {
327 return cr.commandLine.options['--bwsi']; 328 return cr.commandLine.options['--bwsi'];
328 }; 329 };
329 330
330 if (cr.isChromeOS) { 331 if (cr.isChromeOS) {
331 /** 332 /**
332 * Returns email of the user logged in (ChromeOS only). 333 * Returns username (canonical email) of the user logged in (ChromeOS only).
333 * @return {string} user email. 334 * @return {string} user email.
334 */ 335 */
335 PersonalOptions.getLoggedInUserEmail = function() { 336 PersonalOptions.getLoggedInUsername = function() {
336 return PersonalOptions.getInstance().userEmail_; 337 return PersonalOptions.getInstance().username_;
337 }; 338 };
338 } 339 }
339 340
340 // Forward public APIs to private implementations. 341 // Forward public APIs to private implementations.
341 [ 342 [
342 'getStartStopSyncButton', 343 'getStartStopSyncButton',
343 'hideSyncSection', 344 'hideSyncSection',
344 'setAutoLoginVisible', 345 'setAutoLoginVisible',
345 'setCustomizeSyncButtonEnabled', 346 'setCustomizeSyncButtonEnabled',
346 'setGtkThemeButtonEnabled', 347 'setGtkThemeButtonEnabled',
(...skipping 15 matching lines...) Expand all
362 return PersonalOptions.getInstance()[name + '_'](value); 363 return PersonalOptions.getInstance()[name + '_'](value);
363 }; 364 };
364 }); 365 });
365 366
366 // Export 367 // Export
367 return { 368 return {
368 PersonalOptions: PersonalOptions 369 PersonalOptions: PersonalOptions
369 }; 370 };
370 371
371 }); 372 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/change_picture_options.js ('k') | chrome/browser/ui/webui/bug_report_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698