| OLD | NEW |
| 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/chromeos/login/user.h" |
| 6 | 6 |
| 7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
| 8 #include "chrome/browser/chromeos/login/default_user_images.h" | 8 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 9 #include "chrome/browser/chromeos/login/user_manager.h" | 9 #include "chrome/browser/chromeos/login/user_manager.h" |
| 10 #include "grit/theme_resources.h" | 10 #include "grit/theme_resources.h" |
| 11 #include "ui/base/resource/resource_bundle.h" | 11 #include "ui/base/resource/resource_bundle.h" |
| 12 | 12 |
| 13 namespace chromeos { | 13 namespace chromeos { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // Resource ID of the image to use as stub image. | 17 // Resource ID of the image to use as stub image. |
| 18 const int kStubImageResourceID = IDR_PROFILE_PICTURE_LOADING; | 18 const int kStubImageResourceID = IDR_PROFILE_PICTURE_LOADING; |
| 19 | 19 |
| 20 } // namespace | 20 } // namespace |
| 21 | 21 |
| 22 User::User(const std::string& email) | 22 User::User(const std::string& email, bool is_guest) |
| 23 : email_(email), | 23 : email_(email), |
| 24 display_email_(email), | 24 display_email_(email), |
| 25 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN), | 25 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN), |
| 26 image_index_(kInvalidImageIndex), | 26 image_index_(kInvalidImageIndex), |
| 27 image_is_stub_(false) { | 27 image_is_stub_(false), |
| 28 is_guest_(is_guest) { |
| 28 image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( | 29 image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 29 kDefaultImageResources[0]); | 30 kDefaultImageResources[0]); |
| 30 } | 31 } |
| 31 | 32 |
| 32 User::~User() {} | 33 User::~User() {} |
| 33 | 34 |
| 34 void User::SetImage(const SkBitmap& image, int image_index) { | 35 void User::SetImage(const SkBitmap& image, int image_index) { |
| 35 image_ = image; | 36 image_ = image; |
| 36 image_index_ = image_index; | 37 image_index_ = image_index; |
| 37 image_is_stub_ = false; | 38 image_is_stub_ = false; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 65 } | 66 } |
| 66 size_t domain_start = at_pos + 1; | 67 size_t domain_start = at_pos + 1; |
| 67 std::string domain = user_email.substr(domain_start, | 68 std::string domain = user_email.substr(domain_start, |
| 68 user_email.length() - domain_start); | 69 user_email.length() - domain_start); |
| 69 return base::StringPrintf("%s (%s)", | 70 return base::StringPrintf("%s (%s)", |
| 70 GetDisplayName().c_str(), | 71 GetDisplayName().c_str(), |
| 71 domain.c_str()); | 72 domain.c_str()); |
| 72 } | 73 } |
| 73 | 74 |
| 74 } // namespace chromeos | 75 } // namespace chromeos |
| OLD | NEW |