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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_impl.cc

Issue 10541036: Show account part of the display email when real name is not available. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: comments Created 8 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
« no previous file with comments | « chrome/browser/chromeos/login/user.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "chrome/browser/chromeos/login/user_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_manager_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 is_current_user_new_ = true; 282 is_current_user_new_ = true;
283 logged_in_user_ = CreateUser(email); 283 logged_in_user_ = CreateUser(email);
284 } else { 284 } else {
285 logged_in_user_ = *logged_in_user; 285 logged_in_user_ = *logged_in_user;
286 users_.erase(logged_in_user); 286 users_.erase(logged_in_user);
287 } 287 }
288 // This user must be in the front of the user list. 288 // This user must be in the front of the user list.
289 users_.insert(users_.begin(), logged_in_user_); 289 users_.insert(users_.begin(), logged_in_user_);
290 290
291 if (is_current_user_new_) { 291 if (is_current_user_new_) {
292 SaveUserDisplayName(GetLoggedInUser().email(),
293 UTF8ToUTF16(GetLoggedInUser().GetAccountName(true)));
292 SetInitialUserImage(email); 294 SetInitialUserImage(email);
293 SetInitialUserWallpaper(email); 295 SetInitialUserWallpaper(email);
294 } else { 296 } else {
295 // Download profile image if it's user image and see if it has changed. 297 // Download profile image if it's user image and see if it has changed.
296 int image_index = logged_in_user_->image_index(); 298 int image_index = logged_in_user_->image_index();
297 if (image_index == User::kProfileImageIndex) { 299 if (image_index == User::kProfileImageIndex) {
298 InitDownloadedProfileImage(); 300 InitDownloadedProfileImage();
299 BrowserThread::PostDelayedTask( 301 BrowserThread::PostDelayedTask(
300 BrowserThread::UI, 302 BrowserThread::UI,
301 FROM_HERE, 303 FROM_HERE,
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 1375
1374 void UserManagerImpl::OnDownloadComplete(ProfileDownloader* downloader, 1376 void UserManagerImpl::OnDownloadComplete(ProfileDownloader* downloader,
1375 bool success) { 1377 bool success) {
1376 // Make sure that |ProfileDownloader| gets deleted after return. 1378 // Make sure that |ProfileDownloader| gets deleted after return.
1377 scoped_ptr<ProfileDownloader> profile_image_downloader( 1379 scoped_ptr<ProfileDownloader> profile_image_downloader(
1378 profile_image_downloader_.release()); 1380 profile_image_downloader_.release());
1379 DCHECK(profile_image_downloader.get() == downloader); 1381 DCHECK(profile_image_downloader.get() == downloader);
1380 1382
1381 ProfileDownloadResult result; 1383 ProfileDownloadResult result;
1382 if (!success) { 1384 if (!success) {
1385 SaveUserDisplayName(GetLoggedInUser().email(),
1386 UTF8ToUTF16(GetLoggedInUser().GetAccountName(true)));
1383 result = kDownloadFailure; 1387 result = kDownloadFailure;
1384 } else { 1388 } else {
1385 if (downloader->GetProfileFullName().empty()) { 1389 if (downloader->GetProfileFullName().empty()) {
1386 SaveUserDisplayName(GetLoggedInUser().email(), 1390 SaveUserDisplayName(GetLoggedInUser().email(),
1387 UTF8ToUTF16(GetLoggedInUser().email())); 1391 UTF8ToUTF16(GetLoggedInUser().GetAccountName(true)));
1388 } else { 1392 } else {
1389 SaveUserDisplayName(GetLoggedInUser().email(), 1393 SaveUserDisplayName(GetLoggedInUser().email(),
1390 downloader->GetProfileFullName()); 1394 downloader->GetProfileFullName());
1391 } 1395 }
1392 if (downloader->GetProfilePicture().isNull()) 1396 if (downloader->GetProfilePicture().isNull())
1393 result = kDownloadDefault; 1397 result = kDownloadDefault;
1394 else 1398 else
1395 result = kDownloadSuccess; 1399 result = kDownloadSuccess;
1396 } 1400 }
1397 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult", 1401 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 BrowserThread::PostTask( 1515 BrowserThread::PostTask(
1512 BrowserThread::FILE, 1516 BrowserThread::FILE,
1513 FROM_HERE, 1517 FROM_HERE,
1514 base::Bind(&UserManagerImpl::DeleteUserImage, 1518 base::Bind(&UserManagerImpl::DeleteUserImage,
1515 base::Unretained(this), 1519 base::Unretained(this),
1516 image_path)); 1520 image_path));
1517 } 1521 }
1518 } 1522 }
1519 1523
1520 } // namespace chromeos 1524 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698