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

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

Issue 9580023: Enable user change background image in settings page in Aura build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: More refactor Created 8 years, 9 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
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 "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"
(...skipping 14 matching lines...) Expand all
25 } 25 }
26 return email.substr(0, i); 26 return email.substr(0, i);
27 } 27 }
28 28
29 } // namespace 29 } // namespace
30 30
31 User::User(const std::string& email, bool is_guest) 31 User::User(const std::string& email, bool is_guest)
32 : email_(email), 32 : email_(email),
33 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN), 33 oauth_token_status_(OAUTH_TOKEN_STATUS_UNKNOWN),
34 image_index_(kInvalidImageIndex), 34 image_index_(kInvalidImageIndex),
35 wallpaper_index_(kDefaultWallpaperIndex),
35 image_is_stub_(false), 36 image_is_stub_(false),
36 is_guest_(is_guest) { 37 is_guest_(is_guest) {
37 // The email address of a demo user is for internal purposes only, 38 // The email address of a demo user is for internal purposes only,
38 // never meant for display. 39 // never meant for display.
39 if (email != kDemoUser) 40 if (email != kDemoUser)
40 display_email_ = email; 41 display_email_ = email;
41 image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed( 42 image_ = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
42 kDefaultImageResources[0]); 43 kDefaultImageResources[0]);
43 } 44 }
44 45
45 User::~User() {} 46 User::~User() {}
46 47
48 void User::SetWallpaper(int wallpaper_index) {
49 wallpaper_index_ = wallpaper_index;
50 }
51
47 void User::SetImage(const SkBitmap& image, int image_index) { 52 void User::SetImage(const SkBitmap& image, int image_index) {
48 image_ = image; 53 image_ = image;
49 image_index_ = image_index; 54 image_index_ = image_index;
50 image_is_stub_ = false; 55 image_is_stub_ = false;
51 } 56 }
52 57
53 void User::SetStubImage(int image_index) { 58 void User::SetStubImage(int image_index) {
54 image_ = *ResourceBundle::GetSharedInstance(). 59 image_ = *ResourceBundle::GetSharedInstance().
55 GetBitmapNamed(kStubImageResourceID); 60 GetBitmapNamed(kStubImageResourceID);
56 image_index_ = image_index; 61 image_index_ = image_index;
(...skipping 21 matching lines...) Expand all
78 } 83 }
79 size_t domain_start = at_pos + 1; 84 size_t domain_start = at_pos + 1;
80 std::string domain = user_email.substr(domain_start, 85 std::string domain = user_email.substr(domain_start,
81 user_email.length() - domain_start); 86 user_email.length() - domain_start);
82 return base::StringPrintf("%s (%s)", 87 return base::StringPrintf("%s (%s)",
83 GetDisplayName().c_str(), 88 GetDisplayName().c_str(),
84 domain.c_str()); 89 domain.c_str());
85 } 90 }
86 91
87 } // namespace chromeos 92 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698