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

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

Issue 8923004: [cros] Add user image transparency support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_manager.h" 5 #include "chrome/browser/chromeos/login/user_manager.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 username, image, image_path, image_index)); 763 username, image, image_path, image_index));
764 } 764 }
765 765
766 void UserManager::SaveImageToFile(const std::string& username, 766 void UserManager::SaveImageToFile(const std::string& username,
767 const SkBitmap& image, 767 const SkBitmap& image,
768 const FilePath& image_path, 768 const FilePath& image_path,
769 int image_index) { 769 int image_index) {
770 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); 770 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
771 771
772 std::vector<unsigned char> encoded_image; 772 std::vector<unsigned char> encoded_image;
773 if (!gfx::PNGCodec::EncodeBGRASkBitmap(image, true, &encoded_image)) { 773 if (!gfx::PNGCodec::EncodeBGRASkBitmap(image, false, &encoded_image)) {
774 LOG(ERROR) << "Failed to PNG encode the image."; 774 LOG(ERROR) << "Failed to PNG encode the image.";
775 return; 775 return;
776 } 776 }
777 777
778 if (file_util::WriteFile(image_path, 778 if (file_util::WriteFile(image_path,
779 reinterpret_cast<char*>(&encoded_image[0]), 779 reinterpret_cast<char*>(&encoded_image[0]),
780 encoded_image.size()) == -1) { 780 encoded_image.size()) == -1) {
781 LOG(ERROR) << "Failed to save image to file."; 781 LOG(ERROR) << "Failed to save image to file.";
782 return; 782 return;
783 } 783 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 947
948 User* UserManager::CreateUser(const std::string& email) const { 948 User* UserManager::CreateUser(const std::string& email) const {
949 User* user = new User(email); 949 User* user = new User(email);
950 user->set_oauth_token_status(LoadUserOAuthStatus(email)); 950 user->set_oauth_token_status(LoadUserOAuthStatus(email));
951 // Used to determine whether user's display name is unique. 951 // Used to determine whether user's display name is unique.
952 ++display_name_count_[user->GetDisplayName()]; 952 ++display_name_count_[user->GetDisplayName()];
953 return user; 953 return user;
954 } 954 }
955 955
956 } // namespace chromeos 956 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698