| 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/profiles/profile_info_cache.h" | 5 #include "chrome/browser/profiles/profile_info_cache.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 825 } | 825 } |
| 826 | 826 |
| 827 // static | 827 // static |
| 828 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { | 828 void ProfileInfoCache::RegisterPrefs(PrefRegistrySimple* registry) { |
| 829 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); | 829 registry->RegisterDictionaryPref(prefs::kProfileInfoCache); |
| 830 } | 830 } |
| 831 | 831 |
| 832 void ProfileInfoCache::DownloadHighResAvatar( | 832 void ProfileInfoCache::DownloadHighResAvatar( |
| 833 size_t icon_index, | 833 size_t icon_index, |
| 834 const base::FilePath& profile_path) { | 834 const base::FilePath& profile_path) { |
| 835 // Downloading is only supported on desktop. |
| 836 #if defined(OS_ANDROID) || defined(OS_IOS) || defined(OS_CHROMEOS) |
| 837 return; |
| 838 #endif |
| 839 |
| 835 // TODO(noms): We should check whether the file already exists on disk | 840 // TODO(noms): We should check whether the file already exists on disk |
| 836 // before trying to re-download it. For now, since this is behind a flag and | 841 // before trying to re-download it. For now, since this is behind a flag and |
| 837 // the resources are still changing, re-download it every time the profile | 842 // the resources are still changing, re-download it every time the profile |
| 838 // avatar changes, to make sure we have the latest copy. | 843 // avatar changes, to make sure we have the latest copy. |
| 839 std::string file_name = profiles::GetDefaultAvatarIconFileNameAtIndex( | 844 std::string file_name = profiles::GetDefaultAvatarIconFileNameAtIndex( |
| 840 icon_index); | 845 icon_index); |
| 841 // If the file is already being downloaded, don't start another download. | 846 // If the file is already being downloaded, don't start another download. |
| 842 if (avatar_images_downloads_in_progress_[file_name]) | 847 if (avatar_images_downloads_in_progress_[file_name]) |
| 843 return; | 848 return; |
| 844 | 849 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 OnProfileAvatarChanged(profile_path)); | 1054 OnProfileAvatarChanged(profile_path)); |
| 1050 | 1055 |
| 1051 // Remove the file from the list of downloads in progress. Note that this list | 1056 // Remove the file from the list of downloads in progress. Note that this list |
| 1052 // only contains the high resolution avatars, and not the Gaia profile images. | 1057 // only contains the high resolution avatars, and not the Gaia profile images. |
| 1053 if (!avatar_images_downloads_in_progress_[file_name]) | 1058 if (!avatar_images_downloads_in_progress_[file_name]) |
| 1054 return; | 1059 return; |
| 1055 | 1060 |
| 1056 delete avatar_images_downloads_in_progress_[file_name]; | 1061 delete avatar_images_downloads_in_progress_[file_name]; |
| 1057 avatar_images_downloads_in_progress_[file_name] = NULL; | 1062 avatar_images_downloads_in_progress_[file_name] = NULL; |
| 1058 } | 1063 } |
| OLD | NEW |