summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.cc605
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.h55
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc19
-rw-r--r--chrome/browser/extensions/extension_local_filesystem_apitest.cc10
-rw-r--r--chrome/chrome_browser.gypi2
-rw-r--r--chrome/chrome_common.gypi2
-rw-r--r--chrome/common/extensions/api/extension_api.json95
-rw-r--r--chrome/common/extensions/extension.cc117
-rw-r--r--chrome/common/extensions/extension.h18
-rw-r--r--chrome/common/extensions/extension_constants.cc10
-rw-r--r--chrome/common/extensions/extension_constants.h6
-rw-r--r--chrome/common/extensions/extension_manifests_unittest.cc37
-rw-r--r--chrome/common/extensions/extension_unittest.cc4
-rw-r--r--chrome/common/extensions/file_browser_handler.cc32
-rw-r--r--chrome/common/extensions/file_browser_handler.h64
-rw-r--r--chrome/common/extensions/url_pattern.cc2
-rw-r--r--chrome/common/extensions/url_pattern.h15
-rw-r--r--chrome/renderer/extensions/event_bindings.cc34
-rw-r--r--chrome/renderer/resources/event_bindings.js13
-rw-r--r--chrome/renderer/resources/renderer_extension_bindings.js1
-rw-r--r--chrome/test/data/extensions/api_test/filebrowser_component/background.html5
-rw-r--r--chrome/test/data/extensions/api_test/filebrowser_component/main.html136
-rw-r--r--chrome/test/data/extensions/api_test/filebrowser_component/manifest.json14
-rw-r--r--chrome/test/data/extensions/api_test/filesystem_handler/background.html27
-rw-r--r--chrome/test/data/extensions/api_test/filesystem_handler/manifest.json21
-rw-r--r--chrome/test/data/extensions/api_test/filesystem_handler/tab.html69
-rw-r--r--chrome/test/data/extensions/api_test/local_filesystem/manifest.json2
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_id.json13
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_title.json13
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_1.json6
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_2.json7
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_1.json12
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_2.json14
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_url.json14
-rw-r--r--chrome/test/data/extensions/manifest_tests/filebrowser_valid.json14
35 files changed, 58 insertions, 1450 deletions
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc
index ecf88e8..448b8e2 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.cc
+++ b/chrome/browser/extensions/extension_file_browser_private_api.cc
@@ -4,228 +4,55 @@
#include "chrome/browser/extensions/extension_file_browser_private_api.h"
-#include "base/base64.h"
-#include "base/command_line.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
-#include "base/memory/singleton.h"
-#include "base/stringprintf.h"
-#include "base/string_util.h"
#include "base/task.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/extensions/extension_event_router.h"
-#include "chrome/browser/extensions/extension_function_dispatcher.h"
-#include "chrome/browser/extensions/extension_process_manager.h"
-#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/ui/webui/extension_icon_source.h"
-#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
-#include "chrome/common/extensions/file_browser_handler.h"
#include "content/browser/browser_thread.h"
-#include "content/browser/child_process_security_policy.h"
-#include "content/browser/renderer_host/render_process_host.h"
-#include "content/browser/renderer_host/render_view_host.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "webkit/fileapi/file_system_context.h"
-#include "webkit/fileapi/file_system_mount_point_provider.h"
#include "webkit/fileapi/file_system_operation.h"
-#include "webkit/fileapi/file_system_operation_context.h"
#include "webkit/fileapi/file_system_path_manager.h"
#include "webkit/fileapi/file_system_types.h"
-#include "webkit/fileapi/file_system_util.h"
-#include "webkit/fileapi/file_system_file_util.h"
-#include "webkit/fileapi/local_file_system_file_util.h"
#include "ui/base/l10n/l10n_util.h"
-// Error messages.
-const char kFileError[] = "File error %d";
-const char kInvalidFileUrl[] = "Invalid file URL";
-
-const int kReadOnlyFilePermissions = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_READ |
- base::PLATFORM_FILE_ASYNC;
-
-const int kReadWriteFilePermissions = base::PLATFORM_FILE_OPEN |
- base::PLATFORM_FILE_CREATE |
- base::PLATFORM_FILE_OPEN_ALWAYS |
- base::PLATFORM_FILE_CREATE_ALWAYS |
- base::PLATFORM_FILE_READ |
- base::PLATFORM_FILE_WRITE |
- base::PLATFORM_FILE_EXCLUSIVE_READ |
- base::PLATFORM_FILE_EXCLUSIVE_WRITE |
- base::PLATFORM_FILE_ASYNC |
- base::PLATFORM_FILE_TRUNCATE |
- base::PLATFORM_FILE_WRITE_ATTRIBUTES;
-
-typedef std::vector<
- std::pair<std::string, const FileBrowserHandler* > >
- NamedHandlerList;
-
-typedef std::vector<const FileBrowserHandler*> ActionList;
-
-bool GetFileBrowserHandlers(Profile* profile,
- const GURL& selected_file_url,
- ActionList* results) {
- ExtensionService* service = profile->GetExtensionService();
- if (!service)
- return false; // In unit-tests, we may not have an ExtensionService.
-
- for (ExtensionList::const_iterator iter = service->extensions()->begin();
- iter != service->extensions()->end();
- ++iter) {
- const Extension* extension = iter->get();
- if (!extension->file_browser_handlers())
- continue;
-
- for (Extension::FileBrowserHandlerList::const_iterator action_iter =
- extension->file_browser_handlers()->begin();
- action_iter != extension->file_browser_handlers()->end();
- ++action_iter) {
- const FileBrowserHandler* action = action_iter->get();
- if (!action->MatchesURL(selected_file_url))
- continue;
-
- results->push_back(action_iter->get());
- }
- }
- return true;
-}
-
-// Given the list of selected files, returns array of context menu tasks
-// that are shared
-bool FindCommonTasks(Profile* profile,
- ListValue* files_list,
- NamedHandlerList* named_action_list) {
- named_action_list->clear();
- ActionList common_tasks;
- for (size_t i = 0; i < files_list->GetSize(); ++i) {
- std::string file_url;
- if (!files_list->GetString(i, &file_url))
- return false;
-
- ActionList file_actions;
- if (!GetFileBrowserHandlers(profile, GURL(file_url), &file_actions))
- return false;
- // If there is nothing to do for one file, the intersection of tasks for all
- // files will be empty at the end.
- if (!file_actions.size()) {
- common_tasks.clear();
- return true;
- }
- // For the very first file, just copy elements.
- if (i == 0) {
- common_tasks.insert(common_tasks.begin(),
- file_actions.begin(),
- file_actions.end());
- std::sort(common_tasks.begin(), common_tasks.end());
- } else if (common_tasks.size()) {
- // For all additional files, find intersection between the accumulated
- // and file specific set.
- std::sort(file_actions.begin(), file_actions.end());
- ActionList intersection(common_tasks.size());
- ActionList::iterator intersection_end =
- std::set_intersection(common_tasks.begin(),
- common_tasks.end(),
- file_actions.begin(),
- file_actions.end(),
- intersection.begin());
- common_tasks.clear();
- common_tasks.insert(common_tasks.begin(),
- intersection.begin(),
- intersection_end);
- std::sort(common_tasks.begin(), common_tasks.end());
- }
- }
-
- // At the end, sort the results by task title.
- // TODO(zelidrag): Wire this with ICU to make this sort I18N happy.
- for (ActionList::const_iterator iter = common_tasks.begin();
- iter != common_tasks.end(); ++iter) {
- named_action_list->push_back(
- std::pair<std::string, const FileBrowserHandler* >(
- (*iter)->title(), *iter));
- }
- std::sort(named_action_list->begin(), named_action_list->end());
- return true;
-}
-
-// Breaks down task_id that is used between getFileTasks() and executeTask() on
-// its building blocks. task_id field the following structure:
-// <task-type>:<extension-id>/<task-action-id>
-// Currently, the only supported task-type is of 'context'.
-bool CrackTaskIdentifier(const std::string& task_id,
- std::string* target_extension_id,
- std::string* action_id) {
- std::vector<std::string> result;
- int count = Tokenize(task_id, std::string("|"), &result);
- if (count != 2)
- return false;
- *target_extension_id = result[0];
- *action_id = result[1];
- return true;
-}
-
-std::string MakeTaskID(const char* extension_id,
- const char* action_id) {
- return base::StringPrintf("%s|%s", extension_id, action_id);
-}
class LocalFileSystemCallbackDispatcher
: public fileapi::FileSystemCallbackDispatcher {
public:
explicit LocalFileSystemCallbackDispatcher(
- RequestLocalFileSystemFunction* function,
- Profile* profile,
- int child_id,
- scoped_refptr<const Extension> extension)
- : function_(function),
- profile_(profile),
- child_id_(child_id),
- extension_(extension) {
+ RequestLocalFileSystemFunction* function) : function_(function) {
DCHECK(function_);
}
-
// fileapi::FileSystemCallbackDispatcher overrides.
virtual void DidSucceed() OVERRIDE {
NOTREACHED();
}
-
virtual void DidReadMetadata(const base::PlatformFileInfo& info,
const FilePath& unused) OVERRIDE {
NOTREACHED();
}
-
virtual void DidReadDirectory(
const std::vector<base::FileUtilProxy::Entry>& entries,
bool has_more) OVERRIDE {
NOTREACHED();
}
-
virtual void DidWrite(int64 bytes, bool complete) OVERRIDE {
NOTREACHED();
}
-
virtual void DidOpenFileSystem(const std::string& name,
- const GURL& root_path) OVERRIDE {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- // Set up file permission access.
- if (!SetupFileSystemAccessPermissions()) {
- DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
- return;
- }
-
+ const GURL& root) OVERRIDE {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(function_,
&RequestLocalFileSystemFunction::RespondSuccessOnUIThread,
name,
- root_path));
+ root));
}
-
virtual void DidFail(base::PlatformFileError error_code) OVERRIDE {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -233,92 +60,38 @@ class LocalFileSystemCallbackDispatcher
&RequestLocalFileSystemFunction::RespondFailedOnUIThread,
error_code));
}
-
private:
-
- // Grants file system access permissions to file browser component.
- bool SetupFileSystemAccessPermissions() {
- if (!extension_.get())
- return false;
-
- // Make sure that only component extension can access the entire
- // local file system.
- if (extension_->location() != Extension::COMPONENT
-#ifndef NDEBUG
- && !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kExposePrivateExtensionApi)
-#endif
- ) {
- NOTREACHED() << "Private method access by non-component extension "
- << extension_->id();
- return false;
- }
-
- fileapi::FileSystemPathManager* path_manager =
- profile_->GetFileSystemContext()->path_manager();
- fileapi::ExternalFileSystemMountPointProvider* provider =
- path_manager->external_provider();
- if (!provider)
- return false;
-
- // Grant full access to File API from this component extension.
- provider->GrantFullAccessToExtension(extension_->id());
-
- // Grant R/W file permissions to the renderer hosting component
- // extension for all paths exposed by our local file system provider.
- std::vector<FilePath> root_dirs = provider->GetRootDirectories();
- for (std::vector<FilePath>::iterator iter = root_dirs.begin();
- iter != root_dirs.end();
- ++iter) {
- ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
- child_id_, *iter, kReadWriteFilePermissions);
- }
- return true;
- }
-
RequestLocalFileSystemFunction* function_;
- Profile* profile_;
- // Renderer process id.
- int child_id_;
- // Extension source URL.
- scoped_refptr<const Extension> extension_;
DISALLOW_COPY_AND_ASSIGN(LocalFileSystemCallbackDispatcher);
};
-void RequestLocalFileSystemFunction::RequestOnFileThread(
- const GURL& source_url) {
+RequestLocalFileSystemFunction::RequestLocalFileSystemFunction() {
+}
+
+RequestLocalFileSystemFunction::~RequestLocalFileSystemFunction() {
+}
+
+bool RequestLocalFileSystemFunction::RunImpl() {
fileapi::FileSystemOperation* operation =
new fileapi::FileSystemOperation(
- new LocalFileSystemCallbackDispatcher(
- this,
- profile(),
- dispatcher()->render_view_host()->process()->id(),
- GetExtension()),
+ new LocalFileSystemCallbackDispatcher(this),
BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
profile()->GetFileSystemContext(),
NULL);
- GURL origin_url = source_url.GetOrigin();
+ GURL origin_url = source_url().GetOrigin();
operation->OpenFileSystem(origin_url, fileapi::kFileSystemTypeExternal,
false); // create
-}
-
-bool RequestLocalFileSystemFunction::RunImpl() {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &RequestLocalFileSystemFunction::RequestOnFileThread,
- source_url_));
// Will finish asynchronously.
return true;
}
void RequestLocalFileSystemFunction::RespondSuccessOnUIThread(
- const std::string& name, const GURL& root_path) {
+ const std::string& name, const GURL& root) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
result_.reset(new DictionaryValue());
DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get());
dict->SetString("name", name);
- dict->SetString("path", root_path.spec());
+ dict->SetString("path", root.spec());
dict->SetInteger("error", base::PLATFORM_FILE_OK);
SendResponse(true);
}
@@ -326,354 +99,10 @@ void RequestLocalFileSystemFunction::RespondSuccessOnUIThread(
void RequestLocalFileSystemFunction::RespondFailedOnUIThread(
base::PlatformFileError error_code) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- error_ = base::StringPrintf(kFileError, static_cast<int>(error_code));
- SendResponse(false);
-}
-
-bool GetFileTasksFileBrowserFunction::RunImpl() {
- ListValue* files_list = NULL;
- if (!args_->GetList(0, &files_list))
- return false;
-
- ListValue* result_list = new ListValue();
- result_.reset(result_list);
-
- NamedHandlerList common_tasks;
- if (!FindCommonTasks(profile_, files_list, &common_tasks))
- return false;
-
- ExtensionService* service = profile_->GetExtensionService();
- for (NamedHandlerList::iterator iter = common_tasks.begin();
- iter != common_tasks.end();
- ++iter) {
- const std::string extension_id = iter->second->extension_id();
- const Extension* extension = service->GetExtensionById(extension_id, false);
- CHECK(extension);
- DictionaryValue* task = new DictionaryValue();
- task->SetString("taskId", MakeTaskID(extension_id.data(),
- iter->second->id().data()));
- task->SetString("title", iter->second->title());
- // TODO(zelidrag): Figure out how to expose icon URL that task defined in
- // manifest instead of the default extension icon.
- GURL icon =
- ExtensionIconSource::GetIconURL(extension,
- Extension::EXTENSION_ICON_SMALLISH,
- ExtensionIconSet::MATCH_BIGGER,
- false); // grayscale
- task->SetString("iconUrl", icon.spec());
- result_list->Append(task);
- }
-
- // TODO(zelidrag, serya): Add intent content tasks to result_list once we
- // implement that API.
- SendResponse(true);
- return true;
-}
-
-class ExecuteTasksFileSystemCallbackDispatcher
- : public fileapi::FileSystemCallbackDispatcher {
- public:
- explicit ExecuteTasksFileSystemCallbackDispatcher(
- ExecuteTasksFileBrowserFunction* function,
- Profile* profile,
- int child_id,
- const GURL& source_url,
- scoped_refptr<const Extension> extension,
- const std::string task_id,
- const std::vector<GURL>& file_urls)
- : function_(function),
- profile_(profile),
- source_url_(source_url),
- extension_(extension),
- task_id_(task_id),
- origin_file_urls_(file_urls) {
- DCHECK(function_);
- }
-
- // fileapi::FileSystemCallbackDispatcher overrides.
- virtual void DidSucceed() OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidReadMetadata(const base::PlatformFileInfo& info,
- const FilePath& unused) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidReadDirectory(
- const std::vector<base::FileUtilProxy::Entry>& entries,
- bool has_more) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidWrite(int64 bytes, bool complete) OVERRIDE {
- NOTREACHED();
- }
-
- virtual void DidOpenFileSystem(const std::string& file_system_name,
- const GURL& file_system_root) OVERRIDE {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- ExecuteTasksFileBrowserFunction::FileDefinitionList file_list;
- for (std::vector<GURL>::iterator iter = origin_file_urls_.begin();
- iter != origin_file_urls_.end();
- ++iter) {
- // Set up file permission access.
- ExecuteTasksFileBrowserFunction::FileDefinition file;
- if (!SetupFileAccessPermissions(*iter, &file.target_file_url,
- &file.virtual_path, &file.is_directory)) {
- continue;
- }
- file_list.push_back(file);
- }
- if (file_list.empty())
- return;
-
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(function_,
- &ExecuteTasksFileBrowserFunction::ExecuteFileActionsOnUIThread,
- task_id_,
- file_system_name,
- file_system_root,
- file_list));
- }
-
- virtual void DidFail(base::PlatformFileError error_code) OVERRIDE {
- LOG(WARNING) << "Local file system cant be resolved";
- }
-
- private:
- // Checks legitimacy of file url and grants file RO access permissions from
- // handler (target) extension and its renderer process.
- bool SetupFileAccessPermissions(const GURL& origin_file_url,
- GURL* target_file_url, FilePath* file_path, bool* is_directory) {
-
- if (!extension_.get())
- return false;
-
- GURL file_origin_url;
- FilePath virtual_path;
- fileapi::FileSystemType type;
-
- if (!CrackFileSystemURL(origin_file_url, &file_origin_url, &type,
- &virtual_path)) {
- return false;
- }
-
- if (type != fileapi::kFileSystemTypeExternal)
- return false;
-
- fileapi::FileSystemPathManager* path_manager =
- profile_->GetFileSystemContext()->path_manager();
- if (!path_manager->IsAccessAllowed(file_origin_url,
- type,
- virtual_path)) {
- return false;
- }
-
- // Make sure this url really being used by the right caller extension.
- if (source_url_.GetOrigin() != file_origin_url) {
- DidFail(base::PLATFORM_FILE_ERROR_SECURITY);
- return false;
- }
-
- FilePath root_path = path_manager->GetFileSystemRootPathOnFileThread(
- file_origin_url,
- fileapi::kFileSystemTypeExternal,
- virtual_path,
- false); // create
- FilePath final_file_path = root_path.Append(virtual_path);
-
- // Check if this file system entry exists first.
- base::PlatformFileInfo file_info;
- FilePath platform_path;
- fileapi::FileSystemOperationContext file_system_operation_context(
- profile_->GetFileSystemContext(),
- fileapi::LocalFileSystemFileUtil::GetInstance());
- if (base::PLATFORM_FILE_OK !=
- fileapi::FileSystemFileUtil::GetInstance()->GetFileInfo(
- &file_system_operation_context, final_file_path, &file_info,
- &platform_path)) {
- return false;
- }
-
- // TODO(zelidrag): Let's just prevent all symlinks for now. We don't want a
- // USB drive content to point to something in the rest of the file system.
- // Ideally, we should permit symlinks within the boundary of the same
- // virtual mount point.
- if (file_info.is_symbolic_link)
- return false;
-
- // TODO(zelidrag): Add explicit R/W + R/O permissions for non-component
- // extensions.
-
- // Get task details.
- std::string target_extension_id;
- std::string action_id;
- if (!CrackTaskIdentifier(task_id_, &target_extension_id,
- &action_id)) {
- return false;
- }
-
- // Get target extension's process.
- RenderProcessHost* target_host =
- profile_->GetExtensionProcessManager()->GetExtensionProcess(
- target_extension_id);
- if (!target_host)
- return false;
-
- // Grant R/O access permission to non-component extension and R/W to
- // component extensions.
- ChildProcessSecurityPolicy::GetInstance()->GrantPermissionsForFile(
- target_host->id(), final_file_path,
- extension_->location() != Extension::COMPONENT ?
- kReadOnlyFilePermissions : kReadWriteFilePermissions);
-
- // Grant access to this particular file to target extension. This will
- // ensure that the target extension can access only this FS entry and
- // prevent from traversing FS hierarchy upward.
- fileapi::ExternalFileSystemMountPointProvider* external_provider =
- path_manager->external_provider();
- if (!external_provider)
- return false;
- external_provider->GrantFileAccessToExtension(target_extension_id,
- virtual_path);
-
- // Output values.
- GURL target_origin_url(Extension::GetBaseURLFromExtensionId(
- target_extension_id));
- GURL base_url = fileapi::GetFileSystemRootURI(target_origin_url,
- fileapi::kFileSystemTypeExternal);
- *target_file_url = GURL(base_url.spec() + virtual_path.value());
- *file_path = virtual_path;
- *is_directory = file_info.is_directory;
- return true;
- }
-
- ExecuteTasksFileBrowserFunction* function_;
- Profile* profile_;
- // Extension source URL.
- GURL source_url_;
- scoped_refptr<const Extension> extension_;
- std::string task_id_;
- std::vector<GURL> origin_file_urls_;
- DISALLOW_COPY_AND_ASSIGN(ExecuteTasksFileSystemCallbackDispatcher);
-};
-
-bool ExecuteTasksFileBrowserFunction::RunImpl() {
- // First param is task id that was to the extension with getFileTasks call.
- std::string task_id;
- if (!args_->GetString(0, &task_id) || !task_id.size())
- return false;
-
- // The second param is the list of files that need to be executed with this
- // task.
- ListValue* files_list = NULL;
- if (!args_->GetList(1, &files_list))
- return false;
-
- if (!files_list->GetSize())
- return true;
-
- InitiateFileTaskExecution(task_id, files_list);
+ result_.reset(new DictionaryValue());
+ DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get());
+ dict->SetInteger("error", static_cast<int>(error_code));
SendResponse(true);
- return true;
-}
-
-bool ExecuteTasksFileBrowserFunction::InitiateFileTaskExecution(
- const std::string& task_id, ListValue* files_list) {
- std::vector<GURL> file_urls;
- for (size_t i = 0; i < files_list->GetSize(); i++) {
- std::string origin_file_url;
- if (!files_list->GetString(i, &origin_file_url)) {
- error_ = kInvalidFileUrl;
- SendResponse(false);
- return false;
- }
- file_urls.push_back(GURL(origin_file_url));
- }
- // Get local file system instance on file thread.
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread,
- source_url_,
- task_id,
- file_urls));
- result_.reset(new FundamentalValue(true));
- return true;
-}
-
-void ExecuteTasksFileBrowserFunction::RequestFileEntryOnFileThread(
- const GURL& source_url, const std::string& task_id,
- const std::vector<GURL>& file_urls) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- fileapi::FileSystemOperation* operation =
- new fileapi::FileSystemOperation(
- new ExecuteTasksFileSystemCallbackDispatcher(
- this,
- profile(),
- dispatcher()->render_view_host()->process()->id(),
- source_url,
- GetExtension(),
- task_id,
- file_urls),
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE),
- profile()->GetFileSystemContext(),
- NULL);
- GURL origin_url = source_url.GetOrigin();
- operation->OpenFileSystem(origin_url, fileapi::kFileSystemTypeExternal,
- false); // create
-}
-
-void ExecuteTasksFileBrowserFunction::ExecuteFileActionsOnUIThread(
- const std::string& task_id,
- const std::string& file_system_name,
- const GURL& file_system_root,
- const FileDefinitionList& file_list) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- ExtensionService* service = profile_->GetExtensionService();
- if (!service)
- return;
- // Get task details.
- std::string handler_extension_id;
- std::string action_id;
- if (!CrackTaskIdentifier(task_id, &handler_extension_id,
- &action_id)) {
- LOG(WARNING) << "Invalid task " << task_id;
- return;
- }
-
- const Extension* extension = service->GetExtensionById(handler_extension_id,
- false);
- if (!extension)
- return;
-
- ExtensionEventRouter* event_router = profile_->GetExtensionEventRouter();
- if (!event_router)
- return;
-
- scoped_ptr<ListValue> event_args(new ListValue());
- ListValue* files_urls = new ListValue();
- event_args->Append(Value::CreateStringValue(action_id));
- event_args->Append(files_urls);
- for (FileDefinitionList::const_iterator iter = file_list.begin();
- iter != file_list.end();
- ++iter) {
- DictionaryValue* file_def = new DictionaryValue();
- files_urls->Append(file_def);
- file_def->SetString("fileSystemName", file_system_name);
- file_def->SetString("fileSystemRoot", file_system_root.spec());
- file_def->SetString("fileFullPath", iter->virtual_path.value());
- file_def->SetBoolean("fileIsDirectory", iter->is_directory);
- }
- std::string json_args;
- base::JSONWriter::Write(event_args.get(), false, &json_args);
- std::string event_name = "contextMenus";
- event_router->DispatchEventToExtension(
- handler_extension_id, std::string("fileBrowserHandler.onExecute"),
- json_args, profile_,
- GURL());
}
FileDialogFunction::FileDialogFunction() {
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.h b/chrome/browser/extensions/extension_file_browser_private_api.h
index 684e8e1..d6d1005 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.h
+++ b/chrome/browser/extensions/extension_file_browser_private_api.h
@@ -13,62 +13,29 @@
#include "base/platform_file.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/ui/shell_dialogs.h"
-#include "googleurl/src/url_util.h"
#include "webkit/fileapi/file_system_callback_dispatcher.h"
class GURL;
-// Implements the chrome.fileBrowserPrivate.requestLocalFileSystem method.
-class RequestLocalFileSystemFunction : public AsyncExtensionFunction {
- protected:
- friend class LocalFileSystemCallbackDispatcher;
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
- void RespondSuccessOnUIThread(const std::string& name,
- const GURL& root_path);
- void RespondFailedOnUIThread(base::PlatformFileError error_code);
- void RequestOnFileThread(const GURL& source_url);
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem");
-};
+// Implements the Chrome Extension local File API.
+class RequestLocalFileSystemFunction
+ : public AsyncExtensionFunction {
+ public:
+ RequestLocalFileSystemFunction();
-// Implements the chrome.fileBrowserPrivate.getFileTasks method.
-class GetFileTasksFileBrowserFunction : public AsyncExtensionFunction {
protected:
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
-
- private:
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getFileTasks");
-};
-
+ virtual ~RequestLocalFileSystemFunction();
-// Implements the chrome.fileBrowserPrivate.executeTask method.
-class ExecuteTasksFileBrowserFunction : public AsyncExtensionFunction {
- protected:
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
private:
- struct FileDefinition {
- GURL target_file_url;
- FilePath virtual_path;
- bool is_directory;
- };
- typedef std::vector<FileDefinition> FileDefinitionList;
- friend class ExecuteTasksFileSystemCallbackDispatcher;
- // Initates execution of context menu tasks identified with |task_id| for
- // each element of |files_list|.
- bool InitiateFileTaskExecution(const std::string& task_id,
- ListValue* files_list);
- void RequestFileEntryOnFileThread(const GURL& source_url,
- const std::string& task_id,
- const std::vector<GURL>& file_urls);
+ friend class LocalFileSystemCallbackDispatcher;
+ void RespondSuccessOnUIThread(const std::string& name,
+ const GURL& root);
void RespondFailedOnUIThread(base::PlatformFileError error_code);
- void ExecuteFileActionsOnUIThread(const std::string& task_id,
- const std::string& file_system_name,
- const GURL& file_system_root,
- const FileDefinitionList& file_list);
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.executeTask");
+
+ DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem");
};
// Parent class for the chromium extension APIs for the file dialog.
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index 1fd1ccf..69494a3 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -20,6 +20,7 @@
#include "chrome/browser/extensions/extension_context_menu_api.h"
#include "chrome/browser/extensions/extension_cookies_api.h"
#include "chrome/browser/extensions/extension_debugger_api.h"
+#include "chrome/browser/extensions/extension_file_browser_private_api.h"
#include "chrome/browser/extensions/extension_function.h"
#include "chrome/browser/extensions/extension_history_api.h"
#include "chrome/browser/extensions/extension_i18n_api.h"
@@ -65,7 +66,6 @@
#endif
#if defined(OS_CHROMEOS)
-#include "chrome/browser/extensions/extension_file_browser_private_api.h"
#include "chrome/browser/extensions/extension_info_private_api_chromeos.h"
#endif
@@ -201,6 +201,9 @@ void FactoryRegistry::ResetFunctions() {
// Processes.
RegisterFunction<GetProcessIdForTabFunction>();
+ // Local filesystem.
+ RegisterFunction<RequestLocalFileSystemFunction>();
+
// Metrics.
RegisterFunction<MetricsGetEnabledFunction>();
RegisterFunction<MetricsSetEnabledFunction>();
@@ -309,19 +312,15 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<SetPreferenceFunction>();
RegisterFunction<ClearPreferenceFunction>();
- // ChromeOS-specific part of the API.
-#if defined(OS_CHROMEOS)
- // Device Customization.
- RegisterFunction<GetChromeosInfoFunction>();
-
- // FileBrowserPrivate functions.
- RegisterFunction<ExecuteTasksFileBrowserFunction>();
- RegisterFunction<GetFileTasksFileBrowserFunction>();
- RegisterFunction<RequestLocalFileSystemFunction>();
+ // File Dialog.
RegisterFunction<SelectFileFunction>();
RegisterFunction<SelectFilesFunction>();
RegisterFunction<CancelFileDialogFunction>();
RegisterFunction<FileDialogStringsFunction>();
+
+#if defined(OS_CHROMEOS)
+ // Device Customization.
+ RegisterFunction<GetChromeosInfoFunction>();
#endif
// Debugger
diff --git a/chrome/browser/extensions/extension_local_filesystem_apitest.cc b/chrome/browser/extensions/extension_local_filesystem_apitest.cc
index 856cbb4..5a8ba72 100644
--- a/chrome/browser/extensions/extension_local_filesystem_apitest.cc
+++ b/chrome/browser/extensions/extension_local_filesystem_apitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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.
@@ -6,13 +6,9 @@
#if defined(OS_CHROMEOS)
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, LocalFileSystem) {
+// TODO(zelidrag): Remove disable prefix on this test once API changes land.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_LocalFileSystem) {
ASSERT_TRUE(RunComponentExtensionTest("local_filesystem")) << message_;
}
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FileBrowserTest) {
- ASSERT_TRUE(RunExtensionTest("filesystem_handler")) << message_;
- ASSERT_TRUE(RunComponentExtensionTest("filebrowser_component")) << message_;
-}
-
#endif
diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi
index 1eaea97..99ccea1 100644
--- a/chrome/chrome_browser.gypi
+++ b/chrome/chrome_browser.gypi
@@ -3439,8 +3439,6 @@
['exclude', 'browser/ui/webui/filebrowse_ui.cc'],
['exclude', 'browser/ui/webui/mediaplayer_ui.cc'],
['exclude', 'browser/ui/webui/slideshow_ui.cc'],
- ['exclude', 'browser/extensions/extension_file_browser_private_api.cc'],
- ['exclude', 'browser/extensions/extension_file_browser_private_api.h'],
],
}],
['chromeos==1', {
diff --git a/chrome/chrome_common.gypi b/chrome/chrome_common.gypi
index aaeb88f..daff691 100644
--- a/chrome/chrome_common.gypi
+++ b/chrome/chrome_common.gypi
@@ -183,8 +183,6 @@
'common/extensions/extension_sidebar_utils.h',
'common/extensions/extension_unpacker.cc',
'common/extensions/extension_unpacker.h',
- 'common/extensions/file_browser_handler.cc',
- 'common/extensions/file_browser_hanlder.h',
'common/extensions/update_manifest.cc',
'common/extensions/update_manifest.h',
'common/extensions/url_pattern.cc',
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 9264e86..8a098be 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -4529,44 +4529,8 @@
]
},
{
- "namespace":"fileBrowserHandler",
- "nodoc": "true",
- "events": [
- {
- "name": "onExecute",
- "type": "function",
- "description": "Fired when file system action is executed from ChromeOS file browser.",
- "parameters": [
- {
- "name": "id",
- "type": "string",
- "description": "File browser action id as specified in the listener component's manifest."
- },
- {
- "name": "entries",
- "type": "any",
- "optional": true,
- "description": "Array of Entry instances representing files that are targets of this action (selected in ChromeOS file browser)."
- }
- ]
- }
- ]
- },
- {
"namespace":"fileBrowserPrivate",
"nodoc": "true",
- "types": [
- {
- "id": "FileBrowserTask",
- "type": "object",
- "description": "Represents information about available browser tasks. A task is an abstraction of an operation that the file browser can perform over a selected file set.",
- "properties": {
- "taskId": {"type": "string", "description": "The unique identifier of the task."},
- "title": {"type": "string", "description": "Task title."},
- "iconUrl": {"type": "string", "description": "Task icon url (from chrome://extension-icon/...)"}
- }
- }
- ],
"functions": [
{
"name": "requestLocalFileSystem",
@@ -4578,65 +4542,8 @@
"optional": "false",
"parameters": [
{
- "name" : "fileSystem",
"type": "object",
- "optional": "true",
- "description": "A DOMFileSystem instance for local file system access. null if the caller has no appropriate permissions."
- }
- ]
- }
- ]
- },
- {
- "name": "getFileTasks",
- "description": "Gets the of tasks that can be performed over selected files.",
- "parameters": [
- {
- "name": "fileURLs",
- "type": "array",
- "description": "Array of selected file URLs",
- "items": { "type": "string" }
- },
- {
- "name": "callback",
- "type": "function",
- "optional": "false",
- "parameters": [
- {
- "name": "tasks",
- "type": "array",
- "items": {"$ref": "FileBrowserTask"},
- "description": "The list of available tasks that can be performed on all of the passed file paths."
- }
- ]
- }
- ]
- },
- {
- "name": "executeTask",
- "description": "Executes file browser task over selected files",
- "parameters": [
- {
- "name": "taskId",
- "type": "string",
- "description": "The unique identifier of task to execute."
- },
- {
- "name": "fileURLs",
- "type": "array",
- "description": "Array of file URLs",
- "items": { "type": "string" }
- },
- {
- "name": "callback",
- "type": "function",
- "optional": "false",
- "parameters": [
- {
- "name": "success",
- "type": "boolean",
- "optional": "true",
- "description": "True of task execution was successfully initiated."
+ "isInstanceOf": "DOMFileSystem"
}
]
}
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 18dbd03..5f4f7d47 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -32,7 +32,6 @@
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/extensions/extension_sidebar_defaults.h"
#include "chrome/common/extensions/extension_sidebar_utils.h"
-#include "chrome/common/extensions/file_browser_handler.h"
#include "chrome/common/extensions/user_script.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/url_util.h"
@@ -266,6 +265,7 @@ const char Extension::kChromeosInfoPrivatePermissions[] = "chromeosInfoPrivate";
const char Extension::kDebuggerPermission[] = "debugger";
const char Extension::kExperimentalPermission[] = "experimental";
const char Extension::kFileBrowserHandlerPermission[] = "fileBrowserHandler";
+const char Extension::kFileSystemPermission[] = "fileSystem";
const char Extension::kFileBrowserPrivatePermission[] = "fileBrowserPrivate";
const char Extension::kGeolocationPermission[] = "geolocation";
const char Extension::kHistoryPermission[] = "history";
@@ -290,6 +290,7 @@ const Extension::Permission Extension::kPermissions[] = {
{ kDebuggerPermission, IDS_EXTENSION_PROMPT_WARNING_DEBUGGER },
{ kExperimentalPermission, 0 },
{ kFileBrowserHandlerPermission, 0 },
+ { kFileSystemPermission, 0 },
{ kFileBrowserPrivatePermission, 0 },
{ kGeolocationPermission, IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION },
{ kIdlePermission, 0 },
@@ -951,91 +952,6 @@ ExtensionAction* Extension::LoadExtensionActionHelper(
return result.release();
}
-Extension::FileBrowserHandlerList* Extension::LoadFileBrowserHandlers(
- const ListValue* extension_actions, std::string* error) {
- scoped_ptr<FileBrowserHandlerList> result(
- new FileBrowserHandlerList());
- for (ListValue::const_iterator iter = extension_actions->begin();
- iter != extension_actions->end();
- ++iter) {
- if (!(*iter)->IsType(Value::TYPE_DICTIONARY)) {
- *error = errors::kInvalidFileBrowserHandler;
- return false;
- }
- scoped_ptr<FileBrowserHandler> action(
- LoadFileBrowserHandler(
- reinterpret_cast<DictionaryValue*>(*iter), error));
- if (!action.get())
- return NULL; // Failed to parse file browser action definition.
- result->push_back(linked_ptr<FileBrowserHandler>(action.release()));
- }
- return result.release();
-}
-
-FileBrowserHandler* Extension::LoadFileBrowserHandler(
- const DictionaryValue* file_browser_handler, std::string* error) {
- scoped_ptr<FileBrowserHandler> result(
- new FileBrowserHandler());
- result->set_extension_id(id());
-
- std::string id;
- // Read the file action |id| (mandatory).
- if (!file_browser_handler->HasKey(keys::kPageActionId) ||
- !file_browser_handler->GetString(keys::kPageActionId, &id)) {
- *error = errors::kInvalidPageActionId;
- return NULL;
- }
- result->set_id(id);
-
- // Read the page action title from |default_title| (mandatory).
- std::string title;
- if (!file_browser_handler->HasKey(keys::kPageActionDefaultTitle) ||
- !file_browser_handler->GetString(keys::kPageActionDefaultTitle, &title)) {
- *error = errors::kInvalidPageActionDefaultTitle;
- return NULL;
- }
- result->set_title(title);
-
- // Initialize file filters (mandatory).
- ListValue* list_value = NULL;
- if (!file_browser_handler->HasKey(keys::kFileFilters) ||
- !file_browser_handler->GetList(keys::kFileFilters, &list_value) ||
- list_value->empty()) {
- *error = errors::kInvalidFileFiltersList;
- return false;
- }
- for (size_t i = 0; i < list_value->GetSize(); ++i) {
- std::string filter;
- if (!list_value->GetString(i, &filter)) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidFileFilterValue, base::IntToString(i));
- return false;
- }
- URLPattern pattern(URLPattern::SCHEME_FILESYSTEM);
- if (URLPattern::PARSE_SUCCESS != pattern.Parse(filter,
- URLPattern::PARSE_STRICT)) {
- *error = ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidURLPatternError, filter);
- return false;
- }
- result->AddPattern(pattern);
- }
-
- std::string default_icon;
- // Read the file browser action |default_icon| (optional).
- if (file_browser_handler->HasKey(keys::kPageActionDefaultIcon)) {
- if (!file_browser_handler->GetString(
- keys::kPageActionDefaultIcon,&default_icon) ||
- default_icon.empty()) {
- *error = errors::kInvalidPageActionIconPath;
- return NULL;
- }
- result->set_icon_path(default_icon);
- }
-
- return result.release();
-}
-
ExtensionSidebarDefaults* Extension::LoadExtensionSidebarDefaults(
const DictionaryValue* extension_sidebar, std::string* error) {
scoped_ptr<ExtensionSidebarDefaults> result(new ExtensionSidebarDefaults());
@@ -2059,21 +1975,6 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
return false; // Failed to parse browser action definition.
}
- // Initialize file browser actions (optional).
- if (source.HasKey(keys::kFileBrowserHandlers)) {
- ListValue* file_browser_handlers_value = NULL;
- if (!source.GetList(keys::kFileBrowserHandlers,
- &file_browser_handlers_value)) {
- *error = errors::kInvalidFileBrowserHandler;
- return false;
- }
-
- file_browser_handlers_.reset(
- LoadFileBrowserHandlers(file_browser_handlers_value, error));
- if (!file_browser_handlers_.get())
- return false; // Failed to parse file browser actions definition.
- }
-
// Load App settings.
if (!LoadIsApp(manifest_value_.get(), error) ||
!LoadExtent(manifest_value_.get(), keys::kWebURLs,
@@ -2139,12 +2040,7 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
// Only COMPONENT extensions can use private APIs.
// TODO(asargent) - We want a more general purpose mechanism for this,
// and better error messages. (http://crbug.com/54013)
- if (!IsComponentOnlyPermission(permission_str)
-#ifndef NDEBUG
- && !CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kExposePrivateExtensionApi)
-#endif
- ) {
+ if (!IsComponentOnlyPermission(permission_str)) {
continue;
}
@@ -2776,12 +2672,7 @@ bool Extension::IsAPIPermission(const std::string& str) const {
}
bool Extension::CanExecuteScriptEverywhere() const {
- if (location() == Extension::COMPONENT
-#ifndef NDEBUG
- || CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kExposePrivateExtensionApi)
-#endif
- )
+ if (location() == Extension::COMPONENT)
return true;
ScriptingWhitelist* whitelist =
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index a164317..8a8cfc9 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -13,7 +13,6 @@
#include "base/file_path.h"
#include "base/gtest_prod_util.h"
-#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "chrome/common/extensions/extension_constants.h"
@@ -28,8 +27,6 @@ class DictionaryValue;
class ExtensionAction;
class ExtensionResource;
class ExtensionSidebarDefaults;
-class FileBrowserHandler;
-class ListValue;
class SkBitmap;
class Version;
@@ -38,7 +35,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
public:
typedef std::map<const std::string, GURL> URLOverrideMap;
typedef std::vector<std::string> ScriptingWhitelist;
- typedef std::vector<linked_ptr<FileBrowserHandler> > FileBrowserHandlerList;
// What an extension was loaded from.
// NOTE: These values are stored as integers in the preferences and used
@@ -211,6 +207,7 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
static const char kDebuggerPermission[];
static const char kExperimentalPermission[];
static const char kFileBrowserHandlerPermission[];
+ static const char kFileSystemPermission[];
static const char kFileBrowserPrivatePermission[];
static const char kGeolocationPermission[];
static const char kHistoryPermission[];
@@ -513,9 +510,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
ExtensionSidebarDefaults* sidebar_defaults() const {
return sidebar_defaults_.get();
}
- const FileBrowserHandlerList* file_browser_handlers() const {
- return file_browser_handlers_.get();
- }
const std::vector<PluginInfo>& plugins() const { return plugins_; }
const std::vector<NaClModuleInfo>& nacl_modules() const {
return nacl_modules_;
@@ -644,13 +638,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
ExtensionAction* LoadExtensionActionHelper(
const DictionaryValue* extension_action, std::string* error);
- // Helper method to load an FileBrowserHandlerList from the manifest.
- FileBrowserHandlerList* LoadFileBrowserHandlers(
- const ListValue* extension_actions, std::string* error);
- // Helper method to load an FileBrowserHandler from manifest.
- FileBrowserHandler* LoadFileBrowserHandler(
- const DictionaryValue* file_browser_handlers, std::string* error);
-
// Helper method to load an ExtensionSidebarDefaults from the sidebar manifest
// entry.
ExtensionSidebarDefaults* LoadExtensionSidebarDefaults(
@@ -753,9 +740,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// The extension's browser action, if any.
scoped_ptr<ExtensionAction> browser_action_;
- // The extension's file browser actions, if any.
- scoped_ptr<FileBrowserHandlerList> file_browser_handlers_;
-
// The extension's sidebar, if any.
scoped_ptr<ExtensionSidebarDefaults> sidebar_defaults_;
diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc
index fc5f4ef..27324ef 100644
--- a/chrome/common/extensions/extension_constants.cc
+++ b/chrome/common/extensions/extension_constants.cc
@@ -19,8 +19,6 @@ const char* kDefaultLocale = "default_locale";
const char* kDescription = "description";
const char* kDevToolsPage = "devtools_page";
const char* kExcludeGlobs = "exclude_globs";
-const char* kFileFilters = "file_filters";
-const char* kFileBrowserHandlers = "file_browser_handlers";
const char* kHomepageURL = "homepage_url";
const char* kIcons = "icons";
const char* kIncognito = "incognito";
@@ -159,12 +157,6 @@ const char* kInvalidDescription =
"Invalid value for 'description'.";
const char* kInvalidDevToolsPage =
"Invalid value for 'devtools_page'.";
-const char* kInvalidFileBrowserHandler =
- "Invalid value for 'file_browser_handers'.";
-const char* kInvalidFileFiltersList =
- "Invalid value for 'file_filters'.";
-const char* kInvalidFileFilterValue =
- "Invalid value for 'file_filters[*]'.";
const char* kInvalidGlob =
"Invalid value for 'content_scripts[*].*[*]'.";
const char* kInvalidGlobList =
@@ -304,8 +296,6 @@ const char* kInvalidTtsVoicesVoiceName =
"Invalid value for 'tts.voices[*].voiceName'.";
const char* kInvalidUpdateURL =
"Invalid value for update url: '[*]'.";
-const char* kInvalidURLPatternError =
- "Invalid url pattern '*'";
const char* kInvalidVersion =
"Required value 'version' is missing or invalid. It must be between 1-4 "
"dot-separated integers each between 0 and 65536.";
diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h
index 6b703f3..28514da 100644
--- a/chrome/common/extensions/extension_constants.h
+++ b/chrome/common/extensions/extension_constants.h
@@ -24,8 +24,6 @@ namespace extension_manifest_keys {
extern const char* kDescription;
extern const char* kDevToolsPage;
extern const char* kExcludeGlobs;
- extern const char* kFileFilters;
- extern const char* kFileBrowserHandlers;
extern const char* kHomepageURL;
extern const char* kIcons;
extern const char* kIncognito;
@@ -133,9 +131,6 @@ namespace extension_manifest_errors {
extern const char* kInvalidDefaultLocale;
extern const char* kInvalidDescription;
extern const char* kInvalidDevToolsPage;
- extern const char* kInvalidFileBrowserHandler;
- extern const char* kInvalidFileFiltersList;
- extern const char* kInvalidFileFilterValue;
extern const char* kInvalidGlob;
extern const char* kInvalidGlobList;
extern const char* kInvalidHomepageURL;
@@ -204,7 +199,6 @@ namespace extension_manifest_errors {
extern const char* kInvalidTtsVoicesLocale;
extern const char* kInvalidTtsVoicesVoiceName;
extern const char* kInvalidUpdateURL;
- extern const char* kInvalidURLPatternError;
extern const char* kInvalidVersion;
extern const char* kInvalidWebURL;
extern const char* kInvalidWebURLs;
diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc
index f304619..092e9e1 100644
--- a/chrome/common/extensions/extension_manifests_unittest.cc
+++ b/chrome/common/extensions/extension_manifests_unittest.cc
@@ -16,8 +16,6 @@
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/extensions/extension_sidebar_defaults.h"
-#include "chrome/common/extensions/file_browser_handler.h"
-#include "chrome/common/extensions/url_pattern.h"
#include "content/common/json_value_serializer.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -570,38 +568,3 @@ TEST_F(ExtensionManifestTest, IsolatedApps) {
EXPECT_TRUE(extension2->is_storage_isolated());
*CommandLine::ForCurrentProcess() = old_command_line;
}
-
-
-TEST_F(ExtensionManifestTest, FileBrowserHandlers) {
- LoadAndExpectError("filebrowser_invalid_actions_1.json",
- errors::kInvalidFileBrowserHandler);
- LoadAndExpectError("filebrowser_invalid_actions_2.json",
- errors::kInvalidFileBrowserHandler);
- LoadAndExpectError("filebrowser_invalid_action_id.json",
- errors::kInvalidPageActionId);
- LoadAndExpectError("filebrowser_invalid_action_title.json",
- errors::kInvalidPageActionDefaultTitle);
- LoadAndExpectError("filebrowser_invalid_action_id.json",
- errors::kInvalidPageActionId);
- LoadAndExpectError("filebrowser_invalid_file_filters_1.json",
- errors::kInvalidFileFiltersList);
- LoadAndExpectError("filebrowser_invalid_file_filters_2.json",
- ExtensionErrorUtils::FormatErrorMessage(
- errors::kInvalidFileFilterValue, base::IntToString(0)));
- LoadAndExpectError("filebrowser_invalid_file_filters_url.json",
- ExtensionErrorUtils::FormatErrorMessage(errors::kInvalidURLPatternError,
- "http:*.html"));
-
- scoped_refptr<Extension> extension(
- LoadAndExpectSuccess("filebrowser_valid.json"));
- ASSERT_TRUE(extension->file_browser_handlers() != NULL);
- ASSERT_EQ(extension->file_browser_handlers()->size(), 1U);
- const FileBrowserHandler* action =
- extension->file_browser_handlers()->at(0).get();
- EXPECT_EQ(action->title(), "Default title");
- EXPECT_EQ(action->icon_path(), "icon.png");
- const FileBrowserHandler::PatternList& patterns = action->file_url_patterns();
- ASSERT_EQ(patterns.size(), 1U);
- ASSERT_TRUE(action->MatchesURL(
- GURL("filesystem:chrome-extension://foo/local/test.txt")));
-}
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index 131f144..905fd5c 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -1025,6 +1025,10 @@ TEST(ExtensionTest, PermissionMessages) {
// so we won't prompt for it for now.
skip.insert(Extension::kFileBrowserHandlerPermission);
+ // This permission requires explicit user action (context menu handler)
+ // so we won't prompt for it for now.
+ skip.insert(Extension::kFileSystemPermission);
+
// If you've turned on the experimental command-line flag, we don't need
// to warn you further.
skip.insert(Extension::kExperimentalPermission);
diff --git a/chrome/common/extensions/file_browser_handler.cc b/chrome/common/extensions/file_browser_handler.cc
deleted file mode 100644
index ea270b4..0000000
--- a/chrome/common/extensions/file_browser_handler.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2011 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/file_browser_handler.h"
-
-#include "chrome/common/extensions/url_pattern.h"
-#include "googleurl/src/gurl.h"
-
-FileBrowserHandler::FileBrowserHandler() {
-}
-
-FileBrowserHandler::~FileBrowserHandler() {
-}
-
-void FileBrowserHandler::AddPattern(const URLPattern& pattern) {
- patterns_.push_back(pattern);
-}
-
-void FileBrowserHandler::ClearPatterns() {
- patterns_.clear();
-}
-
-bool FileBrowserHandler::MatchesURL(const GURL& url) const {
- for (PatternList::const_iterator pattern = patterns_.begin();
- pattern != patterns_.end(); ++pattern) {
- if (pattern->MatchesUrl(url))
- return true;
- }
- return false;
-}
-
diff --git a/chrome/common/extensions/file_browser_handler.h b/chrome/common/extensions/file_browser_handler.h
deleted file mode 100644
index 420be17..0000000
--- a/chrome/common/extensions/file_browser_handler.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright (c) 2011 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_FILE_BROWSER_HANDLER_H_
-#define CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_
-#pragma once
-
-#include <string>
-#include <vector>
-
-#include "base/basictypes.h"
-#include "chrome/common/extensions/url_pattern.h"
-#include "googleurl/src/gurl.h"
-
-class URLPattern;
-
-// FileBrowserHandler encapsulates the state of a file browser action.
-class FileBrowserHandler {
- public:
- typedef std::vector<URLPattern> PatternList;
-
- FileBrowserHandler();
- ~FileBrowserHandler();
-
- // extension id
- std::string extension_id() const { return extension_id_; }
- void set_extension_id(const std::string& extension_id) {
- extension_id_ = extension_id;
- }
-
- // action id
- const std::string& id() const { return id_; }
- void set_id(const std::string& id) { id_ = id; }
-
- // default title
- const std::string& title() const { return title_; }
- void set_title(const std::string& title) { title_ = title; }
-
- // File schema URL patterns.
- const PatternList& file_url_patterns() const { return patterns_; }
- void AddPattern(const URLPattern& pattern);
- bool MatchesURL(const GURL& url) const;
- void ClearPatterns();
-
- // Action icon path.
- const std::string icon_path() const { return default_icon_path_; }
- void set_icon_path(const std::string& path) {
- default_icon_path_ = path;
- }
-
- private:
- // The id for the extension this action belongs to (as defined in the
- // extension manifest).
- std::string extension_id_;
- std::string title_;
- std::string default_icon_path_;
- // The id for the FileBrowserHandler, for example: "PdfFileAction".
- std::string id_;
- // A list of file filters.
- PatternList patterns_;
-};
-
-#endif // CHROME_COMMON_EXTENSIONS_FILE_BROWSER_HANDLER_H_
diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
index 986487a..ac5a8eb 100644
--- a/chrome/common/extensions/url_pattern.cc
+++ b/chrome/common/extensions/url_pattern.cc
@@ -24,7 +24,6 @@ const char* kValidSchemes[] = {
chrome::kFileScheme,
chrome::kFtpScheme,
chrome::kChromeUIScheme,
- chrome::kFileSystemScheme,
};
const int kValidSchemeMasks[] = {
@@ -33,7 +32,6 @@ const int kValidSchemeMasks[] = {
URLPattern::SCHEME_FILE,
URLPattern::SCHEME_FTP,
URLPattern::SCHEME_CHROMEUI,
- URLPattern::SCHEME_FILESYSTEM,
};
COMPILE_ASSERT(arraysize(kValidSchemes) == arraysize(kValidSchemeMasks),
diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h
index cf89382..edd92d4 100644
--- a/chrome/common/extensions/url_pattern.h
+++ b/chrome/common/extensions/url_pattern.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 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_URL_PATTERN_H_
@@ -77,13 +77,12 @@ class URLPattern {
public:
// A collection of scheme bitmasks for use with valid_schemes.
enum SchemeMasks {
- SCHEME_NONE = 0,
- SCHEME_HTTP = 1 << 0,
- SCHEME_HTTPS = 1 << 1,
- SCHEME_FILE = 1 << 2,
- SCHEME_FTP = 1 << 3,
- SCHEME_CHROMEUI = 1 << 4,
- SCHEME_FILESYSTEM = 1 << 5,
+ SCHEME_NONE = 0,
+ SCHEME_HTTP = 1 << 0,
+ SCHEME_HTTPS = 1 << 1,
+ SCHEME_FILE = 1 << 2,
+ SCHEME_FTP = 1 << 3,
+ SCHEME_CHROMEUI = 1 << 4,
// SCHEME_ALL will match every scheme, including chrome://, chrome-
// extension://, about:, etc. Because this has lots of security
// implications, third-party extensions should never be able to get access
diff --git a/chrome/renderer/extensions/event_bindings.cc b/chrome/renderer/extensions/event_bindings.cc
index 921a82e..db26ed7 100644
--- a/chrome/renderer/extensions/event_bindings.cc
+++ b/chrome/renderer/extensions/event_bindings.cc
@@ -85,8 +85,6 @@ class ExtensionImpl : public ExtensionBase {
return v8::FunctionTemplate::New(AttachEvent);
} else if (name->Equals(v8::String::New("DetachEvent"))) {
return v8::FunctionTemplate::New(DetachEvent);
- } else if (name->Equals(v8::String::New("GetExternalFileEntry"))) {
- return v8::FunctionTemplate::New(GetExternalFileEntry);
}
return ExtensionBase::GetNativeFunction(name);
}
@@ -150,38 +148,6 @@ class ExtensionImpl : public ExtensionBase {
return v8::Undefined();
}
-
- // Attach an event name to an object.
- static v8::Handle<v8::Value> GetExternalFileEntry(
- const v8::Arguments& args) {
- // TODO(zelidrag): Make this magic work on other platforms when file browser
- // matures enough on ChromeOS.
-#if defined(OS_CHROMEOS)
- DCHECK(args.Length() == 1);
- DCHECK(args[0]->IsObject());
- v8::Local<v8::Object> file_def = args[0]->ToObject();
- std::string file_system_name(
- *v8::String::Utf8Value(file_def->Get(
- v8::String::New("fileSystemName"))));
- std::string file_system_path(
- *v8::String::Utf8Value(file_def->Get(
- v8::String::New("fileSystemRoot"))));
- std::string file_full_path(
- *v8::String::Utf8Value(file_def->Get(
- v8::String::New("fileFullPath"))));
- bool is_directory =
- file_def->Get(v8::String::New("fileIsDirectory"))->ToBoolean()->Value();
- WebFrame* webframe = WebFrame::frameForCurrentContext();
- return webframe->createFileEntry(
- WebKit::WebFileSystem::TypeExternal,
- WebKit::WebString::fromUTF8(file_system_name.c_str()),
- WebKit::WebString::fromUTF8(file_system_path.c_str()),
- WebKit::WebString::fromUTF8(file_full_path.c_str()),
- is_directory);
-#else
- return v8::Undefined();
-#endif
- }
};
// Returns true if the extension running in the given |context| has sufficient
diff --git a/chrome/renderer/resources/event_bindings.js b/chrome/renderer/resources/event_bindings.js
index 935d256..3410686 100644
--- a/chrome/renderer/resources/event_bindings.js
+++ b/chrome/renderer/resources/event_bindings.js
@@ -7,7 +7,6 @@ var chrome = chrome || {};
native function GetChromeHidden();
native function AttachEvent(eventName);
native function DetachEvent(eventName);
- native function GetExternalFileEntry(fileDefinition);
var chromeHidden = GetChromeHidden();
@@ -89,18 +88,6 @@ var chrome = chrome || {};
if (attachedNamedEvents[name]) {
if (args) {
args = chromeHidden.JSON.parse(args);
- // TODO(zelidrag|aa): Remove this hack from here once we enable event
- // JSON payload unpacking on C++ side.
- if (name == "fileBrowserHandler.onExecute") {
- if (args.length != 2)
- return;
- var fileList = args[1];
- // The second parameter for this event's payload is file definition
- // dictionary that we used to reconstruct File API's Entry instance
- // here.
- for (var i = 0; i < fileList.length; i++)
- args[1][i] = GetExternalFileEntry(fileList[i]);
- }
}
return attachedNamedEvents[name].dispatch.apply(
attachedNamedEvents[name], args);
diff --git a/chrome/renderer/resources/renderer_extension_bindings.js b/chrome/renderer/resources/renderer_extension_bindings.js
index b04227c..aac3db9 100644
--- a/chrome/renderer/resources/renderer_extension_bindings.js
+++ b/chrome/renderer/resources/renderer_extension_bindings.js
@@ -318,7 +318,6 @@ var chrome = chrome || {};
"experimental.webRequest",
"history",
"idle",
- "fileBrowserHandler",
"fileBrowserPrivate",
"fileSystem",
"management",
diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/background.html b/chrome/test/data/extensions/api_test/filebrowser_component/background.html
deleted file mode 100644
index 882f342..0000000
--- a/chrome/test/data/extensions/api_test/filebrowser_component/background.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<script>
-chrome.tabs.create({
- url: "main.html"
-});
-</script>
diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/main.html b/chrome/test/data/extensions/api_test/filebrowser_component/main.html
deleted file mode 100644
index 762f3a2..0000000
--- a/chrome/test/data/extensions/api_test/filebrowser_component/main.html
+++ /dev/null
@@ -1,136 +0,0 @@
-<script>
-
-/*
-This component extension test does the following:
-
-1. Creates a txt file on the local file system with some random text.
-2. Finds a registered task (file item context menu) and invokes it with url
- of the test file.
-3. Listens for a message from context menu handler and makes sure its payload
- matches the random text from the test file.
-*/
-
-// The ID of this extension.
-var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla";
-
-var fileSystem = null;
-var testDirName = "tmp/test_dir_" + Math.floor(Math.random()*10000);
-var testFileName = "test_file_" + Math.floor(Math.random()*10000)+".txt";
-var fileUrl = "filesystem:chrome-extension://" + fileBrowserExtensionId +
- "/external/" + testDirName + "/" + testFileName;
-var testDirectory = null;
-var randomText = "random file text " + Math.floor(Math.random()*10000);
-
-function onFileSystemFetched(fs) {
- if (!fs) {
- errorCallback(chrome.extensions.lastError);
- return;
- }
- fileSystem = fs;
- console.log("DONE requesting local filesystem: " + fileSystem.name);
- console.log("Creating directory : " + testDirName);
- fileSystem.root.getDirectory(testDirName, {create:true},
- directoryCreateCallback, errorCallback);
-}
-
-function directoryCreateCallback(directory) {
- testDirectory = directory;
- console.log("DONE creating directory: " + directory.fullPath);
- directory.getFile(testFileName, {create:true}, fileCreatedCallback,
- errorCallback);
-}
-
-function fileCreatedCallback(fileEntry) {
- console.log("DONE creating file: " + fileEntry.fullPath);
- fileEntry.createWriter(onGetFileWriter);
-}
-
-function onGetFileWriter(writer) {
- // Start
- console.log("Got file writter");
- writer.onerror = errorCallback;
- writer.onwrite = onFileWriteCompleted;
- var bb = new WebKitBlobBuilder();
- bb.append(randomText);
- writer.write(bb.getBlob('text/plain'));
-}
-
-function onFileWriteCompleted(e) {
- // Start
- console.log("DONE writing file content");
- console.log("Get registered tasks now...");
- chrome.fileBrowserPrivate.getFileTasks([fileUrl], onGetTasks);
-
-}
-
-function onGetTasks(tasks) {
- console.log("Tasks: ");
- console.log(tasks);
- if (!tasks || !tasks.length) {
- chrome.test.fail("No tasks registered");
- return;
- }
- console.log("DONE fetching tasks: " + tasks[0].taskId);
- chrome.fileBrowserPrivate.executeTask(tasks[0].taskId, [fileUrl]);
-}
-
-function errorCallback(e) {
- var msg = '';
- if (!e.code) {
- msg = e.message;
- } else {
- switch (e.code) {
- case FileError.QUOTA_EXCEEDED_ERR:
- msg = 'QUOTA_EXCEEDED_ERR';
- break;
- case FileError.NOT_FOUND_ERR:
- msg = 'NOT_FOUND_ERR';
- break;
- case FileError.SECURITY_ERR:
- msg = 'SECURITY_ERR';
- break;
- case FileError.INVALID_MODIFICATION_ERR:
- msg = 'INVALID_MODIFICATION_ERR';
- break;
- case FileError.INVALID_STATE_ERR:
- msg = 'INVALID_STATE_ERR';
- break;
- default:
- msg = 'Unknown Error';
- break;
- };
- }
- chrome.test.fail("Got unexpected error: " + msg);
- console.log('Error: ' + msg);
- alert('Error: ' + msg);
-}
-
-function onCleanupFinished(entry) {
- chrome.test.succeed();
-}
-
-// For simple requests:
-chrome.extension.onRequestExternal.addListener(
- function(request, sender, sendResponse) {
- if (request.fileContent && request.fileContent == randomText) {
- sendResponse({success: true});
- testDirectory.removeRecursively(onCleanupFinished, errorCallback);
- } else {
- sendResponse({success: false});
- console.log('Error message received');
- console.log(request);
- chrome.test.fail("Got error: " + request.error);
- }
- });
-
-chrome.test.runTests([function tab() {
- // Get local FS, create dir with a file in it.
- console.log("Requesting local file system...");
- chrome.fileBrowserPrivate.requestLocalFileSystem(onFileSystemFetched);
-}]);
-
-
-</script>
-<html>
-<body><h2>chrome.fileBrowserPrivate.* tests</h2></body>
-</html>
diff --git a/chrome/test/data/extensions/api_test/filebrowser_component/manifest.json b/chrome/test/data/extensions/api_test/filebrowser_component/manifest.json
deleted file mode 100644
index b246386..0000000
--- a/chrome/test/data/extensions/api_test/filebrowser_component/manifest.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "key": "MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDOuXEIuoK1kAkBe0SKiJn/N9oNn3oUxGa4dwj40MnJqPn+w0aR2vuyocm0R4Drp67aYwtLjOVPF4CICRq6ICP6eU07gGwQxGdZ7HJASXV8hm0tab5I70oJmRLfFJyVAMCeWlFaOGq05v2i6EbifZM0qO5xALKNGQt+yjXi5INM5wIBIw==",
- "name": "chrome.fileBrowserPrivate tests",
- "version": "0.1",
- "description": "Tests of chrome.fileBrowserPrivate.* component extension methods",
- "background_page": "background.html",
- "permissions": [
- "tabs",
- "unlimitedStorage",
- "fileBrowserHandler",
- "fileBrowserPrivate"
- ]
-}
-
diff --git a/chrome/test/data/extensions/api_test/filesystem_handler/background.html b/chrome/test/data/extensions/api_test/filesystem_handler/background.html
deleted file mode 100644
index 0da7763..0000000
--- a/chrome/test/data/extensions/api_test/filesystem_handler/background.html
+++ /dev/null
@@ -1,27 +0,0 @@
-<script>
-var last_file_entries = null;
-
-function getLastFileEntries() {
- return last_file_entries;
-}
-
-chrome.fileBrowserHandler.onExecute.addListener(
- function(id, file_entries) {
- if (id != "TestAction") {
- chrome.test.fail("Unexpected action id: " + id);
- return;
- }
- if (!file_entries || file_entries.length != 1) {
- chrome.test.fail("Unexpected file url list");
- return;
- }
- last_file_entries = file_entries;
- // Create a new tab
- chrome.tabs.create({
- url: "tab.html"
- });
- });
-
-chrome.test.succeed();
-
-</script>
diff --git a/chrome/test/data/extensions/api_test/filesystem_handler/manifest.json b/chrome/test/data/extensions/api_test/filesystem_handler/manifest.json
deleted file mode 100644
index 8cba77f..0000000
--- a/chrome/test/data/extensions/api_test/filesystem_handler/manifest.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "key": "MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQChptAQ0n4R56N03nWQ1ogR7DVRBjGo80Vw6G9KLjzZv44D8rq5Q5IkeQrtKgWyZfXevlsCe3LaLo18rcz8iZx6lK2xhLdUR+ORjsjuBfdEL5a5cWeRTSxf75AcqndQsmpwMBdrMTCZ8jQNusUI+XlrihLNNJuI5TM4vNINI5bYFQIBIw==",
- "name": "ChromeOS file system intent hanlder extension",
- "version": "0.1",
- "description": "Tests of chrome.fileSystem.* methods",
- "background_page": "background.html",
- "file_browser_handlers": [
- {
- "id" : "TestAction",
- "default_title" : "Default title",
- "default_icon" : "icon.png",
- "file_filters" : [ "filesystem:*.txt" ]
- }
- ],
- "permissions": [
- "fileBrowserHandler",
- "tabs",
- "unlimitedStorage"
- ]
-}
-
diff --git a/chrome/test/data/extensions/api_test/filesystem_handler/tab.html b/chrome/test/data/extensions/api_test/filesystem_handler/tab.html
deleted file mode 100644
index 110146d..0000000
--- a/chrome/test/data/extensions/api_test/filesystem_handler/tab.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<script>
-/*
-This extension is a file intent handler and does the following during the test:
-
-1. Its background page first registers content hander.
-2. When content handler callback is invokek, opens tab.html page and passes
- file url via hash ref.
-3. Tries to resolve target file url and reads its content.
-4. Send file content to file browser extension.
-*/
-
-// The ID of the extension we want to talk to.
-var fileBrowserExtensionId = "ddammdhioacbehjngdmkjcjbnfginlla";
-
-function errorCallback(e) {
- var msg = '';
- if (!e.code) {
- msg = e.message;
- } else {
- switch (e.code) {
- case FileError.QUOTA_EXCEEDED_ERR:
- msg = 'QUOTA_EXCEEDED_ERR';
- break;
- case FileError.NOT_FOUND_ERR:
- msg = 'NOT_FOUND_ERR';
- break;
- case FileError.SECURITY_ERR:
- msg = 'SECURITY_ERR';
- break;
- case FileError.INVALID_MODIFICATION_ERR:
- msg = 'INVALID_MODIFICATION_ERR';
- break;
- case FileError.INVALID_STATE_ERR:
- msg = 'INVALID_STATE_ERR';
- break;
- default:
- msg = 'Unknown Error';
- break;
- };
- }
- chrome.test.fail("Got unexpected error: " + msg);
-}
-
-chrome.test.runTests([function tab() {
- var entries = chrome.extension.getBackgroundPage().getLastFileEntries();
- if (!entries || entries.length != 1 || !entries[0]) {
- chrome.extension.sendRequest(fileBrowserExtensionId,
- {fileContent: null,
- error: "Invalid file entries."},
- function(response) {});
- return;
- }
- var entry = entries[0];
- var reader = new FileReader();
- reader.onloadend = function(e) {
- var content = document.getElementById('content');
- content.innerHTML = reader.result;
- // Send data back to the file browser extension
- chrome.extension.sendRequest(fileBrowserExtensionId,
- {fileContent: reader.result, error: null},
- function(response) {});
- }
- reader.onerror = errorCallback;
- entry.file(function(file) {
- reader.readAsText(file);
- });
-}]);
-</script>
-<html><body><div id="content"></div></body></html>
diff --git a/chrome/test/data/extensions/api_test/local_filesystem/manifest.json b/chrome/test/data/extensions/api_test/local_filesystem/manifest.json
index a17c5f0..367a97a 100644
--- a/chrome/test/data/extensions/api_test/local_filesystem/manifest.json
+++ b/chrome/test/data/extensions/api_test/local_filesystem/manifest.json
@@ -7,7 +7,7 @@
"permissions": [
"tabs",
"unlimitedStorage",
- "fileBrowserHandler",
+ "fileSystem",
"fileBrowserPrivate"
]
}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_id.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_id.json
deleted file mode 100644
index 8dbe069..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_id.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "default_title" : "Test",
- "default_icon" : "icon.png",
- "file_filters" : [
- "filesystem:*.txt"
- ]
- }
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_title.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_title.json
deleted file mode 100644
index d0cf287..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_action_title.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "id" : "ID",
- "default_icon" : "icon.png",
- "file_filters" : [
- "filesystem:*.txt"
- ]
- }
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_1.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_1.json
deleted file mode 100644
index 4138cfd..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_1.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": {
- }
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_2.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_2.json
deleted file mode 100644
index c5c50b1..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_actions_2.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- "bad"
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_1.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_1.json
deleted file mode 100644
index fd63a02..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_1.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "id" : "ID",
- "default_title" : "Test",
- "default_icon" : "icon.png",
- "file_filters" : "bad"
- }
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_2.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_2.json
deleted file mode 100644
index a2b3bde..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_2.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "id" : "ID",
- "default_title" : "Test",
- "default_icon" : "icon.png",
- "file_filters" : [
- false
- ]
- }
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_url.json b/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_url.json
deleted file mode 100644
index 9c876db..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_invalid_file_filters_url.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "id" : "ID",
- "default_title" : "Test",
- "default_icon" : "icon.png",
- "file_filters" : [
- "http:*.html"
- ]
- }
- ]
-}
diff --git a/chrome/test/data/extensions/manifest_tests/filebrowser_valid.json b/chrome/test/data/extensions/manifest_tests/filebrowser_valid.json
deleted file mode 100644
index c7d32a3..0000000
--- a/chrome/test/data/extensions/manifest_tests/filebrowser_valid.json
+++ /dev/null
@@ -1,14 +0,0 @@
-{
- "name": "test",
- "version": "1",
- "file_browser_handlers": [
- {
- "id" : "ID",
- "default_title" : "Default title",
- "default_icon" : "icon.png",
- "file_filters" : [
- "filesystem:*.txt"
- ]
- }
- ]
-}