diff options
author | mtomasz <mtomasz@chromium.org> | 2015-05-07 22:48:07 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-08 05:48:33 +0000 |
commit | 09db9160ab8676c5683383c5f39b59fe877a4e32 (patch) | |
tree | 422ac41c6c551bf2f5f1b7cd87e5a83925c8f6b6 | |
parent | a9b0c302459c957a57aa1501e426cf088e16c543 (diff) | |
download | chromium_src-09db9160ab8676c5683383c5f39b59fe877a4e32.zip chromium_src-09db9160ab8676c5683383c5f39b59fe877a4e32.tar.gz chromium_src-09db9160ab8676c5683383c5f39b59fe877a4e32.tar.bz2 |
Declare providing extension capabilities in the manifest.
Instead of mount options and runtime checks for event handlers, this CL moves
those capabilities to the manifest.
TEST=browser_tests: *FileSystemProvider*{Mount|Configure}
BUG=None
Review URL: https://codereview.chromium.org/1077823005
Cr-Commit-Position: refs/heads/master@{#328932}
28 files changed, 248 insertions, 294 deletions
diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc index ecf5e31..06e9cfa 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_misc.cc @@ -34,6 +34,7 @@ #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" #include "chrome/common/extensions/api/file_manager_private.h" +#include "chrome/common/extensions/api/manifest_types.h" #include "chrome/common/pref_names.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_manager.h" @@ -446,8 +447,22 @@ FileManagerPrivateGetProvidingExtensionsFunction::Run() { new ProvidingExtension); providing_extension->extension_id = info.extension_id; providing_extension->name = info.name; - providing_extension->can_configure = info.can_configure; - providing_extension->can_add = info.can_add; + providing_extension->configurable = info.capabilities.configurable(); + providing_extension->multiple_mounts = info.capabilities.multiple_mounts(); + switch (info.capabilities.source()) { + case SOURCE_FILE: + providing_extension->source = + api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_FILE; + break; + case SOURCE_DEVICE: + providing_extension->source = + api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_DEVICE; + break; + case SOURCE_NETWORK: + providing_extension->source = + api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NETWORK; + break; + } providing_extensions.push_back(providing_extension); } @@ -493,7 +508,6 @@ FileManagerPrivateConfigureProvidedFileSystemFunction::Run() { using file_manager::Volume; VolumeManager* const volume_manager = VolumeManager::Get(chrome_details_.GetProfile()); - LOG(ERROR) << "LOOKING FOR: " << params->volume_id; base::WeakPtr<Volume> volume = volume_manager->FindVolumeById(params->volume_id); if (!volume.get()) diff --git a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc index 1b71ef0..fdcfdc6 100644 --- a/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc +++ b/chrome/browser/chromeos/extensions/file_manager/private_api_util.cc @@ -182,23 +182,6 @@ void VolumeToVolumeMetadata( new std::string(volume.source_path().AsUTF8Unsafe())); } - switch (volume.volume_source()) { - case VOLUME_SOURCE_UNKNOWN: - volume_metadata->volume_source = file_manager_private::VOLUME_SOURCE_NONE; - break; - case VOLUME_SOURCE_FILE: - volume_metadata->volume_source = file_manager_private::VOLUME_SOURCE_FILE; - break; - case VOLUME_SOURCE_DEVICE: - volume_metadata->volume_source = - file_manager_private::VOLUME_SOURCE_DEVICE; - break; - case VOLUME_SOURCE_NETWORK: - volume_metadata->volume_source = - file_manager_private::VOLUME_SOURCE_NETWORK; - break; - } - if (volume.type() == VOLUME_TYPE_PROVIDED) { volume_metadata->extension_id.reset(new std::string(volume.extension_id())); volume_metadata->file_system_id.reset( diff --git a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc index 643bb3d..09a8920 100644 --- a/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc +++ b/chrome/browser/chromeos/extensions/file_system_provider/file_system_provider_api.cc @@ -70,22 +70,6 @@ scoped_ptr<ProvidedFileSystemObserver::Changes> ParseChanges( return results; } -// Converts the file system source from the IDL type to a native type. -chromeos::file_system_provider::Source ParseSource( - const api::file_system_provider::FileSystemSource& source) { - switch (source) { - case api::file_system_provider::FILE_SYSTEM_SOURCE_FILE: - return chromeos::file_system_provider::SOURCE_FILE; - case api::file_system_provider::FILE_SYSTEM_SOURCE_DEVICE: - return chromeos::file_system_provider::SOURCE_DEVICE; - case api::file_system_provider::FILE_SYSTEM_SOURCE_NETWORK: - return chromeos::file_system_provider::SOURCE_NETWORK; - case api::file_system_provider::FILE_SYSTEM_SOURCE_NONE: - return chromeos::file_system_provider::SOURCE_UNKNOWN; - } - return chromeos::file_system_provider::SOURCE_UNKNOWN; -} - // Fills the IDL's FileSystemInfo with FSP's ProvidedFileSystemInfo and // Watchers. void FillFileSystemInfo(const ProvidedFileSystemInfo& file_system_info, @@ -99,20 +83,6 @@ void FillFileSystemInfo(const ProvidedFileSystemInfo& file_system_info, output->display_name = file_system_info.display_name(); output->writable = file_system_info.writable(); output->opened_files_limit = file_system_info.opened_files_limit(); - switch (file_system_info.source()) { - case chromeos::file_system_provider::SOURCE_FILE: - output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_FILE; - break; - case chromeos::file_system_provider::SOURCE_DEVICE: - output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_DEVICE; - break; - case chromeos::file_system_provider::SOURCE_NETWORK: - output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_NETWORK; - break; - case chromeos::file_system_provider::SOURCE_UNKNOWN: - output->source = api::file_system_provider::FILE_SYSTEM_SOURCE_NONE; - break; - } std::vector<linked_ptr<Watcher>> watcher_items; for (const auto& watcher : watchers) { @@ -182,7 +152,6 @@ bool FileSystemProviderMountFunction::RunSync() { ? *params->options.opened_files_limit.get() : 0; options.supports_notify_tag = params->options.supports_notify_tag; - options.source = ParseSource(params->options.source); const base::File::Error result = service->MountFileSystem(extension_id(), options); diff --git a/chrome/browser/chromeos/file_manager/volume_manager.cc b/chrome/browser/chromeos/file_manager/volume_manager.cc index 9ea2bbc..6f0e6ef 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.cc +++ b/chrome/browser/chromeos/file_manager/volume_manager.cc @@ -150,7 +150,6 @@ Volume* Volume::CreateForDrive(Profile* profile) { volume->type_ = VOLUME_TYPE_GOOGLE_DRIVE; volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; volume->source_path_ = drive_path; - volume->volume_source_ = VOLUME_SOURCE_NETWORK; volume->mount_path_ = drive_path; volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; volume->is_parent_ = false; @@ -166,7 +165,6 @@ Volume* Volume::CreateForDownloads(const base::FilePath& downloads_path) { volume->type_ = VOLUME_TYPE_DOWNLOADS_DIRECTORY; volume->device_type_ = chromeos::DEVICE_TYPE_UNKNOWN; // Keep source_path empty. - volume->volume_source_ = VOLUME_SOURCE_DEVICE; volume->mount_path_ = downloads_path; volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; volume->is_parent_ = false; @@ -183,10 +181,6 @@ Volume* Volume::CreateForRemovable( Volume* const volume = new Volume; volume->type_ = MountTypeToVolumeType(mount_point.mount_type); volume->source_path_ = base::FilePath(mount_point.source_path); - volume->volume_source_ = - mount_point.mount_type == chromeos::MOUNT_TYPE_ARCHIVE - ? VOLUME_SOURCE_FILE - : VOLUME_SOURCE_DEVICE; volume->mount_path_ = base::FilePath(mount_point.mount_path); volume->mount_condition_ = mount_point.mount_condition; volume->volume_label_ = volume->mount_path().BaseName().AsUTF8Unsafe(); @@ -215,20 +209,6 @@ Volume* Volume::CreateForProvidedFileSystem( Volume* const volume = new Volume; volume->file_system_id_ = file_system_info.file_system_id(); volume->extension_id_ = file_system_info.extension_id(); - switch (file_system_info.source()) { - case chromeos::file_system_provider::SOURCE_UNKNOWN: - volume->volume_source_ = VOLUME_SOURCE_UNKNOWN; - break; - case chromeos::file_system_provider::SOURCE_FILE: - volume->volume_source_ = VOLUME_SOURCE_FILE; - break; - case chromeos::file_system_provider::SOURCE_DEVICE: - volume->volume_source_ = VOLUME_SOURCE_DEVICE; - break; - case chromeos::file_system_provider::SOURCE_NETWORK: - volume->volume_source_ = VOLUME_SOURCE_NETWORK; - break; - } volume->volume_label_ = file_system_info.display_name(); volume->type_ = VOLUME_TYPE_PROVIDED; volume->mount_path_ = file_system_info.mount_path(); @@ -254,7 +234,6 @@ Volume* Volume::CreateForMTP(const base::FilePath& mount_path, volume->volume_id_ = kMtpVolumeIdPrefix + label; volume->volume_label_ = label; volume->source_path_ = mount_path; - volume->volume_source_ = VOLUME_SOURCE_DEVICE; volume->device_type_ = chromeos::DEVICE_TYPE_MOBILE; return volume; } @@ -268,7 +247,6 @@ Volume* Volume::CreateForTesting(const base::FilePath& path, volume->type_ = volume_type; volume->device_type_ = device_type; // Keep source_path empty. - volume->volume_source_ = VOLUME_SOURCE_DEVICE; volume->mount_path_ = path; volume->mount_condition_ = chromeos::disks::MOUNT_CONDITION_NONE; volume->is_parent_ = false; diff --git a/chrome/browser/chromeos/file_manager/volume_manager.h b/chrome/browser/chromeos/file_manager/volume_manager.h index 9b7aef6..efaf20f 100644 --- a/chrome/browser/chromeos/file_manager/volume_manager.h +++ b/chrome/browser/chromeos/file_manager/volume_manager.h @@ -57,14 +57,6 @@ enum VolumeType { NUM_VOLUME_TYPE, }; -// Source of a volume's data. -enum VolumeSource { - VOLUME_SOURCE_UNKNOWN, - VOLUME_SOURCE_FILE, - VOLUME_SOURCE_DEVICE, - VOLUME_SOURCE_NETWORK -}; - // Says how was the mount performed, whether due to user interaction, or // automatic. User interaction includes both hardware (pluggins a USB stick) // or software (mounting a ZIP archive) interaction. @@ -105,7 +97,6 @@ class Volume : public base::SupportsWeakPtr<Volume> { const std::string& volume_id() const { return volume_id_; } const std::string& file_system_id() const { return file_system_id_; } const std::string& extension_id() const { return extension_id_; } - const VolumeSource volume_source() const { return volume_source_; } VolumeType type() const { return type_; } chromeos::DeviceType device_type() const { return device_type_; } const base::FilePath& source_path() const { return source_path_; } @@ -136,9 +127,6 @@ class Volume : public base::SupportsWeakPtr<Volume> { // to an empty string. std::string extension_id_; - // The source of the file system's data. - VolumeSource volume_source_; - // The type of mounted volume. VolumeType type_; diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc index e09e780..db8d82d 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.cc @@ -10,7 +10,6 @@ namespace file_system_provider { MountOptions::MountOptions() : writable(false), - source(SOURCE_UNKNOWN), supports_notify_tag(false), opened_files_limit(0) { } @@ -20,13 +19,12 @@ MountOptions::MountOptions(const std::string& file_system_id, : file_system_id(file_system_id), display_name(display_name), writable(false), - source(SOURCE_UNKNOWN), supports_notify_tag(false), opened_files_limit(0) { } ProvidedFileSystemInfo::ProvidedFileSystemInfo() - : writable_(false), source_(SOURCE_UNKNOWN), supports_notify_tag_(false) { + : writable_(false), supports_notify_tag_(false) { } ProvidedFileSystemInfo::ProvidedFileSystemInfo( @@ -37,7 +35,6 @@ ProvidedFileSystemInfo::ProvidedFileSystemInfo( file_system_id_(mount_options.file_system_id), display_name_(mount_options.display_name), writable_(mount_options.writable), - source_(mount_options.source), supports_notify_tag_(mount_options.supports_notify_tag), opened_files_limit_(mount_options.opened_files_limit), mount_path_(mount_path) { diff --git a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h index 53a610f..795577c 100644 --- a/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h +++ b/chrome/browser/chromeos/file_system_provider/provided_file_system_info.h @@ -12,9 +12,6 @@ namespace chromeos { namespace file_system_provider { -// Source of the file system's contents. -enum Source { SOURCE_UNKNOWN, SOURCE_FILE, SOURCE_DEVICE, SOURCE_NETWORK }; - // Options for creating the provided file system info. struct MountOptions { MountOptions(); @@ -26,7 +23,6 @@ struct MountOptions { std::string file_system_id; std::string display_name; bool writable; - Source source; bool supports_notify_tag; int opened_files_limit; }; @@ -46,7 +42,6 @@ class ProvidedFileSystemInfo { const std::string& file_system_id() const { return file_system_id_; } const std::string& display_name() const { return display_name_; } bool writable() const { return writable_; } - Source source() const { return source_; } bool supports_notify_tag() const { return supports_notify_tag_; } int opened_files_limit() const { return opened_files_limit_; } const base::FilePath& mount_path() const { return mount_path_; } @@ -64,9 +59,6 @@ class ProvidedFileSystemInfo { // Whether the file system is writable or just read-only. bool writable_; - // Source of the file system's contents. By default SOURCE_UNKNOWN. - Source source_; - // Supports tags for file/directory change notifications. bool supports_notify_tag_; diff --git a/chrome/browser/chromeos/file_system_provider/registry.cc b/chrome/browser/chromeos/file_system_provider/registry.cc index d6d6404..e301279 100644 --- a/chrome/browser/chromeos/file_system_provider/registry.cc +++ b/chrome/browser/chromeos/file_system_provider/registry.cc @@ -26,7 +26,6 @@ namespace file_system_provider { const char kPrefKeyFileSystemId[] = "file-system-id"; const char kPrefKeyDisplayName[] = "display-name"; const char kPrefKeyWritable[] = "writable"; -const char kPrefKeySource[] = "source"; const char kPrefKeySupportsNotifyTag[] = "supports-notify-tag"; const char kPrefKeyWatchers[] = "watchers"; const char kPrefKeyWatcherEntryPath[] = "entry-path"; @@ -39,41 +38,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDictionaryPref(prefs::kFileSystemProviderMounted); } -std::string SourceToString(Source source) { - switch (source) { - case SOURCE_UNKNOWN: - return "unknown"; - case SOURCE_FILE: - return "file"; - case SOURCE_DEVICE: - return "device"; - case SOURCE_NETWORK: - return "network"; - } - NOTREACHED(); - return std::string(); -} - -bool StringToSource(const std::string& source, Source* result) { - if (source.compare("unknown") == 0) { - *result = SOURCE_UNKNOWN; - return true; - } - if (source.compare("file") == 0) { - *result = SOURCE_FILE; - return true; - } - if (source.compare("device") == 0) { - *result = SOURCE_DEVICE; - return true; - } - if (source.compare("network") == 0) { - *result = SOURCE_NETWORK; - return true; - } - return false; -} - Registry::Registry(Profile* profile) : profile_(profile) { } @@ -90,8 +54,6 @@ void Registry::RememberFileSystem( file_system_info.display_name()); file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable, file_system_info.writable()); - file_system->SetStringWithoutPathExpansion( - kPrefKeySource, SourceToString(file_system_info.source())); file_system->SetBooleanWithoutPathExpansion( kPrefKeySupportsNotifyTag, file_system_info.supports_notify_tag()); file_system->SetIntegerWithoutPathExpansion( @@ -189,8 +151,6 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems( bool writable = false; bool supports_notify_tag = false; int opened_files_limit = 0; - std::string source_as_string; - Source source = SOURCE_UNKNOWN; // TODO(mtomasz): Move opened files limit to the mandatory list above in // M42. @@ -207,9 +167,7 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems( // Optional fields. (file_system->GetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit, &opened_files_limit) && - (file_system->GetStringWithoutPathExpansion(kPrefKeySource, - &source_as_string) && - !StringToSource(source_as_string, &source)))) { + opened_files_limit < 0)) { LOG(ERROR) << "Malformed provided file system information in preferences."; continue; @@ -219,7 +177,6 @@ scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems( options.file_system_id = file_system_id; options.display_name = display_name; options.writable = writable; - options.source = source; options.supports_notify_tag = supports_notify_tag; options.opened_files_limit = opened_files_limit; diff --git a/chrome/browser/chromeos/file_system_provider/registry.h b/chrome/browser/chromeos/file_system_provider/registry.h index 9072905..f264d16 100644 --- a/chrome/browser/chromeos/file_system_provider/registry.h +++ b/chrome/browser/chromeos/file_system_provider/registry.h @@ -10,6 +10,7 @@ #include "base/memory/scoped_ptr.h" #include "chrome/browser/chromeos/file_system_provider/registry_interface.h" #include "chrome/browser/chromeos/file_system_provider/watcher.h" +#include "chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h" class Profile; @@ -24,7 +25,6 @@ namespace file_system_provider { extern const char kPrefKeyFileSystemId[]; extern const char kPrefKeyDisplayName[]; extern const char kPrefKeyWritable[]; -extern const char kPrefKeySource[]; extern const char kPrefKeySupportsNotifyTag[]; extern const char kPrefKeyWatchers[]; extern const char kPrefKeyWatcherEntryPath[]; @@ -38,11 +38,6 @@ class ProvidedFileSystemInfo; // Registers preferences to remember registered file systems between reboots. void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); -// Converts a file system's data source value back and forth between Source and -// std::string types. -std::string SourceToString(Source source); -bool StringToSource(const std::string& source, Source* result); - // Remembers and restores file systems in a persistent storage. class Registry : public RegistryInterface { public: diff --git a/chrome/browser/chromeos/file_system_provider/registry_unittest.cc b/chrome/browser/chromeos/file_system_provider/registry_unittest.cc index 8d58371..b02359f 100644 --- a/chrome/browser/chromeos/file_system_provider/registry_unittest.cc +++ b/chrome/browser/chromeos/file_system_provider/registry_unittest.cc @@ -29,7 +29,6 @@ const char kPersistentOrigin[] = "chrome-extension://efgefgefgefgefgefgefgefgefgefgefgefge/"; const char kExtensionId[] = "mbflcebpggnecokmikipoihdbecnjfoj"; const char kDisplayName[] = "Camera Pictures"; -const Source kSource = SOURCE_NETWORK; // The dot in the file system ID is there in order to check that saving to // preferences works correctly. File System ID is used as a key in @@ -45,7 +44,6 @@ void RememberFakeFileSystem(TestingProfile* profile, const std::string& file_system_id, const std::string& display_name, bool writable, - Source source, bool supports_notify_tag, int opened_files_limit, const Watcher& watcher) { @@ -62,8 +60,6 @@ void RememberFakeFileSystem(TestingProfile* profile, kFileSystemId); file_system->SetStringWithoutPathExpansion(kPrefKeyDisplayName, kDisplayName); file_system->SetBooleanWithoutPathExpansion(kPrefKeyWritable, writable); - file_system->SetStringWithoutPathExpansion(kPrefKeySource, - SourceToString(source)); file_system->SetBooleanWithoutPathExpansion(kPrefKeySupportsNotifyTag, supports_notify_tag); file_system->SetIntegerWithoutPathExpansion(kPrefKeyOpenedFilesLimit, @@ -128,9 +124,8 @@ class FileSystemProviderRegistryTest : public testing::Test { TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) { // Create a fake entry in the preferences. RememberFakeFileSystem(profile_, kExtensionId, kFileSystemId, kDisplayName, - true /* writable */, kSource, - true /* supports_notify_tag */, kOpenedFilesLimit, - fake_watcher_); + true /* writable */, true /* supports_notify_tag */, + kOpenedFilesLimit, fake_watcher_); scoped_ptr<RegistryInterface::RestoredFileSystems> restored_file_systems = registry_->RestoreFileSystems(kExtensionId); @@ -142,7 +137,6 @@ TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) { EXPECT_EQ(kFileSystemId, restored_file_system.options.file_system_id); EXPECT_EQ(kDisplayName, restored_file_system.options.display_name); EXPECT_TRUE(restored_file_system.options.writable); - EXPECT_EQ(kSource, restored_file_system.options.source); EXPECT_TRUE(restored_file_system.options.supports_notify_tag); EXPECT_EQ(kOpenedFilesLimit, restored_file_system.options.opened_files_limit); @@ -159,7 +153,6 @@ TEST_F(FileSystemProviderRegistryTest, RestoreFileSystems) { TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) { MountOptions options(kFileSystemId, kDisplayName); options.writable = true; - options.source = kSource; options.supports_notify_tag = true; options.opened_files_limit = kOpenedFilesLimit; @@ -206,11 +199,6 @@ TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) { file_system->GetBooleanWithoutPathExpansion(kPrefKeyWritable, &writable)); EXPECT_TRUE(writable); - std::string source_as_string; - EXPECT_TRUE(file_system->GetStringWithoutPathExpansion(kPrefKeySource, - &source_as_string)); - EXPECT_EQ("network", source_as_string); - bool supports_notify_tag = false; EXPECT_TRUE(file_system->GetBooleanWithoutPathExpansion( kPrefKeySupportsNotifyTag, &supports_notify_tag)); @@ -260,9 +248,8 @@ TEST_F(FileSystemProviderRegistryTest, RememberFileSystem) { TEST_F(FileSystemProviderRegistryTest, ForgetFileSystem) { // Create a fake file systems in the preferences. RememberFakeFileSystem(profile_, kExtensionId, kFileSystemId, kDisplayName, - true /* writable */, kSource, - true /* supports_notify_tag */, kOpenedFilesLimit, - fake_watcher_); + true /* writable */, true /* supports_notify_tag */, + kOpenedFilesLimit, fake_watcher_); registry_->ForgetFileSystem(kExtensionId, kFileSystemId); @@ -329,28 +316,5 @@ TEST_F(FileSystemProviderRegistryTest, UpdateWatcherTag) { EXPECT_EQ(fake_watcher_.last_tag, last_tag); } -TEST_F(FileSystemProviderRegistryTest, SourceToString) { - { - Source result = SOURCE_UNKNOWN; - EXPECT_TRUE(StringToSource(SourceToString(SOURCE_FILE), &result)); - EXPECT_EQ(SOURCE_FILE, result); - } - { - Source result = SOURCE_UNKNOWN; - EXPECT_TRUE(StringToSource(SourceToString(SOURCE_DEVICE), &result)); - EXPECT_EQ(SOURCE_DEVICE, result); - } - { - Source result = SOURCE_UNKNOWN; - EXPECT_TRUE(StringToSource(SourceToString(SOURCE_NETWORK), &result)); - EXPECT_EQ(SOURCE_NETWORK, result); - } - { - Source result = SOURCE_FILE; - EXPECT_TRUE(StringToSource(SourceToString(SOURCE_UNKNOWN), &result)); - EXPECT_EQ(SOURCE_UNKNOWN, result); - } -} - } // namespace file_system_provider } // namespace chromeos diff --git a/chrome/browser/chromeos/file_system_provider/service.cc b/chrome/browser/chromeos/file_system_provider/service.cc index 18854f8..6dccf40 100644 --- a/chrome/browser/chromeos/file_system_provider/service.cc +++ b/chrome/browser/chromeos/file_system_provider/service.cc @@ -43,8 +43,7 @@ ProvidedFileSystemInterface* CreateProvidedFileSystem( } // namespace -ProvidingExtensionInfo::ProvidingExtensionInfo() - : can_configure(false), can_add(false) { +ProvidingExtensionInfo::ProvidingExtensionInfo() { } ProvidingExtensionInfo::~ProvidingExtensionInfo() { @@ -309,10 +308,6 @@ std::vector<ProvidingExtensionInfo> Service::GetProvidingExtensionInfoList() extensions::ExtensionRegistry::Get(profile_); DCHECK(registry); - extensions::EventRouter* const router = - extensions::EventRouter::Get(profile_); - DCHECK(router); - std::vector<ProvidingExtensionInfo> result; for (const auto& extension : registry->enabled_extensions()) { if (!extension->permissions_data()->HasAPIPermission( @@ -323,13 +318,11 @@ std::vector<ProvidingExtensionInfo> Service::GetProvidingExtensionInfoList() ProvidingExtensionInfo info; info.extension_id = extension->id(); info.name = extension->name(); - info.can_configure = router->ExtensionHasEventListener( - extension->id(), extensions::api::file_system_provider:: - OnConfigureRequested::kEventName); - info.can_add = router->ExtensionHasEventListener( - extension->id(), - extensions::api::file_system_provider::OnMountRequested::kEventName); - + const extensions::FileSystemProviderCapabilities* capabilities = + extensions::FileSystemProviderCapabilities::Get(extension.get()); + info.capabilities = capabilities + ? *capabilities + : extensions::FileSystemProviderCapabilities(); result.push_back(info); } diff --git a/chrome/browser/chromeos/file_system_provider/service.h b/chrome/browser/chromeos/file_system_provider/service.h index d2477f5..59507e5 100644 --- a/chrome/browser/chromeos/file_system_provider/service.h +++ b/chrome/browser/chromeos/file_system_provider/service.h @@ -23,6 +23,7 @@ #include "chrome/browser/chromeos/file_system_provider/watcher.h" #include "chrome/browser/profiles/profile.h" #include "chrome/common/extensions/api/file_system_provider.h" +#include "chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h" #include "components/keyed_service/core/keyed_service.h" #include "content/public/browser/browser_context.h" #include "extensions/browser/extension_registry_observer.h" @@ -57,8 +58,7 @@ struct ProvidingExtensionInfo { std::string extension_id; std::string name; - bool can_configure; - bool can_add; + extensions::FileSystemProviderCapabilities capabilities; }; // Manages and registers the file system provider service. Maintains provided diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi index 7c8439b..8a72712e 100644 --- a/chrome/chrome_common.gypi +++ b/chrome/chrome_common.gypi @@ -207,6 +207,8 @@ 'chrome_common_extensions_chromeos_sources': [ 'common/extensions/api/file_browser_handlers/file_browser_handler.cc', 'common/extensions/api/file_browser_handlers/file_browser_handler.h', + 'common/extensions/api/file_system_provider/file_system_provider_handler.cc', + 'common/extensions/api/file_system_provider/file_system_provider_handler.h', 'common/extensions/api/input_ime/input_components_handler.cc', 'common/extensions/api/input_ime/input_components_handler.h', ], @@ -375,6 +377,9 @@ }], ], }], + ['enable_extensions==1 and chromeos==1', { + 'sources': [ '<@(chrome_common_extensions_chromeos_sources)' ], + }], ['OS=="win" or OS=="mac"', { 'sources': [ '<@(chrome_common_win_mac_sources)' ], }], diff --git a/chrome/common/extensions/api/_manifest_features.json b/chrome/common/extensions/api/_manifest_features.json index daece59..9a1213d 100644 --- a/chrome/common/extensions/api/_manifest_features.json +++ b/chrome/common/extensions/api/_manifest_features.json @@ -152,6 +152,12 @@ "location": "component" } ], + "file_system_provider": [ + { + "channel": "dev", + "extension_types": ["extension", "platform_app"] + } + ], "homepage_url": { "channel": "stable", "extension_types": ["extension", "legacy_packaged_app"] diff --git a/chrome/common/extensions/api/file_manager_private.idl b/chrome/common/extensions/api/file_manager_private.idl index 230fab8..e1360a4 100644 --- a/chrome/common/extensions/api/file_manager_private.idl +++ b/chrome/common/extensions/api/file_manager_private.idl @@ -173,20 +173,6 @@ enum EntryTagVisibility { public }; -// Source of the volume data. -enum VolumeSource { - // Represents a mounted file. In most cases, simply an archive. - file, - - // Representing a device, eg. an MTP device. Also, used for Downloads as it's - // containing files stored on the Chrome OS device. - device, - - // Used for volumes which contain files on a remote machine, eg. Drive or - // cloud services implemented via the File System Provider API. - network -}; - // A file task represents an action that the file manager can perform over the // currently selected files. See // chrome/browser/chromeos/extensions/file_manager/file_tasks.h for details @@ -300,9 +286,6 @@ dictionary VolumeMetadata { // Extension providing this volume (for provided file systems). DOMString? extensionId; - // Source of the volume data. - VolumeSource? volumeSource; - // Label of the volume (if available). DOMString? volumeLabel; @@ -527,10 +510,13 @@ dictionary ProvidingExtension { DOMString name; // Whether supports configuration dialog. - boolean canConfigure; + boolean configurable; + + // Whether supports mounting multiple instances. + boolean multipleMounts; - // Whether supports adding new instances. - boolean canAdd; + // Source of file systems' data. + manifestTypes.FileSystemProviderSource source; }; // Callback that does not take arguments. diff --git a/chrome/common/extensions/api/file_system_provider.idl b/chrome/common/extensions/api/file_system_provider.idl index 0772f2c..dea956a 100644 --- a/chrome/common/extensions/api/file_system_provider.idl +++ b/chrome/common/extensions/api/file_system_provider.idl @@ -41,22 +41,6 @@ namespace fileSystemProvider { DELETED }; - // Source of the file system data. - enum FileSystemSource { - // The file system is handling a file, eg. an archive file obtained via the - // <code>onLaunched</code> event and the <code>file_handlers</code> manifest - // entry. - FILE, - - // The file system contents are fetched from an external device, such as a - // USB device, but not via <code>file_handlers</code>. - DEVICE, - - // The file system is network based. The contents are obtained from another - // server or local network. Eg. cloud services. - NETWORK - }; - // Represents metadata of a file or a directory. dictionary EntryMetadata { // True if it is a directory. @@ -125,9 +109,6 @@ namespace fileSystemProvider { // List of currently opened files. OpenedFile[] openedFiles; - // Source of the file system data. - FileSystemSource? source; - // Whether the file system supports the <code>tag</code> field for observing // directories. [nodoc] boolean? supportsNotifyTag; @@ -153,9 +134,6 @@ namespace fileSystemProvider { // or 0, then not limited. long? openedFilesLimit; - // Source of the file system data. - FileSystemSource? source; - // Whether the file system supports the <code>tag</code> field for observed // directories. Required in order to enable the internal cache. [nodoc] boolean? supportsNotifyTag; diff --git a/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.cc b/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.cc new file mode 100644 index 0000000..a93856c --- /dev/null +++ b/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.cc @@ -0,0 +1,88 @@ +// Copyright 2015 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. + +#include "chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h" + +#include "base/memory/scoped_ptr.h" +#include "base/strings/utf_string_conversions.h" +#include "base/values.h" +#include "chrome/common/extensions/api/manifest_types.h" +#include "extensions/common/error_utils.h" +#include "extensions/common/manifest_constants.h" +#include "url/gurl.h" + +namespace extensions { + +FileSystemProviderCapabilities::FileSystemProviderCapabilities() + : configurable_(false), multiple_mounts_(false), source_(SOURCE_FILE) { +} + +FileSystemProviderCapabilities::FileSystemProviderCapabilities( + bool configurable, + bool multiple_mounts, + FileSystemProviderSource source) + : configurable_(configurable), + multiple_mounts_(multiple_mounts), + source_(source) { +} + +FileSystemProviderCapabilities::~FileSystemProviderCapabilities() { +} + +FileSystemProviderHandler::FileSystemProviderHandler() { +} + +FileSystemProviderHandler::~FileSystemProviderHandler() { +} + +// static +const FileSystemProviderCapabilities* FileSystemProviderCapabilities::Get( + const Extension* extension) { + return static_cast<FileSystemProviderCapabilities*>( + extension->GetManifestData(manifest_keys::kFileSystemProvider)); +} + +bool FileSystemProviderHandler::Parse(Extension* extension, + base::string16* error) { + const base::DictionaryValue* section = NULL; + extension->manifest()->GetDictionary(manifest_keys::kFileSystemProvider, + §ion); + DCHECK(section); + + api::manifest_types::FileSystemProviderCapabilities idl_capabilities; + if (!api::manifest_types::FileSystemProviderCapabilities::Populate( + *section, &idl_capabilities, error)) { + return false; + } + + FileSystemProviderSource source = SOURCE_FILE; + switch (idl_capabilities.source) { + case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_FILE: + source = SOURCE_FILE; + break; + case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_DEVICE: + source = SOURCE_DEVICE; + break; + case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NETWORK: + source = SOURCE_NETWORK; + break; + case api::manifest_types::FILE_SYSTEM_PROVIDER_SOURCE_NONE: + NOTREACHED(); + } + + scoped_ptr<FileSystemProviderCapabilities> capabilities( + new FileSystemProviderCapabilities(idl_capabilities.configurable, + idl_capabilities.multiple_mounts, + source)); + + extension->SetManifestData(manifest_keys::kFileSystemProvider, + capabilities.release()); + return true; +} + +const std::vector<std::string> FileSystemProviderHandler::Keys() const { + return SingleKey(manifest_keys::kFileSystemProvider); +} + +} // namespace extensions diff --git a/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h b/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h new file mode 100644 index 0000000..91dfaab --- /dev/null +++ b/chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h @@ -0,0 +1,60 @@ +// Copyright 2015 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_COMMON_EXTENSIONS_API_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PROVIDER_HANDLER_H_ +#define CHROME_COMMON_EXTENSIONS_API_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PROVIDER_HANDLER_H_ + +#include <string> +#include <vector> + +#include "chrome/common/extensions/api/file_system_provider.h" +#include "extensions/common/extension.h" +#include "extensions/common/manifest_handler.h" + +namespace extensions { + +// Source of provider file systems. +enum FileSystemProviderSource { SOURCE_FILE, SOURCE_NETWORK, SOURCE_DEVICE }; + +// Represents capabilities of a file system provider. +class FileSystemProviderCapabilities : public Extension::ManifestData { + public: + FileSystemProviderCapabilities(); + FileSystemProviderCapabilities(bool configurable, + bool multiple_mounts, + FileSystemProviderSource source); + ~FileSystemProviderCapabilities() override; + + // Returns capabilities of a providing |extension| if declared in the + // manifets. Otherwise NULL. + static const FileSystemProviderCapabilities* Get(const Extension* extension); + + bool configurable() const { return configurable_; } + bool multiple_mounts() const { return multiple_mounts_; } + FileSystemProviderSource source() const { return source_; } + + private: + bool configurable_; + bool multiple_mounts_; + FileSystemProviderSource source_; +}; + +// Parses the "file_system_provider" manifest key. +class FileSystemProviderHandler : public ManifestHandler { + public: + FileSystemProviderHandler(); + ~FileSystemProviderHandler() override; + + // ManifestHandler overrides. + bool Parse(Extension* extension, base::string16* error) override; + + private: + const std::vector<std::string> Keys() const override; + + DISALLOW_COPY_AND_ASSIGN(FileSystemProviderHandler); +}; + +} // namespace extensions + +#endif // CHROME_COMMON_EXTENSIONS_API_FILE_SYSTEM_PROVIDER_FILE_SYSTEM_PROVIDER_HANDLER_H_ diff --git a/chrome/common/extensions/api/manifest_types.json b/chrome/common/extensions/api/manifest_types.json index ca479fb..37abb29 100644 --- a/chrome/common/extensions/api/manifest_types.json +++ b/chrome/common/extensions/api/manifest_types.json @@ -168,6 +168,32 @@ } } ] + }, + { + "id": "FileSystemProviderSource", + "type": "string", + "description": "For <code>file</code> the source is a file passed via <code>onLaunched</code> event. For <code>device</code> contents are fetched from an external device (eg. plugged via USB), without using <code>file_handlers</code>. Finally, for <code>device</code> source, contents should be fetched via network.", + "enum": ["file", "device", "network"] + }, + { + "id": "FileSystemProviderCapabilities", + "description": "Represents capabilities of a providing extension.", + "optional": true, + "type": "object", + "properties": { + "configurable": { + "type": "boolean", + "description": "Whether configuring via <code>onConfigureRequested</code> is supported." + }, + "multiple_mounts": { + "type": "boolean", + "description": "Whether multiple (more than one) mounted file systems are supported." + }, + "source": { + "$ref": "FileSystemProviderSource", + "description": "Source of data for mounted file systems." + } + } } ] } diff --git a/chrome/common/extensions/chrome_manifest_handlers.cc b/chrome/common/extensions/chrome_manifest_handlers.cc index 2bb54c8..3e1ca06 100644 --- a/chrome/common/extensions/chrome_manifest_handlers.cc +++ b/chrome/common/extensions/chrome_manifest_handlers.cc @@ -31,6 +31,7 @@ #if defined(OS_CHROMEOS) #include "chrome/common/extensions/api/file_browser_handlers/file_browser_handler.h" +#include "chrome/common/extensions/api/file_system_provider/file_system_provider_handler.h" #include "chrome/common/extensions/api/input_ime/input_components_handler.h" #endif @@ -67,6 +68,7 @@ void RegisterChromeManifestHandlers() { (new URLOverridesHandler)->Register(); #if defined(OS_CHROMEOS) (new FileBrowserHandlerParser)->Register(); + (new FileSystemProviderHandler)->Register(); (new InputComponentsHandler)->Register(); #endif } diff --git a/chrome/test/data/extensions/api_test/file_browser/mount_test/test.js b/chrome/test/data/extensions/api_test/file_browser/mount_test/test.js index 459a280..ff09363 100644 --- a/chrome/test/data/extensions/api_test/file_browser/mount_test/test.js +++ b/chrome/test/data/extensions/api_test/file_browser/mount_test/test.js @@ -7,7 +7,6 @@ var expectedVolume1 = { volumeId: 'removable:mount_path1', volumeLabel: 'mount_path1', sourcePath: 'device_path1', - volumeSource: 'device', volumeType: 'removable', deviceType: 'usb', devicePath: 'system_path_prefix1', @@ -21,7 +20,6 @@ var expectedVolume2 = { volumeId: 'removable:mount_path2', volumeLabel: 'mount_path2', sourcePath: 'device_path2', - volumeSource: 'device', volumeType: 'removable', deviceType: 'mobile', devicePath: 'system_path_prefix2', @@ -35,7 +33,6 @@ var expectedVolume3 = { volumeId: 'removable:mount_path3', volumeLabel: 'mount_path3', sourcePath: 'device_path3', - volumeSource: 'device', volumeType: 'removable', deviceType: 'optical', devicePath: 'system_path_prefix3', @@ -48,7 +45,6 @@ var expectedVolume3 = { var expectedDownloadsVolume = { volumeId: /^downloads:Downloads[^\/]*$/, volumeLabel: '', - volumeSource: 'device', volumeType: 'downloads', isReadOnly: false, hasMedia: false, @@ -59,7 +55,6 @@ var expectedDriveVolume = { volumeId: /^drive:drive[^\/]*$/, volumeLabel: '', sourcePath: /^\/special\/drive[^\/]*$/, - volumeSource: 'network', volumeType: 'drive', isReadOnly: false, hasMedia: false, @@ -70,7 +65,6 @@ var expectedArchiveVolume = { volumeId: 'archive:archive_mount_path', volumeLabel: 'archive_mount_path', sourcePath: /removable\/mount_path3\/archive.zip$/, - volumeSource: 'file', volumeType: 'archive', isReadOnly: true, hasMedia: false, diff --git a/chrome/test/data/extensions/api_test/file_system_provider/configure/manifest.json b/chrome/test/data/extensions/api_test/file_system_provider/configure/manifest.json index e9bc556..cb4d9ab 100644 --- a/chrome/test/data/extensions/api_test/file_system_provider/configure/manifest.json +++ b/chrome/test/data/extensions/api_test/file_system_provider/configure/manifest.json @@ -13,6 +13,11 @@ }, "fileManagerPrivate" ], + "file_system_provider": { + "configurable": true, + "multiple_mounts": false, + "source": "device" + }, "app": { "background": { "scripts": [ diff --git a/chrome/test/data/extensions/api_test/file_system_provider/configure/test.js b/chrome/test/data/extensions/api_test/file_system_provider/configure/test.js index 0555192..5518d90 100644 --- a/chrome/test/data/extensions/api_test/file_system_provider/configure/test.js +++ b/chrome/test/data/extensions/api_test/file_system_provider/configure/test.js @@ -20,22 +20,6 @@ function setUp(callback) { function runTests() { chrome.test.runTests([ // Verify that the configuration flag is propagated properly. - function configureNotConfigurable() { - chrome.fileManagerPrivate.getProvidingExtensions( - chrome.test.callbackPass(function(extensions) { - chrome.test.assertEq(extensions.length, 1); - chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); - chrome.test.assertEq( - chrome.runtime.getManifest().name, extensions[0].name); - chrome.test.assertFalse(extensions[0].canConfigure); - chrome.test.assertFalse(extensions[0].canAdd); - })); - - chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, - chrome.test.callbackFail('Failed to complete configuration.')); - }, - - // Verify that the configuration flag is propagated properly. function configureConfigurable() { var onConfigureRequested = chrome.test.callbackPass( function(options, onSuccess, onError) { @@ -52,8 +36,9 @@ function runTests() { chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); chrome.test.assertEq( chrome.runtime.getManifest().name, extensions[0].name); - chrome.test.assertTrue(extensions[0].canConfigure); - chrome.test.assertFalse(extensions[0].canAdd); + chrome.test.assertTrue(extensions[0].configurable); + chrome.test.assertFalse(extensions[0].multipleMounts); + chrome.test.assertEq('device', extensions[0].source); })); chrome.fileManagerPrivate.configureProvidedFileSystem(test_util.volumeId, diff --git a/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js b/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js index 993925f..a0fa062 100644 --- a/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js +++ b/chrome/test/data/extensions/api_test/file_system_provider/get_all/test.js @@ -86,8 +86,6 @@ function runTests() { fileSystems[0].displayName); chrome.test.assertTrue( fileSystems[0].writable); - chrome.test.assertEq( - 'NETWORK', fileSystems[0].source); chrome.test.assertEq(2, fileSystems[0].openedFilesLimit); })); @@ -102,8 +100,6 @@ function runTests() { test_util.FILE_SYSTEM_NAME, fileSystem.displayName); chrome.test.assertTrue(fileSystem.writable); - chrome.test.assertEq( - 'NETWORK', fileSystem.source); chrome.test.assertEq(2, fileSystem.openedFilesLimit); })); @@ -117,7 +113,7 @@ function runTests() { function(error) { chrome.test.fail(error.name); }); - }), {writable: true, openedFilesLimit: 2, source: 'NETWORK'}); + }), {writable: true, openedFilesLimit: 2}); }, // Verifies that after unmounting, the file system is not available in diff --git a/chrome/test/data/extensions/api_test/file_system_provider/mount/manifest.json b/chrome/test/data/extensions/api_test/file_system_provider/mount/manifest.json index 8d108bf..28e150f 100644 --- a/chrome/test/data/extensions/api_test/file_system_provider/mount/manifest.json +++ b/chrome/test/data/extensions/api_test/file_system_provider/mount/manifest.json @@ -6,6 +6,11 @@ "manifest_version": 2, "description": "Test for chrome.fileSystemProvider.mount().", "permissions": ["fileSystemProvider", "fileManagerPrivate"], + "file_system_provider": { + "configurable": false, + "multiple_mounts": true, + "source": "network" + }, "app": { "background": { "scripts": [ diff --git a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js index 913ca0a..f40d59d 100644 --- a/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js +++ b/chrome/test/data/extensions/api_test/file_system_provider/mount/test.js @@ -68,7 +68,6 @@ chrome.test.runTests([ { fileSystemId: fileSystemId, displayName: 'caramel-candy.zip', - source: 'FILE' }, chrome.test.callbackPass(function() { chrome.fileManagerPrivate.getVolumeMetadataList(function(volumeList) { @@ -137,23 +136,6 @@ chrome.test.runTests([ tryNextOne(); }, - // Tests if fileManagerPrivate.addProvidedFileSystem() fails if the extension - // does not listen to onMountRequested() event. - function requestMountWithoutListener() { - chrome.fileManagerPrivate.getProvidingExtensions( - chrome.test.callbackPass(function(extensions) { - chrome.test.assertEq(extensions.length, 1); - chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); - chrome.test.assertEq( - chrome.runtime.getManifest().name, extensions[0].name); - chrome.test.assertFalse(extensions[0].canConfigure); - chrome.test.assertFalse(extensions[0].canAdd); - })); - chrome.fileManagerPrivate.addProvidedFileSystem( - chrome.runtime.id, - chrome.test.callbackFail('Failed to request a new mount.')); - }, - // Tests if fileManagerPrivate.addProvidedFileSystem() emits the // onMountRequested() event. function requestMountSuccess() { @@ -171,8 +153,9 @@ chrome.test.runTests([ chrome.test.assertEq(chrome.runtime.id, extensions[0].extensionId); chrome.test.assertEq( chrome.runtime.getManifest().name, extensions[0].name); - chrome.test.assertFalse(extensions[0].canConfigure); - chrome.test.assertTrue(extensions[0].canAdd); + chrome.test.assertFalse(extensions[0].configurable); + chrome.test.assertTrue(extensions[0].multipleMounts); + chrome.test.assertEq('network', extensions[0].source); })); chrome.fileManagerPrivate.addProvidedFileSystem( diff --git a/extensions/common/manifest_constants.cc b/extensions/common/manifest_constants.cc index 534cc5b..cc11cc9 100644 --- a/extensions/common/manifest_constants.cc +++ b/extensions/common/manifest_constants.cc @@ -184,6 +184,9 @@ const char kWebviewAccessibleResources[] = "accessible_resources"; const char kWebviewName[] = "name"; const char kWebviewPartitions[] = "partitions"; const char kWhitelist[] = "whitelist"; +#if defined(OS_CHROMEOS) +const char kFileSystemProvider[] = "file_system_provider"; +#endif } // namespace manifest_keys diff --git a/extensions/common/manifest_constants.h b/extensions/common/manifest_constants.h index bed5b91..af812c3 100644 --- a/extensions/common/manifest_constants.h +++ b/extensions/common/manifest_constants.h @@ -185,7 +185,9 @@ extern const char kWebviewName[]; extern const char kWebviewAccessibleResources[]; extern const char kWebviewPartitions[]; extern const char kWhitelist[]; - +#if defined(OS_CHROMEOS) +extern const char kFileSystemProvider[]; +#endif } // namespace manifest_keys // Some values expected in manifests. |