OLD | NEW |
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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
534 return; | 534 return; |
535 } | 535 } |
536 | 536 |
537 std::string image_url_string; | 537 std::string image_url_string; |
538 image_properties->GetString(kImageURLNodeName, &image_url_string); | 538 image_properties->GetString(kImageURLNodeName, &image_url_string); |
539 GURL image_url(image_url_string); | 539 GURL image_url(image_url_string); |
540 std::string image_path; | 540 std::string image_path; |
541 image_properties->GetString(kImagePathNodeName, &image_path); | 541 image_properties->GetString(kImagePathNodeName, &image_path); |
542 | 542 |
543 user->SetImageURL(image_url); | 543 user->SetImageURL(image_url); |
| 544 user->SetStubImage(image_index, true); |
544 DCHECK(!image_path.empty() || image_index == User::kProfileImageIndex); | 545 DCHECK(!image_path.empty() || image_index == User::kProfileImageIndex); |
545 if (image_path.empty() || needs_migration) { | 546 if (image_path.empty() || needs_migration) { |
546 // Use a stub image (gray avatar) if either of the following is true: | 547 // Return if either of the following is true: |
547 // * The profile image is to be used but has not been downloaded yet. The | 548 // * The profile image is to be used but has not been downloaded yet. The |
548 // profile image will be downloaded after login. | 549 // profile image will be downloaded after login. |
549 // * The image needs migration. Migration will be performed after login. | 550 // * The image needs migration. Migration will be performed after login. |
550 user->SetStubImage(image_index, true); | 551 user->SetStubImage(image_index, true); |
551 return; | 552 return; |
552 } | 553 } |
553 | 554 |
554 job_.reset(new Job(this)); | 555 job_.reset(new Job(this)); |
555 job_->LoadImage(base::FilePath(image_path), image_index, image_url); | 556 job_->LoadImage(base::FilePath(image_path), image_index, image_url); |
556 } | 557 } |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 } | 1002 } |
1002 | 1003 |
1003 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const { | 1004 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const { |
1004 const User* user = GetUser(); | 1005 const User* user = GetUser(); |
1005 if (!user) | 1006 if (!user) |
1006 return false; | 1007 return false; |
1007 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR; | 1008 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR; |
1008 } | 1009 } |
1009 | 1010 |
1010 } // namespace chromeos | 1011 } // namespace chromeos |
OLD | NEW |