Commit 193854e5 authored by tommycli@chromium.org's avatar tommycli@chromium.org

Add Picasa import hooks into MediaFileSystemRegistry.

BUG=151701

Review URL: https://chromiumcodereview.appspot.com/15511009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201997 0039d316-1c4b-4281-b951-d872f2087c98
parent efcf2059
......@@ -39,7 +39,7 @@ class DirectorySkippingFileEnumerator
virtual base::FilePath Next() OVERRIDE {
while (true) {
base::FilePath next = base_enumerator_->Next();
if (next.empty() || !IsDirectory())
if (next.empty() || !base_enumerator_->IsDirectory())
return next;
}
}
......
......@@ -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"
......@@ -576,9 +577,18 @@ class MediaFileSystemRegistry::MediaFileSystemContextImpl
CHECK(path.IsAbsolute());
CHECK(!path.ReferencesParent());
std::string fs_name(extension_misc::kMediaFileSystemPathPart);
const std::string fsid =
IsolatedContext::GetInstance()->RegisterFileSystemForPath(
fileapi::kFileSystemTypeNativeMedia, path, &fs_name);
std::string fsid;
if (StorageInfo::IsITunesDevice(device_id)) {
NOTIMPLEMENTED();
} else if (StorageInfo::IsPicasaDevice(device_id)) {
fsid = ImportedMediaGalleryRegistry::RegisterPicasaFilesystemOnUIThread(
path);
} else {
fsid = IsolatedContext::GetInstance()->RegisterFileSystemForPath(
fileapi::kFileSystemTypeNativeMedia, path, &fs_name);
}
CHECK(!fsid.empty());
return fsid;
}
......
......@@ -130,4 +130,16 @@ bool StorageInfo::IsMassStorageDevice(const std::string& device_id) {
type == PICASA);
}
// static
bool StorageInfo::IsITunesDevice(const std::string& device_id) {
Type type;
return CrackDeviceId(device_id, &type, NULL) && type == ITUNES;
}
// static
bool StorageInfo::IsPicasaDevice(const std::string& device_id) {
Type type;
return CrackDeviceId(device_id, &type, NULL) && type == PICASA;
}
} // namespace chrome
......@@ -62,6 +62,10 @@ struct StorageInfo {
// (type isn't MTP_OR_PTP).
static bool IsMassStorageDevice(const std::string& device_id);
static bool IsITunesDevice(const std::string& device_id);
static bool IsPicasaDevice(const std::string& device_id);
// Unique device id - persists between device attachments.
// This is the string that should be used as the label for a particular
// storage device when interacting with the API. Clients should treat
......
......@@ -749,12 +749,14 @@ void FileAPIMessageFilter::DidCreateSnapshot(
// - the file comes from sandboxed filesystem. Reading sandboxed files is
// always permitted, but only implicitly.
// - the underlying filesystem returned newly created snapshot file.
// - the file comes from an external drive filesystem. The renderer has
// already been granted read permission for the file's nominal path, but
// for drive files, platform paths differ from the nominal paths.
// - the nominal path differs from the platform path. This can happen even
// when the filesystem has been granted permissions. This happens with:
// - Drive filesystems
// - Picasa filesystems
DCHECK(snapshot_file ||
fileapi::SandboxMountPointProvider::IsSandboxType(url.type()) ||
url.type() == fileapi::kFileSystemTypeDrive);
url.type() == fileapi::kFileSystemTypeDrive ||
url.type() == fileapi::kFileSystemTypePicasa);
ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile(
process_id_, platform_path);
if (snapshot_file) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment