| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 } | 138 } |
| 139 | 139 |
| 140 // Deletes image file. | 140 // Deletes image file. |
| 141 void DeleteImageFile(const std::string& image_path) { | 141 void DeleteImageFile(const std::string& image_path) { |
| 142 if (image_path.empty()) | 142 if (image_path.empty()) |
| 143 return; | 143 return; |
| 144 base::FilePath fp(image_path); | 144 base::FilePath fp(image_path); |
| 145 BrowserThread::PostTask( | 145 BrowserThread::PostTask( |
| 146 BrowserThread::FILE, | 146 BrowserThread::FILE, |
| 147 FROM_HERE, | 147 FROM_HERE, |
| 148 base::Bind(base::IgnoreResult(&file_util::Delete), | 148 base::Bind(base::IgnoreResult(&base::Delete), |
| 149 fp, /* recursive= */ false)); | 149 fp, /* recursive= */ false)); |
| 150 } | 150 } |
| 151 | 151 |
| 152 // Converts |image_index| to UMA histogram value. | 152 // Converts |image_index| to UMA histogram value. |
| 153 int ImageIndexToHistogramIndex(int image_index) { | 153 int ImageIndexToHistogramIndex(int image_index) { |
| 154 switch (image_index) { | 154 switch (image_index) { |
| 155 case User::kExternalImageIndex: | 155 case User::kExternalImageIndex: |
| 156 // TODO(ivankr): Distinguish this from selected from file. | 156 // TODO(ivankr): Distinguish this from selected from file. |
| 157 return kHistogramImageFromCamera; | 157 return kHistogramImageFromCamera; |
| 158 case User::kProfileImageIndex: | 158 case User::kProfileImageIndex: |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 774 if (prefs_images_update->GetDictionaryWithoutPathExpansion( | 774 if (prefs_images_update->GetDictionaryWithoutPathExpansion( |
| 775 username, &image_properties)) { | 775 username, &image_properties)) { |
| 776 std::string image_path; | 776 std::string image_path; |
| 777 image_properties->GetString(kImagePathNodeName, &image_path); | 777 image_properties->GetString(kImagePathNodeName, &image_path); |
| 778 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); | 778 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); |
| 779 DeleteImageFile(image_path); | 779 DeleteImageFile(image_path); |
| 780 } | 780 } |
| 781 } | 781 } |
| 782 | 782 |
| 783 } // namespace chromeos | 783 } // namespace chromeos |
| OLD | NEW |