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

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

Issue 184563006: Move WriteFile and WriteFileDescriptor from file_util to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_image_manager_impl.h" 5 #include "chrome/browser/chromeos/login/user_image_manager_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 encoded_image = &safe_image.raw_image(); 165 encoded_image = &safe_image.raw_image();
166 UMA_HISTOGRAM_MEMORY_KB("UserImage.RecodedJpegSize", encoded_image->size()); 166 UMA_HISTOGRAM_MEMORY_KB("UserImage.RecodedJpegSize", encoded_image->size());
167 } else if (user_image.has_raw_image()) { 167 } else if (user_image.has_raw_image()) {
168 encoded_image = &user_image.raw_image(); 168 encoded_image = &user_image.raw_image();
169 } else { 169 } else {
170 NOTREACHED() << "Raw image missing."; 170 NOTREACHED() << "Raw image missing.";
171 return false; 171 return false;
172 } 172 }
173 173
174 if (!encoded_image->size() || 174 if (!encoded_image->size() ||
175 file_util::WriteFile(image_path, 175 base::WriteFile(image_path,
176 reinterpret_cast<const char*>(&(*encoded_image)[0]), 176 reinterpret_cast<const char*>(&(*encoded_image)[0]),
177 encoded_image->size()) == -1) { 177 encoded_image->size()) == -1) {
178 LOG(ERROR) << "Failed to save image to file."; 178 LOG(ERROR) << "Failed to save image to file.";
179 return false; 179 return false;
180 } 180 }
181 181
182 return true; 182 return true;
183 } 183 }
184 184
185 } // namespace 185 } // namespace
186 186
187 // static 187 // static
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 } 1000 }
1001 1001
1002 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const { 1002 bool UserImageManagerImpl::IsUserLoggedInAndRegular() const {
1003 const User* user = GetUser(); 1003 const User* user = GetUser();
1004 if (!user) 1004 if (!user)
1005 return false; 1005 return false;
1006 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR; 1006 return user->is_logged_in() && user->GetType() == User::USER_TYPE_REGULAR;
1007 } 1007 }
1008 1008
1009 } // namespace chromeos 1009 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_image_manager_browsertest.cc ('k') | chrome/browser/chromeos/login/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698