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

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

Issue 10667034: [cros] Cache the URL of user's G+ profile photo to prevent redundant downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | chrome/browser/chromeos/login/user_image.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) 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.h" 5 #include "chrome/browser/chromeos/login/user.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/chromeos/login/default_user_images.h" 9 #include "chrome/browser/chromeos/login/default_user_images.h"
10 #include "chrome/browser/chromeos/login/user_manager.h" 10 #include "chrome/browser/chromeos/login/user_manager.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 User::~User() {} 50 User::~User() {}
51 51
52 void User::SetImage(const UserImage& user_image, int image_index) { 52 void User::SetImage(const UserImage& user_image, int image_index) {
53 user_image_ = user_image; 53 user_image_ = user_image;
54 image_index_ = image_index; 54 image_index_ = image_index;
55 image_is_stub_ = false; 55 image_is_stub_ = false;
56 } 56 }
57 57
58 void User::SetImageURL(const GURL& image_url) {
59 user_image_.set_url(image_url);
60 }
61
58 void User::SetStubImage(int image_index) { 62 void User::SetStubImage(int image_index) {
59 user_image_.SetImage(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 63 user_image_.SetImage(*ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
60 kStubImageResourceID)); 64 kStubImageResourceID));
61 image_index_ = image_index; 65 image_index_ = image_index;
62 image_is_stub_ = true; 66 image_is_stub_ = true;
63 } 67 }
64 68
65 void User::SetWallpaperThumbnail(const SkBitmap& wallpaper_thumbnail) { 69 void User::SetWallpaperThumbnail(const SkBitmap& wallpaper_thumbnail) {
66 wallpaper_thumbnail_ = wallpaper_thumbnail; 70 wallpaper_thumbnail_ = wallpaper_thumbnail;
67 } 71 }
68 72
69 std::string User::GetAccountName(bool use_display_email) const { 73 std::string User::GetAccountName(bool use_display_email) const {
70 if (use_display_email && !display_email_.empty()) 74 if (use_display_email && !display_email_.empty())
71 return GetUserName(display_email_); 75 return GetUserName(display_email_);
72 else 76 else
73 return GetUserName(email_); 77 return GetUserName(email_);
74 } 78 }
75 79
76 string16 User::GetDisplayName() const { 80 string16 User::GetDisplayName() const {
77 // We should try hard not to return an empty string (crbug.com/131630#c13). 81 // We should try hard not to return an empty string (crbug.com/131630#c13).
78 if (display_name_.empty()) 82 if (display_name_.empty())
79 return UTF8ToUTF16(GetAccountName(true)); 83 return UTF8ToUTF16(GetAccountName(true));
80 return display_name_; 84 return display_name_;
81 } 85 }
82 86
83 } // namespace chromeos 87 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user.h ('k') | chrome/browser/chromeos/login/user_image.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698