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

Unified Diff: components/user_manager/user.cc

Issue 1794323003: Make user_manager::UserImage non-copyable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: just rebase Created 4 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/user_manager/user.h ('k') | components/user_manager/user_image/user_image.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/user_manager/user.cc
diff --git a/components/user_manager/user.cc b/components/user_manager/user.cc
index f84767c4a0e49a8b7f13ac9c61bd17680defc984..fc7b56c2e5e8f517baf0a47d88a48c75505e5bc9 100644
--- a/components/user_manager/user.cc
+++ b/components/user_manager/user.cc
@@ -136,7 +136,7 @@ base::string16 User::GetGivenName() const {
}
const gfx::ImageSkia& User::GetImage() const {
- return user_image_.image();
+ return user_image_->image();
}
const AccountId& User::GetAccountId() const {
@@ -224,7 +224,8 @@ User* User::CreatePublicAccountUser(const AccountId& account_id) {
return new PublicAccountUser(account_id);
}
-User::User(const AccountId& account_id) : account_id_(account_id) {}
+User::User(const AccountId& account_id) : account_id_(account_id),
+ user_image_(new UserImage) {}
User::~User() {
}
@@ -233,22 +234,22 @@ void User::SetAccountLocale(const std::string& resolved_account_locale) {
account_locale_.reset(new std::string(resolved_account_locale));
}
-void User::SetImage(const UserImage& user_image, int image_index) {
- user_image_ = user_image;
+void User::SetImage(scoped_ptr<UserImage> user_image, int image_index) {
+ user_image_ = std::move(user_image);
image_index_ = image_index;
image_is_stub_ = false;
image_is_loading_ = false;
- DCHECK(HasDefaultImage() || user_image.has_image_bytes());
+ DCHECK(HasDefaultImage() || user_image_->has_image_bytes());
}
void User::SetImageURL(const GURL& image_url) {
- user_image_.set_url(image_url);
+ user_image_->set_url(image_url);
}
-void User::SetStubImage(const UserImage& stub_user_image,
+void User::SetStubImage(scoped_ptr<UserImage> stub_user_image,
int image_index,
bool is_loading) {
- user_image_ = stub_user_image;
+ user_image_ = std::move(stub_user_image);
image_index_ = image_index;
image_is_stub_ = true;
image_is_loading_ = is_loading;
« no previous file with comments | « components/user_manager/user.h ('k') | components/user_manager/user_image/user_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698