summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media_galleries
diff options
context:
space:
mode:
authorgbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-18 09:41:56 +0000
committergbillock@chromium.org <gbillock@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-18 09:41:56 +0000
commitab11467797d9ae531dbd553312c8991e0b6356cc (patch)
treeb42f6ec829b6f42cfe56254d45004e342ae41398 /chrome/browser/media_galleries
parent47b3782fa5c60f5a914b7cb00a86614373106b66 (diff)
downloadchromium_src-ab11467797d9ae531dbd553312c8991e0b6356cc.zip
chromium_src-ab11467797d9ae531dbd553312c8991e0b6356cc.tar.gz
chromium_src-ab11467797d9ae531dbd553312c8991e0b6356cc.tar.bz2
Eliminate use of the SUPPORT_MTP_DEVICE_FILESYSTEM define.
All desktop platforms now support this type of filesystem. R=thestig@chromium.org BUG=None Review URL: https://chromiumcodereview.appspot.com/15047002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200991 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/media_galleries')
-rw-r--r--chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc16
-rw-r--r--chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h5
-rw-r--r--chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h17
-rw-r--r--chrome/browser/media_galleries/media_file_system_context.h3
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry.cc22
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry.h12
-rw-r--r--chrome/browser/media_galleries/media_file_system_registry_unittest.cc6
-rw-r--r--chrome/browser/media_galleries/mtp_device_delegate_impl.h6
-rw-r--r--chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc14
9 files changed, 4 insertions, 97 deletions
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc
index 50b888f..a737ff7 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.cc
@@ -12,6 +12,7 @@
#include "base/message_loop/message_loop_proxy.h"
#include "base/platform_file.h"
#include "base/sequenced_task_runner.h"
+#include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h"
#include "chrome/browser/media_galleries/fileapi/itunes/itunes_file_util.h"
#include "chrome/browser/media_galleries/fileapi/media_path_filter.h"
#include "chrome/browser/media_galleries/fileapi/native_media_file_util.h"
@@ -30,9 +31,6 @@
#include "webkit/fileapi/local_file_system_operation.h"
#include "webkit/fileapi/native_file_util.h"
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
-#include "chrome/browser/media_galleries/fileapi/device_media_async_file_util.h"
-#endif
using fileapi::FileSystemContext;
using fileapi::FileSystemURL;
@@ -52,14 +50,10 @@ MediaFileSystemMountPointProvider::MediaFileSystemMountPointProvider(
media_path_filter_(new MediaPathFilter()),
native_media_file_util_(
new fileapi::AsyncFileUtilAdapter(new NativeMediaFileUtil())),
+ device_media_async_file_util_(
+ DeviceMediaAsyncFileUtil::Create(profile_path_)),
itunes_file_util_(new fileapi::AsyncFileUtilAdapter(
new itunes::ItunesFileUtil())) {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
- // TODO(kmadhusu): Initialize |device_media_file_util_| in
- // initialization list.
- device_media_async_file_util_.reset(
- DeviceMediaAsyncFileUtil::Create(profile_path_));
-#endif
}
MediaFileSystemMountPointProvider::~MediaFileSystemMountPointProvider() {
@@ -114,9 +108,7 @@ fileapi::AsyncFileUtil* MediaFileSystemMountPointProvider::GetAsyncFileUtil(
case fileapi::kFileSystemTypeNativeMedia:
return native_media_file_util_.get();
case fileapi::kFileSystemTypeDeviceMedia:
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
return device_media_async_file_util_.get();
-#endif
case fileapi::kFileSystemTypeItunes:
return itunes_file_util_.get();
default:
@@ -178,12 +170,10 @@ MediaFileSystemMountPointProvider::CreateFileSystemOperation(
operation_context->SetUserValue(kMediaPathFilterKey,
media_path_filter_.get());
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
if (url.type() == fileapi::kFileSystemTypeDeviceMedia) {
operation_context->SetUserValue(kMTPDeviceDelegateURLKey,
url.filesystem_id());
}
-#endif
return new fileapi::LocalFileSystemOperation(context,
operation_context.Pass());
diff --git a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h
index 0e349a4..ce6ab95 100644
--- a/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h
+++ b/chrome/browser/media_galleries/fileapi/media_file_system_mount_point_provider.h
@@ -6,7 +6,6 @@
#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MEDIA_FILE_SYSTEM_MOUNT_POINT_PROVIDER_H_
#include "base/memory/scoped_ptr.h"
-#include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h"
#include "webkit/fileapi/file_system_mount_point_provider.h"
namespace fileapi {
@@ -17,9 +16,7 @@ namespace chrome {
class MediaPathFilter;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
class DeviceMediaAsyncFileUtil;
-#endif
class MediaFileSystemMountPointProvider
: public fileapi::FileSystemMountPointProvider {
@@ -83,9 +80,7 @@ class MediaFileSystemMountPointProvider
media_copy_or_move_file_validator_factory_;
scoped_ptr<fileapi::AsyncFileUtilAdapter> native_media_file_util_;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
scoped_ptr<DeviceMediaAsyncFileUtil> device_media_async_file_util_;
-#endif
scoped_ptr<fileapi::AsyncFileUtil> itunes_file_util_;
DISALLOW_COPY_AND_ASSIGN(MediaFileSystemMountPointProvider);
diff --git a/chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h b/chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h
deleted file mode 100644
index 1877de8..0000000
--- a/chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_FILE_SYSTEM_CONFIG_H_
-#define CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_FILE_SYSTEM_CONFIG_H_
-
-#include "build/build_config.h"
-
-// Support MTP device file system for Windows, Mac, Linux and ChromeOS.
-// Note that OS_LINUX implies OS_CHROMEOS.
-// TODO(gbillock): remove this define and make this default.
-#if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_LINUX)
-#define SUPPORT_MTP_DEVICE_FILESYSTEM
-#endif
-
-#endif // CHROME_BROWSER_MEDIA_GALLERIES_FILEAPI_MTP_DEVICE_FILE_SYSTEM_CONFIG_H_
diff --git a/chrome/browser/media_galleries/media_file_system_context.h b/chrome/browser/media_galleries/media_file_system_context.h
index eebcd2d..2ea9c82 100644
--- a/chrome/browser/media_galleries/media_file_system_context.h
+++ b/chrome/browser/media_galleries/media_file_system_context.h
@@ -10,7 +10,6 @@
#include <string>
#include "base/memory/ref_counted.h"
-#include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h"
#include "chrome/browser/media_galleries/scoped_mtp_device_map_entry.h"
namespace base {
@@ -30,14 +29,12 @@ class MediaFileSystemContext {
virtual std::string RegisterFileSystemForMassStorage(
const std::string& device_id, const base::FilePath& path) = 0;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
// Registers and returns the file system id for the MTP or PTP device
// specified by |device_id| and |path|. Updates |entry| with the corresponding
// ScopedMTPDeviceMapEntry object.
virtual std::string RegisterFileSystemForMTPDevice(
const std::string& device_id, const base::FilePath& path,
scoped_refptr<ScopedMTPDeviceMapEntry>* entry) = 0;
-#endif
// Revoke the passed |fsid|.
virtual void RevokeFileSystem(const std::string& fsid) = 0;
diff --git a/chrome/browser/media_galleries/media_file_system_registry.cc b/chrome/browser/media_galleries/media_file_system_registry.cc
index b8f7fce..200b4f3 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry.cc
@@ -263,12 +263,10 @@ class ExtensionGalleriesHost
file_system_context_->RevokeFileSystem(gallery->second.fsid);
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);
-#endif
if (pref_id_map_.empty()) {
rph_refs_.Reset();
@@ -284,11 +282,8 @@ class ExtensionGalleriesHost
private:
typedef std::map<MediaGalleryPrefId, MediaFileSystemInfo> PrefIdFsInfoMap;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
typedef std::map<MediaGalleryPrefId, scoped_refptr<ScopedMTPDeviceMapEntry> >
MediaDeviceEntryReferencesMap;
-#endif
-
// Private destructor and friend declaration for ref counted implementation.
friend class base::RefCountedThreadSafe<ExtensionGalleriesHost>;
@@ -297,9 +292,7 @@ class ExtensionGalleriesHost
DCHECK(rph_refs_.empty());
DCHECK(pref_id_map_.empty());
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
DCHECK(media_device_map_references_.empty());
-#endif
}
void GetMediaFileSystemsForAttachedDevices(
@@ -337,16 +330,11 @@ class ExtensionGalleriesHost
fsid = file_system_context_->RegisterFileSystemForMassStorage(
device_id, path);
} else {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
scoped_refptr<ScopedMTPDeviceMapEntry> mtp_device_host;
fsid = file_system_context_->RegisterFileSystemForMTPDevice(
device_id, path, &mtp_device_host);
DCHECK(mtp_device_host.get());
media_device_map_references_[pref_id] = mtp_device_host;
-#else
- NOTIMPLEMENTED();
- continue;
-#endif
}
DCHECK(!fsid.empty());
@@ -395,9 +383,7 @@ class ExtensionGalleriesHost
}
pref_id_map_.clear();
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
media_device_map_references_.clear();
-#endif
no_references_callback_.Run();
}
@@ -412,11 +398,9 @@ class ExtensionGalleriesHost
// A map from the gallery preferences id to the file system information.
PrefIdFsInfoMap pref_id_map_;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
// A map from the gallery preferences id to the corresponding media device
// host object.
MediaDeviceEntryReferencesMap media_device_map_references_;
-#endif
// The set of render processes and web contents that may have references to
// the file system ids this instance manages.
@@ -599,7 +583,6 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
return fsid;
}
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
virtual std::string RegisterFileSystemForMTPDevice(
const std::string& device_id, const base::FilePath& path,
scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE {
@@ -617,7 +600,6 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
*entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value());
return fsid;
}
-#endif
virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE {
IsolatedContext::GetInstance()->RevokeFileSystem(fsid);
@@ -646,9 +628,7 @@ MediaFileSystemRegistry::~MediaFileSystemRegistry() {
StorageMonitor* monitor = StorageMonitor::GetInstance();
if (monitor)
monitor->RemoveObserver(this);
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
DCHECK(mtp_device_delegate_map_.empty());
-#endif
}
void MediaFileSystemRegistry::OnRememberedGalleriesChanged(
@@ -697,7 +677,6 @@ void MediaFileSystemRegistry::OnRememberedGalleriesChanged(
}
}
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
scoped_refptr<ScopedMTPDeviceMapEntry>
MediaFileSystemRegistry::GetOrCreateScopedMTPDeviceMapEntry(
const base::FilePath::StringType& device_location) {
@@ -723,7 +702,6 @@ void MediaFileSystemRegistry::RemoveScopedMTPDeviceMapEntry(
DCHECK(delegate_it != mtp_device_delegate_map_.end());
mtp_device_delegate_map_.erase(delegate_it);
}
-#endif
void MediaFileSystemRegistry::OnExtensionGalleriesHostEmpty(
Profile* profile, const std::string& extension_id) {
diff --git a/chrome/browser/media_galleries/media_file_system_registry.h b/chrome/browser/media_galleries/media_file_system_registry.h
index 6843c3a..4687e7d 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.h
+++ b/chrome/browser/media_galleries/media_file_system_registry.h
@@ -17,13 +17,9 @@
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/prefs/pref_change_registrar.h"
-#include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h"
#include "chrome/browser/media_galleries/media_galleries_preferences.h"
-#include "chrome/browser/storage_monitor/removable_storage_observer.h"
-
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
#include "chrome/browser/media_galleries/mtp_device_delegate_impl.h"
-#endif
+#include "chrome/browser/storage_monitor/removable_storage_observer.h"
class Profile;
@@ -108,17 +104,14 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
// Map a profile to a PrefChangeRegistrar.
typedef std::map<Profile*, PrefChangeRegistrar*> PrefChangeRegistrarMap;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
// Map a MTP or PTP device location to the raw pointer of
// ScopedMTPDeviceMapEntry. It is safe to store a raw pointer in this
// map.
typedef std::map<const base::FilePath::StringType, ScopedMTPDeviceMapEntry*>
MTPDeviceDelegateMap;
-#endif
void OnRememberedGalleriesChanged(PrefService* service);
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
// Returns ScopedMTPDeviceMapEntry object for the given |device_location|.
scoped_refptr<ScopedMTPDeviceMapEntry> GetOrCreateScopedMTPDeviceMapEntry(
const base::FilePath::StringType& device_location);
@@ -127,7 +120,6 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
// |device_location|.
void RemoveScopedMTPDeviceMapEntry(
const base::FilePath::StringType& device_location);
-#endif
void OnExtensionGalleriesHostEmpty(Profile* profile,
const std::string& extension_id);
@@ -138,10 +130,8 @@ class MediaFileSystemRegistry : public RemovableStorageObserver {
PrefChangeRegistrarMap pref_change_registrar_map_;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
// Only accessed on the UI thread.
MTPDeviceDelegateMap mtp_device_delegate_map_;
-#endif
scoped_ptr<MediaFileSystemContext> file_system_context_;
diff --git a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
index 7e087a5..10db660 100644
--- a/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry_unittest.cc
@@ -81,11 +81,9 @@ class TestMediaFileSystemContext : public MediaFileSystemContext {
virtual std::string RegisterFileSystemForMassStorage(
const std::string& device_id, const base::FilePath& path) OVERRIDE;
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
virtual std::string RegisterFileSystemForMTPDevice(
const std::string& device_id, const base::FilePath& path,
scoped_refptr<ScopedMTPDeviceMapEntry>* entry) OVERRIDE;
-#endif
virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE;
@@ -135,7 +133,6 @@ std::string TestMediaFileSystemContext::RegisterFileSystemForMassStorage(
return AddFSEntry(device_id, path);
}
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
std::string TestMediaFileSystemContext::RegisterFileSystemForMTPDevice(
const std::string& device_id, const base::FilePath& path,
scoped_refptr<ScopedMTPDeviceMapEntry>* entry) {
@@ -144,7 +141,6 @@ std::string TestMediaFileSystemContext::RegisterFileSystemForMTPDevice(
*entry = registry_->GetOrCreateScopedMTPDeviceMapEntry(path.value());
return AddFSEntry(device_id, path);
}
-#endif
void TestMediaFileSystemContext::RevokeFileSystem(const std::string& fsid) {
if (!ContainsKey(file_systems_by_id_, fsid))
@@ -889,7 +885,6 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameDefault) {
// TODO(gbillock): Put the platform-specific parts of this test in tests
// for those classes, not here. This test, internally, ends up creating an
// MTP delegate.
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
#if !defined(OS_MACOSX)
TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) {
FSInfoMap galleries_info;
@@ -907,7 +902,6 @@ TEST_F(MediaFileSystemRegistryTest, GalleryNameMTP) {
true /*removable*/, true /* media device */);
}
#endif
-#endif
TEST_F(MediaFileSystemRegistryTest, GalleryNameDCIM) {
FSInfoMap galleries_info;
diff --git a/chrome/browser/media_galleries/mtp_device_delegate_impl.h b/chrome/browser/media_galleries/mtp_device_delegate_impl.h
index 3490c6e..f23c187 100644
--- a/chrome/browser/media_galleries/mtp_device_delegate_impl.h
+++ b/chrome/browser/media_galleries/mtp_device_delegate_impl.h
@@ -5,12 +5,6 @@
#ifndef CHROME_BROWSER_MEDIA_GALLERIES_MTP_DEVICE_DELEGATE_IMPL_H_
#define CHROME_BROWSER_MEDIA_GALLERIES_MTP_DEVICE_DELEGATE_IMPL_H_
-#include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h"
-
-#if !defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
-#error "Media file system is not supported for this platform."
-#endif
-
#include "base/callback_forward.h"
#include "base/files/file_path.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
diff --git a/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc b/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc
index 2444f0a..bea2d88 100644
--- a/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc
+++ b/chrome/browser/media_galleries/scoped_mtp_device_map_entry.cc
@@ -4,9 +4,6 @@
#include "chrome/browser/media_galleries/scoped_mtp_device_map_entry.h"
-#include "chrome/browser/media_galleries/fileapi/mtp_device_file_system_config.h"
-
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
#include "base/bind.h"
#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_map_service.h"
@@ -14,13 +11,10 @@
#include "content/public/browser/browser_thread.h"
#include "webkit/fileapi/file_system_task_runners.h"
-#endif
-
namespace chrome {
namespace {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
bool IsMediaTaskRunnerThread() {
base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool();
base::SequencedWorkerPool::SequenceToken media_sequence_token =
@@ -50,8 +44,6 @@ void RemoveDeviceDelegate(const base::FilePath::StringType& device_location) {
base::Bind(&OnDeviceAsyncDelegateDestroyed, device_location));
}
-#endif
-
} // namespace
ScopedMTPDeviceMapEntry::ScopedMTPDeviceMapEntry(
@@ -62,7 +54,6 @@ ScopedMTPDeviceMapEntry::ScopedMTPDeviceMapEntry(
}
void ScopedMTPDeviceMapEntry::Init() {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
CreateMTPDeviceAsyncDelegateCallback callback =
base::Bind(&ScopedMTPDeviceMapEntry::OnMTPDeviceAsyncDelegateCreated,
this);
@@ -72,23 +63,18 @@ void ScopedMTPDeviceMapEntry::Init() {
base::Bind(&CreateMTPDeviceAsyncDelegate,
device_location_,
callback));
-#endif
}
ScopedMTPDeviceMapEntry::~ScopedMTPDeviceMapEntry() {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
RemoveDeviceDelegate(device_location_);
on_destruction_callback_.Run();
-#endif
}
void ScopedMTPDeviceMapEntry::OnMTPDeviceAsyncDelegateCreated(
MTPDeviceAsyncDelegate* delegate) {
-#if defined(SUPPORT_MTP_DEVICE_FILESYSTEM)
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
MTPDeviceMapService::GetInstance()->AddAsyncDelegate(
device_location_, delegate);
-#endif
}
} // namespace chrome