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

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

Issue 10911234: Update Windows System Monitor Removable Device Impl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win compile 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
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 16a9974b89adcdd0029ae43ab0bc8317b5dd800e..a951bcef86d3cf88ef44c5fad626052e7f1be4ba 100644
--- a/chrome/browser/media_gallery/media_galleries_preferences.cc
+++ b/chrome/browser/media_gallery/media_galleries_preferences.cc
@@ -137,9 +137,12 @@ MediaGalleriesPreferences::MediaGalleriesPreferences(Profile* profile)
std::string device_id;
string16 display_name;
FilePath relative_path;
- MediaStorageUtil::GetDeviceInfoFromPath(pictures_path, &device_id,
- &display_name, &relative_path);
- AddGallery(device_id, display_name, relative_path, false /*user added*/);
+ if (MediaStorageUtil::GetDeviceInfoFromPath(pictures_path, &device_id,
+ &display_name,
+ &relative_path)) {
+ AddGallery(device_id, display_name, relative_path,
+ false /*user added*/);
+ }
}
}
InitFromPrefs();
@@ -175,8 +178,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);

Powered by Google App Engine
This is Rietveld 408576698