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

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

Issue 23095006: If user profile doesn't contain language setting, default to his Google account settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix tests. Created 7 years, 2 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') | chrome/browser/chromeos/login/user_manager.h » ('j') | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_image_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_image_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 void UserImageManagerImpl::OnProfileDownloadSuccess( 652 void UserImageManagerImpl::OnProfileDownloadSuccess(
653 ProfileDownloader* downloader) { 653 ProfileDownloader* downloader) {
654 // Make sure that |ProfileDownloader| gets deleted after return. 654 // Make sure that |ProfileDownloader| gets deleted after return.
655 scoped_ptr<ProfileDownloader> profile_image_downloader( 655 scoped_ptr<ProfileDownloader> profile_image_downloader(
656 profile_image_downloader_.release()); 656 profile_image_downloader_.release());
657 DCHECK_EQ(downloader, profile_image_downloader.get()); 657 DCHECK_EQ(downloader, profile_image_downloader.get());
658 658
659 UserManager* user_manager = UserManager::Get(); 659 UserManager* user_manager = UserManager::Get();
660 const User* user = user_manager->GetLoggedInUser(); 660 const User* user = user_manager->GetLoggedInUser();
661 661
662 if (!downloader->GetProfileFullName().empty()) { 662 user_manager->UpdateUserAccountData(user->email(),
663 user_manager->SaveUserDisplayName( 663 downloader->GetProfileFullName(),
664 user->email(), downloader->GetProfileFullName()); 664 downloader->GetProfileLocale());
665 }
666 665
667 bool requested_image = downloading_profile_image_; 666 bool requested_image = downloading_profile_image_;
668 downloading_profile_image_ = false; 667 downloading_profile_image_ = false;
669 if (!requested_image) 668 if (!requested_image)
670 return; 669 return;
671 670
672 ProfileDownloadResult result = kDownloadFailure; 671 ProfileDownloadResult result = kDownloadFailure;
673 switch (downloader->GetProfilePictureStatus()) { 672 switch (downloader->GetProfilePictureStatus()) {
674 case ProfileDownloader::PICTURE_SUCCESS: 673 case ProfileDownloader::PICTURE_SUCCESS:
675 result = kDownloadSuccess; 674 result = kDownloadSuccess;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 profile_image_downloader_.reset(); 735 profile_image_downloader_.reset();
737 736
738 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult", 737 UMA_HISTOGRAM_ENUMERATION("UserImage.ProfileDownloadResult",
739 kDownloadFailure, kDownloadResultsCount); 738 kDownloadFailure, kDownloadResultsCount);
740 739
741 DCHECK(!profile_image_load_start_time_.is_null()); 740 DCHECK(!profile_image_load_start_time_.is_null());
742 base::TimeDelta delta = base::Time::Now() - profile_image_load_start_time_; 741 base::TimeDelta delta = base::Time::Now() - profile_image_load_start_time_;
743 AddProfileImageTimeHistogram(kDownloadFailure, profile_image_download_reason_, 742 AddProfileImageTimeHistogram(kDownloadFailure, profile_image_download_reason_,
744 delta); 743 delta);
745 744
745 UserManager* user_manager = UserManager::Get();
746 const User* user = user_manager->GetLoggedInUser();
747
748 // Need note that at least one attempt finished.
749 user_manager->UpdateUserAccountData(user->email(), string16(), "");
750
746 // Retry download after some time if a network error has occured. 751 // Retry download after some time if a network error has occured.
747 if (reason == ProfileDownloaderDelegate::NETWORK_ERROR) { 752 if (reason == ProfileDownloaderDelegate::NETWORK_ERROR) {
748 BrowserThread::PostDelayedTask( 753 BrowserThread::PostDelayedTask(
749 BrowserThread::UI, 754 BrowserThread::UI,
750 FROM_HERE, 755 FROM_HERE,
751 base::Bind(&UserImageManagerImpl::DownloadProfileDataRetry, 756 base::Bind(&UserImageManagerImpl::DownloadProfileDataRetry,
752 base::Unretained(this), 757 base::Unretained(this),
753 downloading_profile_image_), 758 downloading_profile_image_),
754 base::TimeDelta::FromSeconds(kProfileDataDownloadRetryIntervalSec)); 759 base::TimeDelta::FromSeconds(kProfileDataDownloadRetryIntervalSec));
755 } 760 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
794 if (prefs_images_update->GetDictionaryWithoutPathExpansion( 799 if (prefs_images_update->GetDictionaryWithoutPathExpansion(
795 username, &image_properties)) { 800 username, &image_properties)) {
796 std::string image_path; 801 std::string image_path;
797 image_properties->GetString(kImagePathNodeName, &image_path); 802 image_properties->GetString(kImagePathNodeName, &image_path);
798 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); 803 prefs_images_update->RemoveWithoutPathExpansion(username, NULL);
799 DeleteImageFile(image_path); 804 DeleteImageFile(image_path);
800 } 805 }
801 } 806 }
802 807
803 } // namespace chromeos 808 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user.cc ('k') | chrome/browser/chromeos/login/user_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698