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 || |
tommycli
2014/02/10 18:45:53
Should this be all blacklisted galleries, or only
Lei Zhang
2014/02/10 19:55:22
Can you add a comment to explain why we are checki
vandebo (ex-Chrome)
2014/02/11 19:19:31
Blacklisted galleries in general shouldn't have th
Lei Zhang
2014/02/13 22:08:04
But the code says:
if (gallery.IsBlackListedType(
vandebo (ex-Chrome)
2014/02/13 22:10:02
This is at a lower level - when we mark a gallery
Lei Zhang
2014/02/14 07:34:02
So you are trying to zero them out if the type is
vandebo (ex-Chrome)
2014/02/14 19:11:54
Indeed you are correct - EraseOrBlacklistGalleryBy
| |
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 |