OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |