| OLD | NEW |
| 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_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/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/chromeos/login/default_user_images.h" | 18 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 19 #include "chrome/browser/chromeos/login/helper.h" | 19 #include "chrome/browser/chromeos/login/helper.h" |
| 20 #include "chrome/browser/chromeos/login/user_image.h" | 20 #include "chrome/browser/chromeos/login/user_image.h" |
| 21 #include "chrome/browser/chromeos/login/user_manager.h" | 21 #include "chrome/browser/chromeos/login/user_manager.h" |
| 22 #include "chrome/browser/prefs/pref_registrar_simple.h" |
| 22 #include "chrome/browser/prefs/pref_service.h" | 23 #include "chrome/browser/prefs/pref_service.h" |
| 23 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 24 #include "chrome/browser/profiles/profile_downloader.h" | 25 #include "chrome/browser/profiles/profile_downloader.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/ui/webui/web_ui_util.h" | 27 #include "chrome/browser/ui/webui/web_ui_util.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 28 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/chrome_paths.h" | 29 #include "chrome/common/chrome_paths.h" |
| 29 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 30 #include "content/public/browser/notification_service.h" | 31 #include "content/public/browser/notification_service.h" |
| 31 #include "content/public/common/url_constants.h" | 32 #include "content/public/common/url_constants.h" |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 } | 163 } |
| 163 } | 164 } |
| 164 | 165 |
| 165 } // namespace | 166 } // namespace |
| 166 | 167 |
| 167 // static | 168 // static |
| 168 int UserImageManagerImpl::user_image_migration_delay_sec = | 169 int UserImageManagerImpl::user_image_migration_delay_sec = |
| 169 kUserImageMigrationDelaySec; | 170 kUserImageMigrationDelaySec; |
| 170 | 171 |
| 171 // static | 172 // static |
| 172 void UserImageManager::RegisterPrefs(PrefServiceSimple* local_state) { | 173 void UserImageManager::RegisterPrefs(PrefRegistrarSimple* local_state) { |
| 173 local_state->RegisterDictionaryPref(kUserImages); | 174 local_state->RegisterDictionaryPref(kUserImages); |
| 174 local_state->RegisterDictionaryPref(kUserImageProperties); | 175 local_state->RegisterDictionaryPref(kUserImageProperties); |
| 175 } | 176 } |
| 176 | 177 |
| 177 UserImageManagerImpl::UserImageManagerImpl() | 178 UserImageManagerImpl::UserImageManagerImpl() |
| 178 : image_loader_(new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC)), | 179 : image_loader_(new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC)), |
| 179 unsafe_image_loader_(new UserImageLoader(ImageDecoder::DEFAULT_CODEC)), | 180 unsafe_image_loader_(new UserImageLoader(ImageDecoder::DEFAULT_CODEC)), |
| 180 last_image_set_async_(false), | 181 last_image_set_async_(false), |
| 181 downloaded_profile_image_data_url_(chrome::kAboutBlankURL), | 182 downloaded_profile_image_data_url_(chrome::kAboutBlankURL), |
| 182 downloading_profile_image_(false), | 183 downloading_profile_image_(false), |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 if (prefs_images_update->GetDictionaryWithoutPathExpansion( | 735 if (prefs_images_update->GetDictionaryWithoutPathExpansion( |
| 735 username, &image_properties)) { | 736 username, &image_properties)) { |
| 736 std::string image_path; | 737 std::string image_path; |
| 737 image_properties->GetString(kImagePathNodeName, &image_path); | 738 image_properties->GetString(kImagePathNodeName, &image_path); |
| 738 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); | 739 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); |
| 739 DeleteImageFile(image_path); | 740 DeleteImageFile(image_path); |
| 740 } | 741 } |
| 741 } | 742 } |
| 742 | 743 |
| 743 } // namespace chromeos | 744 } // namespace chromeos |
| OLD | NEW |