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/media_galleries/media_galleries_preferences.h" | 5 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
6 | 6 |
7 #include "base/base_paths_posix.h" | 7 #include "base/base_paths_posix.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/i18n/time_formatting.h" | 9 #include "base/i18n/time_formatting.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
816 bool update_gallery_metadata = volume_metadata_valid && | 816 bool update_gallery_metadata = volume_metadata_valid && |
817 ((existing.volume_label != volume_label) || | 817 ((existing.volume_label != volume_label) || |
818 (existing.vendor_name != vendor_name) || | 818 (existing.vendor_name != vendor_name) || |
819 (existing.model_name != model_name) || | 819 (existing.model_name != model_name) || |
820 (existing.total_size_in_bytes != total_size_in_bytes) || | 820 (existing.total_size_in_bytes != total_size_in_bytes) || |
821 (existing.last_attach_time != last_attach_time)); | 821 (existing.last_attach_time != last_attach_time)); |
822 | 822 |
823 bool update_scan_counts = | 823 bool update_scan_counts = |
824 new_type != MediaGalleryPrefInfo::kRemovedScan && | 824 new_type != MediaGalleryPrefInfo::kRemovedScan && |
825 new_type != MediaGalleryPrefInfo::kBlackListed && | 825 new_type != MediaGalleryPrefInfo::kBlackListed && |
826 (audio_count > 0 || image_count > 0 || video_count > 0); | 826 (audio_count > 0 || image_count > 0 || video_count > 0 || |
| 827 existing.audio_count || existing.image_count || existing.video_count); |
827 | 828 |
828 if (!update_gallery_name && !update_gallery_type && | 829 if (!update_gallery_name && !update_gallery_type && |
829 !update_gallery_metadata && !update_scan_counts) | 830 !update_gallery_metadata && !update_scan_counts) |
830 return *pref_id_it; | 831 return *pref_id_it; |
831 | 832 |
832 PrefService* prefs = profile_->GetPrefs(); | 833 PrefService* prefs = profile_->GetPrefs(); |
833 scoped_ptr<ListPrefUpdate> update( | 834 scoped_ptr<ListPrefUpdate> update( |
834 new ListPrefUpdate(prefs, prefs::kMediaGalleriesRememberedGalleries)); | 835 new ListPrefUpdate(prefs, prefs::kMediaGalleriesRememberedGalleries)); |
835 base::ListValue* list = update->Get(); | 836 base::ListValue* list = update->Get(); |
836 | 837 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 if (extension_prefs_for_testing_) | 1244 if (extension_prefs_for_testing_) |
1244 return extension_prefs_for_testing_; | 1245 return extension_prefs_for_testing_; |
1245 return extensions::ExtensionPrefs::Get(profile_); | 1246 return extensions::ExtensionPrefs::Get(profile_); |
1246 } | 1247 } |
1247 | 1248 |
1248 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( | 1249 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( |
1249 extensions::ExtensionPrefs* extension_prefs) { | 1250 extensions::ExtensionPrefs* extension_prefs) { |
1250 DCHECK(IsInitialized()); | 1251 DCHECK(IsInitialized()); |
1251 extension_prefs_for_testing_ = extension_prefs; | 1252 extension_prefs_for_testing_ = extension_prefs; |
1252 } | 1253 } |
OLD | NEW |