| 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 245 dict->SetString(kMediaGalleriesVolumeLabelKey, gallery.volume_label); | 245 dict->SetString(kMediaGalleriesVolumeLabelKey, gallery.volume_label); |
| 246 dict->SetString(kMediaGalleriesVendorNameKey, gallery.vendor_name); | 246 dict->SetString(kMediaGalleriesVendorNameKey, gallery.vendor_name); |
| 247 dict->SetString(kMediaGalleriesModelNameKey, gallery.model_name); | 247 dict->SetString(kMediaGalleriesModelNameKey, gallery.model_name); |
| 248 dict->SetDouble(kMediaGalleriesSizeKey, gallery.total_size_in_bytes); | 248 dict->SetDouble(kMediaGalleriesSizeKey, gallery.total_size_in_bytes); |
| 249 dict->SetDouble(kMediaGalleriesLastAttachTimeKey, | 249 dict->SetDouble(kMediaGalleriesLastAttachTimeKey, |
| 250 gallery.last_attach_time.ToInternalValue()); | 250 gallery.last_attach_time.ToInternalValue()); |
| 251 } else { | 251 } else { |
| 252 dict->SetString(kMediaGalleriesDisplayNameKey, gallery.display_name); | 252 dict->SetString(kMediaGalleriesDisplayNameKey, gallery.display_name); |
| 253 } | 253 } |
| 254 | 254 |
| 255 dict->SetInteger(kMediaGalleriesScanAudioCountKey, gallery.audio_count); | 255 if (gallery.IsBlackListedType() || gallery.audio_count || |
| 256 dict->SetInteger(kMediaGalleriesScanImageCountKey, gallery.image_count); | 256 gallery.image_count || gallery.video_count) { |
| 257 dict->SetInteger(kMediaGalleriesScanVideoCountKey, gallery.video_count); | 257 dict->SetInteger(kMediaGalleriesScanAudioCountKey, gallery.audio_count); |
| 258 dict->SetInteger(kMediaGalleriesScanImageCountKey, gallery.image_count); |
| 259 dict->SetInteger(kMediaGalleriesScanVideoCountKey, gallery.video_count); |
| 260 } |
| 258 | 261 |
| 259 // Version 0 of the prefs format was that the display_name was always | 262 // Version 0 of the prefs format was that the display_name was always |
| 260 // used to show the user-visible name of the gallery. Version 1 means | 263 // used to show the user-visible name of the gallery. Version 1 means |
| 261 // that there is an optional display_name, and when it is present, it | 264 // that there is an optional display_name, and when it is present, it |
| 262 // overrides the name that would be built from the volume metadata, path, | 265 // overrides the name that would be built from the volume metadata, path, |
| 263 // or whatever other data. So if we see a display_name with version 0, it | 266 // or whatever other data. So if we see a display_name with version 0, it |
| 264 // means it may be overwritten simply by getting new volume metadata. | 267 // means it may be overwritten simply by getting new volume metadata. |
| 265 // A display_name with version 1 should not be overwritten. | 268 // A display_name with version 1 should not be overwritten. |
| 266 dict->SetInteger(kMediaGalleriesPrefsVersionKey, gallery.prefs_version); | 269 dict->SetInteger(kMediaGalleriesPrefsVersionKey, gallery.prefs_version); |
| 267 | 270 |
| (...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1227 if (extension_prefs_for_testing_) | 1230 if (extension_prefs_for_testing_) |
| 1228 return extension_prefs_for_testing_; | 1231 return extension_prefs_for_testing_; |
| 1229 return extensions::ExtensionPrefs::Get(profile_); | 1232 return extensions::ExtensionPrefs::Get(profile_); |
| 1230 } | 1233 } |
| 1231 | 1234 |
| 1232 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( | 1235 void MediaGalleriesPreferences::SetExtensionPrefsForTesting( |
| 1233 extensions::ExtensionPrefs* extension_prefs) { | 1236 extensions::ExtensionPrefs* extension_prefs) { |
| 1234 DCHECK(IsInitialized()); | 1237 DCHECK(IsInitialized()); |
| 1235 extension_prefs_for_testing_ = extension_prefs; | 1238 extension_prefs_for_testing_ = extension_prefs; |
| 1236 } | 1239 } |
| OLD | NEW |