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

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

Issue 11297002: [Media Gallery] Added code to support mtp device media file system on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + Fixed win compile error by implementing GetMTPStorageInfoFromDeviceId in TestStorageNotifi… Created 7 years, 11 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_file_system_registry_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_file_system_registry.cc
diff --git a/chrome/browser/media_gallery/media_file_system_registry.cc b/chrome/browser/media_gallery/media_file_system_registry.cc
index 412fedb462d8aac077a246a0bb13874c1bf88ce5..ce65bf107cfb36881899f7a1266c825929f29400 100644
--- a/chrome/browser/media_gallery/media_file_system_registry.cc
+++ b/chrome/browser/media_gallery/media_file_system_registry.cc
@@ -11,6 +11,7 @@
#include "base/bind.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
@@ -30,6 +31,7 @@
#include "chrome/browser/system_monitor/media_storage_util.h"
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/common/extensions/extension.h"
@@ -62,6 +64,19 @@ struct InvalidatedGalleriesInfo {
std::set<MediaGalleryPrefId> pref_ids;
};
+#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
+// Returns true if the media transfer protocol (MTP) device operations are
+// allowed for this platform.
+// TODO(kmadhusu): Remove this function after fixing crbug.com/154835.
+bool IsMTPDeviceMediaOperationsEnabled() {
+#if defined(OS_WIN)
+ return CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableMediaTransferProtocolDeviceOperations);
+#endif
+ return true;
+}
+#endif
+
} // namespace
MediaFileSystemInfo::MediaFileSystemInfo(const std::string& fs_name,
@@ -150,10 +165,12 @@ class ExtensionGalleriesHost
pref_id_map_.erase(gallery);
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
- MediaDeviceEntryReferencesMap::iterator mtp_device_host =
- media_device_map_references_.find(id);
- if (mtp_device_host != media_device_map_references_.end())
- media_device_map_references_.erase(mtp_device_host);
+ if (IsMTPDeviceMediaOperationsEnabled()) {
+ MediaDeviceEntryReferencesMap::iterator mtp_device_host =
+ media_device_map_references_.find(id);
+ if (mtp_device_host != media_device_map_references_.end())
+ media_device_map_references_.erase(mtp_device_host);
+ }
#endif
if (pref_id_map_.empty()) {
@@ -273,6 +290,9 @@ class ExtensionGalleriesHost
device_id, path);
} else {
#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
+ if (!IsMTPDeviceMediaOperationsEnabled())
+ continue;
+
scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host;
fsid = file_system_context_->RegisterFileSystemForMTPDevice(
device_id, path, &mtp_device_host);
« no previous file with comments | « no previous file | chrome/browser/media_gallery/media_file_system_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698