| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
| 8 #include "base/bind.h" | |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
| 14 #include "base/rand_util.h" | 14 #include "base/rand_util.h" |
| 15 #include "base/threading/worker_pool.h" | 15 #include "base/threading/worker_pool.h" |
| 16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "base/values.h" | 17 #include "base/values.h" |
| 18 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 19 #include "chrome/browser/chromeos/login/default_user_images.h" | 19 #include "chrome/browser/chromeos/login/default_user_images.h" |
| 20 #include "chrome/browser/chromeos/login/helper.h" | 20 #include "chrome/browser/chromeos/login/helper.h" |
| 21 #include "chrome/browser/chromeos/login/user_image.h" | 21 #include "chrome/browser/chromeos/login/user_image.h" |
| 22 #include "chrome/browser/chromeos/login/user_manager.h" | 22 #include "chrome/browser/chromeos/login/user_manager.h" |
| 23 #include "chrome/browser/prefs/pref_registry_simple.h" |
| 23 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 24 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 25 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 25 #include "chrome/browser/profiles/profile_downloader.h" | 26 #include "chrome/browser/profiles/profile_downloader.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 27 #include "chrome/browser/profiles/profile_manager.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" |
| 32 #include "ui/gfx/image/image_skia.h" | 33 #include "ui/gfx/image/image_skia.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace | 165 } // namespace |
| 165 | 166 |
| 166 // static | 167 // static |
| 167 int UserImageManagerImpl::user_image_migration_delay_sec = | 168 int UserImageManagerImpl::user_image_migration_delay_sec = |
| 168 kUserImageMigrationDelaySec; | 169 kUserImageMigrationDelaySec; |
| 169 | 170 |
| 170 // static | 171 // static |
| 171 void UserImageManager::RegisterPrefs(PrefServiceSimple* local_state) { | 172 void UserImageManager::RegisterPrefs(PrefRegistrySimple* registry) { |
| 172 local_state->RegisterDictionaryPref(kUserImages); | 173 registry->RegisterDictionaryPref(kUserImages); |
| 173 local_state->RegisterDictionaryPref(kUserImageProperties); | 174 registry->RegisterDictionaryPref(kUserImageProperties); |
| 174 } | 175 } |
| 175 | 176 |
| 176 UserImageManagerImpl::UserImageManagerImpl() | 177 UserImageManagerImpl::UserImageManagerImpl() |
| 177 : image_loader_(new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC)), | 178 : image_loader_(new UserImageLoader(ImageDecoder::ROBUST_JPEG_CODEC)), |
| 178 unsafe_image_loader_(new UserImageLoader(ImageDecoder::DEFAULT_CODEC)), | 179 unsafe_image_loader_(new UserImageLoader(ImageDecoder::DEFAULT_CODEC)), |
| 179 last_image_set_async_(false), | 180 last_image_set_async_(false), |
| 180 downloaded_profile_image_data_url_(chrome::kAboutBlankURL), | 181 downloaded_profile_image_data_url_(chrome::kAboutBlankURL), |
| 181 downloading_profile_image_(false), | 182 downloading_profile_image_(false), |
| 182 migrate_current_user_on_load_(false) { | 183 migrate_current_user_on_load_(false) { |
| 183 } | 184 } |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 if (prefs_images_update->GetDictionaryWithoutPathExpansion( | 741 if (prefs_images_update->GetDictionaryWithoutPathExpansion( |
| 741 username, &image_properties)) { | 742 username, &image_properties)) { |
| 742 std::string image_path; | 743 std::string image_path; |
| 743 image_properties->GetString(kImagePathNodeName, &image_path); | 744 image_properties->GetString(kImagePathNodeName, &image_path); |
| 744 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); | 745 prefs_images_update->RemoveWithoutPathExpansion(username, NULL); |
| 745 DeleteImageFile(image_path); | 746 DeleteImageFile(image_path); |
| 746 } | 747 } |
| 747 } | 748 } |
| 748 | 749 |
| 749 } // namespace chromeos | 750 } // namespace chromeos |
| OLD | NEW |