Chromium Code Reviews| Index: chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc |
| diff --git a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc |
| index a1a799a25c11b16d624a86913c5e67d0fec18be0..ac086e14db92f2afa04aaa5b64aaa70fb2077eea 100644 |
| --- a/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc |
| +++ b/chrome/browser/media_galleries/media_galleries_scan_result_dialog_controller.cc |
| @@ -228,7 +228,8 @@ void MediaGalleriesScanResultDialogController::UpdateScanResultsFromPreferences( |
| it != galleries.end(); |
| ++it) { |
| const MediaGalleryPrefInfo& gallery = it->second; |
| - if (gallery.type == MediaGalleryPrefInfo::kScanResult && |
| + if ((gallery.audio_count || gallery.image_count || gallery.video_count) && |
|
tommycli
2014/02/10 18:45:53
I believe this will cause galleries with zero audi
vandebo (ex-Chrome)
2014/02/11 19:19:31
Yes, it will hide galleries with no media files.
|
| + !gallery.IsBlackListedType() && |
| !ContainsKey(permitted, gallery.pref_id) && |
| !ContainsKey(ignore_list, gallery.pref_id)) { |
| ScanResults::iterator existing = scan_results->find(gallery.pref_id); |
| @@ -251,8 +252,8 @@ void MediaGalleriesScanResultDialogController::UpdateScanResultsFromPreferences( |
| MediaGalleriesPrefInfoMap::const_iterator pref_gallery = |
| galleries.find(it->first); |
| if (pref_gallery == galleries.end() || |
| - pref_gallery->second.type != MediaGalleryPrefInfo::kScanResult || |
| - permitted.find(it->first) != permitted.end()) { |
| + pref_gallery->second.IsBlackListedType() || |
| + ContainsKey(permitted, it->first)) { |
| to_remove.push_back(it); |
| } |
| } |
| @@ -280,15 +281,9 @@ void MediaGalleriesScanResultDialogController::OnPreferencesInitialized() { |
| void MediaGalleriesScanResultDialogController::OnPreferenceUpdate( |
| const std::string& extension_id, MediaGalleryPrefId pref_id) { |
| if (extension_id == extension_->id()) { |
| - const MediaGalleriesPrefInfoMap::const_iterator it = |
| - preferences_->known_galleries().find(pref_id); |
| - if (it == preferences_->known_galleries().end() || |
| - it->second.type == MediaGalleryPrefInfo::kScanResult || |
| - it->second.type == MediaGalleryPrefInfo::kRemovedScan) { |
| - UpdateScanResultsFromPreferences(preferences_, extension_, |
| - results_to_remove_, &scan_results_); |
| - dialog_->UpdateResults(); |
| - } |
| + UpdateScanResultsFromPreferences(preferences_, extension_, |
| + results_to_remove_, &scan_results_); |
| + dialog_->UpdateResults(); |
| } |
| } |