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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 bool update_gallery_metadata = volume_metadata_valid && | 818 bool update_gallery_metadata = volume_metadata_valid && |
819 ((existing.volume_label != volume_label) || | 819 ((existing.volume_label != volume_label) || |
820 (existing.vendor_name != vendor_name) || | 820 (existing.vendor_name != vendor_name) || |
821 (existing.model_name != model_name) || | 821 (existing.model_name != model_name) || |
822 (existing.total_size_in_bytes != total_size_in_bytes) || | 822 (existing.total_size_in_bytes != total_size_in_bytes) || |
823 (existing.last_attach_time != last_attach_time)); | 823 (existing.last_attach_time != last_attach_time)); |
824 | 824 |
825 bool update_scan_counts = | 825 bool update_scan_counts = |
826 new_type != MediaGalleryPrefInfo::kRemovedScan && | 826 new_type != MediaGalleryPrefInfo::kRemovedScan && |
827 new_type != MediaGalleryPrefInfo::kBlackListed && | 827 new_type != MediaGalleryPrefInfo::kBlackListed && |
828 (audio_count > 0 || image_count > 0 || video_count > 0); | 828 (audio_count > 0 || image_count > 0 || video_count > 0 || |
| 829 existing.audio_count || existing.image_count || existing.video_count); |
829 | 830 |
830 if (!update_gallery_name && !update_gallery_type && | 831 if (!update_gallery_name && !update_gallery_type && |
831 !update_gallery_metadata && !update_scan_counts) | 832 !update_gallery_metadata && !update_scan_counts) |
832 return *pref_id_it; | 833 return *pref_id_it; |
833 | 834 |
834 PrefService* prefs = profile_->GetPrefs(); | 835 PrefService* prefs = profile_->GetPrefs(); |
835 scoped_ptr<ListPrefUpdate> update( | 836 scoped_ptr<ListPrefUpdate> update( |
836 new ListPrefUpdate(prefs, prefs::kMediaGalleriesRememberedGalleries)); | 837 new ListPrefUpdate(prefs, prefs::kMediaGalleriesRememberedGalleries)); |
837 base::ListValue* list = update->Get(); | 838 base::ListValue* list = update->Get(); |
838 | 839 |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 if (extension_prefs_for_testing_) | 1246 if (extension_prefs_for_testing_) |
1246 return extension_prefs_for_testing_; | 1247 return extension_prefs_for_testing_; |
1247 return extensions::ExtensionPrefs::Get(profile_); | 1248 return extensions::ExtensionPrefs::Get(profile_); |
1248 } | 1249 } |
1249 | 1250 |
1250 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( | 1251 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( |
1251 extensions::ExtensionPrefs* extension_prefs) { | 1252 extensions::ExtensionPrefs* extension_prefs) { |
1252 DCHECK(IsInitialized()); | 1253 DCHECK(IsInitialized()); |
1253 extension_prefs_for_testing_ = extension_prefs; | 1254 extension_prefs_for_testing_ = extension_prefs; |
1254 } | 1255 } |
OLD | NEW |