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

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

Issue 15511009: Picasa import: MediaFileSystemRegistry and misc. plumbing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@0021-picasa-import-add-picasa-finder-to-preferences
Patch Set: Created 7 years, 7 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_galleries/media_file_system_registry.cc
diff --git a/chrome/browser/media_galleries/media_file_system_registry.cc b/chrome/browser/media_galleries/media_file_system_registry.cc
index 200b4f31a3647d81cc823b1e590cdf6b3c7c6414..475aee981373e303d5f7149a5777ce34cb9acb57 100644
--- a/chrome/browser/media_galleries/media_file_system_registry.cc
+++ b/chrome/browser/media_galleries/media_file_system_registry.cc
@@ -16,6 +16,7 @@
#include "base/stl_util.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/extensions/extension_system.h"
+#include "chrome/browser/media_galleries/imported_media_gallery_registry.h"
#include "chrome/browser/media_galleries/media_file_system_context.h"
#include "chrome/browser/media_galleries/media_galleries_dialog_controller.h"
#include "chrome/browser/media_galleries/media_galleries_preferences_factory.h"
@@ -330,11 +331,33 @@ class ExtensionGalleriesHost
fsid = file_system_context_->RegisterFileSystemForMassStorage(
device_id, path);
} else {
- 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;
+ StorageInfo::Type type;
+ if (!StorageInfo::CrackDeviceId(device_id, &type, NULL))
+ continue;
+
+ switch (type) {
vandebo (ex-Chrome) 2013/05/22 15:05:49 I'd prefer to do this switch in MediaFileSystemCon
tommycli 2013/05/22 18:03:09 Done.
+ case StorageInfo::MTP_OR_PTP:
+ case StorageInfo::MAC_IMAGE_CAPTURE: {
+ 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;
+ break;
+ }
+ case StorageInfo::ITUNES: {
+ NOTIMPLEMENTED();
+ break;
+ }
+ case StorageInfo::PICASA: {
+ fsid = file_system_context_->RegisterFileSystemForPicasa(
+ device_id, path);
+ break;
+ }
+ default: {
+ NOTREACHED();
+ }
+ }
}
DCHECK(!fsid.empty());
@@ -601,6 +624,12 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
return fsid;
}
+ virtual std::string RegisterFileSystemForPicasa(
+ const std::string& device_id, const base::FilePath& path) OVERRIDE {
+ return
+ ImportedMediaGalleryRegistry::RegisterPicasaFilesystemOnUIThread(path);
+ }
+
virtual void RevokeFileSystem(const std::string& fsid) OVERRIDE {
IsolatedContext::GetInstance()->RevokeFileSystem(fsid);
}
@@ -610,6 +639,7 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
}
private:
+
vandebo (ex-Chrome) 2013/05/22 15:05:49 nit: extra line.
tommycli 2013/05/22 18:03:09 Done.
MediaFileSystemRegistry* registry_;
DISALLOW_COPY_AND_ASSIGN(MediaFileSystemContextImpl);

Powered by Google App Engine
This is Rietveld 408576698