Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5965)

Unified Diff: chrome/browser/media_gallery/media_galleries_preferences.cc

Issue 10913290: Clean up MediaStorageUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_preferences_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media_gallery/media_galleries_preferences.cc
diff --git a/chrome/browser/media_gallery/media_galleries_preferences.cc b/chrome/browser/media_gallery/media_galleries_preferences.cc
index c1768c534da704fccfa9d3d359aea2101b8c89b3..339f0835d0869de5354d9f6e6bd0e0be4a04fe75 100644
--- a/chrome/browser/media_gallery/media_galleries_preferences.cc
+++ b/chrome/browser/media_gallery/media_galleries_preferences.cc
@@ -155,9 +155,10 @@ void MediaGalleriesPreferences::MaybeAddDefaultGalleries() {
std::string device_id;
string16 display_name;
FilePath relative_path;
- MediaStorageUtil::GetDeviceInfoFromPath(
- path, &device_id, &display_name, &relative_path);
- AddGallery(device_id, display_name, relative_path, false /*user added*/);
+ if (MediaStorageUtil::GetDeviceInfoFromPath(path, &device_id, &display_name,
+ &relative_path)) {
+ AddGallery(device_id, display_name, relative_path, false /*user added*/);
+ }
}
}
@@ -190,8 +191,17 @@ bool MediaGalleriesPreferences::LookUpGalleryByPath(
std::string device_id;
string16 device_name;
FilePath relative_path;
- MediaStorageUtil::GetDeviceInfoFromPath(path, &device_id, &device_name,
- &relative_path);
+ if (!MediaStorageUtil::GetDeviceInfoFromPath(path, &device_id, &device_name,
+ &relative_path)) {
+ if (gallery_info) {
+ gallery_info->pref_id = kInvalidMediaGalleryPrefId;
+ gallery_info->display_name = string16();
+ gallery_info->device_id = std::string();
+ gallery_info->path = FilePath();
+ gallery_info->type = MediaGalleryPrefInfo::kBlackListed;
+ }
+ return false;
+ }
relative_path = relative_path.NormalizePathSeparators();
MediaGalleryPrefIdSet galleries_on_device =
LookUpGalleriesByDeviceId(device_id);
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_galleries_preferences_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698