summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/app/generated_resources.grd94
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.cc198
-rw-r--r--chrome/browser/extensions/extension_file_browser_private_api.h105
-rw-r--r--chrome/browser/extensions/extension_function_dispatcher.cc6
-rw-r--r--chrome/browser/ui/views/file_manager_dialogs.cc50
-rw-r--r--chrome/common/extensions/api/extension_api.json53
-rw-r--r--chrome/common/extensions/extension.cc33
-rw-r--r--chrome/common/extensions/extension.h6
8 files changed, 14 insertions, 531 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index ece3ea9..96a0fb5 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -8121,100 +8121,6 @@ Keep your key file in a safe place. You will need it to create new versions of y
<message name="IDS_MULTI_DOWNLOAD_WARNING_DENY" desc="Text on the deny button in the IDS_MULTI_DOWNLOAD_WARNING dialog">
Deny
</message>
-
- <!-- File Browser -->
- <message name="IDS_FILE_BROWSER_DATE_ABBR" desc="Date abbr.">
- %b %d, %Y
- </message>
- <message name="IDS_FILE_BROWSER_MONTH_ABBRS" desc="Month abbrs.">
- Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
- </message>
- <message name="IDS_FILE_BROWSER_DAY_ABBRS" desc="Day abbrs.">
- Sun Mon Tue Wed Thu Fri Sat
- </message>
- <message name="IDS_FILE_BROWSER_SHORT_DATE_FORMAT" desc="Short date format.">
- %b %d, %Y
- </message>
- <message name="IDS_FILE_BROWSER_FILES_DISPLAYED_SUMMARY" desc="Files displayed summary.">
- %1 Files Displayed
- </message>
- <message name="IDS_FILE_BROWSER_FILES_SELECTED_SUMMARY" desc="Files selected summary.">
- %1 Files Selected
- </message>
- <message name="IDS_FILE_BROWSER_FILE_IS_DIRECTORY" desc="File is directory.">
- Folder
- </message>
- <message name="IDS_FILE_BROWSER_PARENT_DIRECTORY" desc="Parent directory.">
- Parent Directory
- </message>
-
- <message name="IDS_FILE_BROWSER_ROOT_DIRECTORY_LABEL" desc="Root directory label.">
- Files
- </message>
- <message name="IDS_FILE_BROWSER_NAME_COLUMN_LABEL" desc="Name column label.">
- Name
- </message>
- <message name="IDS_FILE_BROWSER_SIZE_COLUMN_LABEL" desc="Size column label.">
- Size
- </message>
- <message name="IDS_FILE_BROWSER_DATE_COLUMN_LABEL" desc="Date column label.">
- Date
- </message>
-
- <message name="IDS_FILE_BROWSER_CANCEL_LABEL" desc="Cancel label.">
- Cancel
- </message>
- <message name="IDS_FILE_BROWSER_OPEN_LABEL" desc="Open label.">
- Open
- </message>
- <message name="IDS_FILE_BROWSER_SAVE_LABEL" desc="Save label.">
- Save
- </message>
-
- <message name="IDS_FILE_BROWSER_SELECT_FOLDER_TITLE" desc="Select folder title.">
- Select a folder to open
- </message>
- <message name="IDS_FILE_BROWSER_SELECT_OPEN_FILE_TITLE" desc="Select open file title.">
- Select a file to open
- </message>
- <message name="IDS_FILE_BROWSER_SELECT_OPEN_MULTI_FILE_TITLE" desc="Select open multi file title.">
- Select one or more files
- </message>
- <message name="IDS_FILE_BROWSER_SELECT_SAVEAS_FILE" desc="Select saveas file.">
- Select a file to save as
- </message>
-
- <message name="IDS_FILE_BROWSER_COMPUTING_SELECTION" desc="Computing selection...">
- Computing selection...
- </message>
- <message name="IDS_FILE_BROWSER_NOTHING_SELECTED" desc="Nothing selected.">
- No files selected
- </message>
- <message name="IDS_FILE_BROWSER_ONE_FILE_SELECTED" desc="One file selected.">
- One file selected, $1
- </message>
- <message name="IDS_FILE_BROWSER_MANY_FILES_SELECTED" desc="Many files selected.">
- $1 files selected, $2
- </message>
-
- <message name="IDS_FILE_BROWSER_FILE_TYPE_UNKNOWN" desc="File type unknown.">
- file
- </message>
- <message name="IDS_FILE_BROWSER_FILE_TYPE_UNKNOWNS" desc="File tyhpe unknowns.">
- files
- </message>
- <message name="IDS_FILE_BROWSER_FILE_TYPE_FOLDER" desc="File type folder.">
- folder
- </message>
- <message name="IDS_FILE_BROWSER_FILE_TYPE_FOLDERS" desc="File type folders.">
- folders
- </message>
- <message name="IDS_FILE_BROWSER_FILE_TYPE_IMAGE" desc="File type image.">
- image
- </message>
- <message name="IDS_FILE_BROWSER_FILE_TYPE_IMAGES" desc="File type images.">
- images
- </message>
<!-- Bookmark manager -->
<message name="IDS_BOOKMARK_MANAGER_TITLE" desc="Title of the bookmark manager window.">
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.cc b/chrome/browser/extensions/extension_file_browser_private_api.cc
index 324ea89..9701295 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.cc
+++ b/chrome/browser/extensions/extension_file_browser_private_api.cc
@@ -5,20 +5,13 @@
#include "chrome/browser/extensions/extension_file_browser_private_api.h"
#include "base/json/json_writer.h"
-#include "base/logging.h"
#include "base/task.h"
#include "base/values.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/extension.h"
#include "content/browser/browser_thread.h"
-#include "content/common/notification_service.h"
-#include "grit/generated_resources.h"
-#include "webkit/fileapi/file_system_context.h"
#include "webkit/fileapi/file_system_operation.h"
-#include "webkit/fileapi/file_system_path_manager.h"
#include "webkit/fileapi/file_system_types.h"
-#include "ui/base/l10n/l10n_util.h"
-
class LocalFileSystemCallbackDispatcher
: public fileapi::FileSystemCallbackDispatcher {
@@ -104,194 +97,3 @@ void RequestLocalFileSystemFunction::RespondFailedOnUIThread(
SendResponse(true);
}
-// GetFileSystemRootPathOnFileThread can only be called from the file thread,
-// so here we are. This function takes a vector of virtual paths, converts
-// them to local paths and calls GetLocalPathsResponseOnUIThread with the
-// result vector, on the UI thread.
-void FileDialogFunction::GetLocalPathsOnFileThread(
- const VirtualPathVec& virtual_paths) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
- FilePathVec local_paths;
-
- // FilePath(virtual_path) doesn't work on win, so limit this to ChromeOS.
-#if defined(OS_CHROMEOS)
- GURL origin_url = source_url().GetOrigin();
- fileapi::FileSystemPathManager* path_manager =
- profile()->GetFileSystemContext()->path_manager();
-
- size_t len = virtual_paths.size();
- local_paths.reserve(len);
- for (size_t i = 0; i < len; ++i) {
- std::string virtual_path = virtual_paths[i];
- FilePath root = path_manager->GetFileSystemRootPathOnFileThread(
- origin_url,
- fileapi::kFileSystemTypeLocal,
- FilePath(virtual_path),
- false);
- if (!root.empty()) {
- local_paths.push_back(root.Append(virtual_path));
- } else {
- LOG(WARNING) << "GetLocalPathsOnFileThread failure " << virtual_path;
- }
- }
-#endif
-
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this,
- &FileDialogFunction::GetLocalPathsResponseOnUIThread,
- local_paths));
-}
-
-bool SelectFileFunction::RunImpl() {
- DCHECK_EQ(static_cast<size_t>(2), args_->GetSize());
-
- std::string virtual_path;
- args_->GetString(0, &virtual_path);
- args_->GetInteger(1, &index_);
-
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &SelectFileFunction::GetLocalPathsOnFileThread,
- VirtualPathVec(1, virtual_path)));
-
- return true;
-}
-
-void SelectFileFunction::GetLocalPathsResponseOnUIThread(
- const FilePathVec& local_paths) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK_EQ(local_paths.size(), static_cast<size_t>(1));
-
- if (!local_paths.empty())
- selected_file_ = local_paths[1];
-
- // Notify FileManagerDialog that a file has been selected.
- NotificationService::current()->Notify(
- NotificationType::FILE_BROWSE_SELECTED,
- Source<SelectFileFunction>(this),
- NotificationService::NoDetails());
-}
-
-bool SelectFilesFunction::RunImpl() {
- DCHECK_EQ(static_cast<size_t>(1), args_->GetSize());
-
- ListValue* path_list = NULL;
- args_->GetList(0, &path_list);
- DCHECK(path_list);
-
- size_t len = path_list->GetSize();
- std::string virtual_path;
- VirtualPathVec virtual_paths;
- virtual_paths.reserve(len);
- for (size_t i = 0; i < len; ++i) {
- path_list->GetString(i, &virtual_path);
- virtual_paths.push_back(virtual_path);
- }
-
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this,
- &SelectFilesFunction::GetLocalPathsOnFileThread,
- virtual_paths));
-
- return true;
-}
-
-void SelectFilesFunction::GetLocalPathsResponseOnUIThread(
- const FilePathVec& local_paths) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- selected_files_ = local_paths;
-
- // Notify FileManagerDialog that files have been selected.
- NotificationService::current()->Notify(
- NotificationType::FILE_BROWSE_MULTI_SELECTED,
- Source<SelectFilesFunction>(this),
- NotificationService::NoDetails());
-}
-
-bool CancelFileDialogFunction::RunImpl() {
- // Notify FileManagerDialog of cancellation.
- NotificationService::current()->Notify(
- NotificationType::FILE_BROWSE_CANCEL_DIALOG,
- Source<CancelFileDialogFunction>(this),
- NotificationService::NoDetails());
-
- return true;
-}
-
-bool FileDialogStringsFunction::RunImpl() {
- result_.reset(new DictionaryValue());
- DictionaryValue* dict = reinterpret_cast<DictionaryValue*>(result_.get());
-
- dict->SetString("DATE_ABBR",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_DATE_ABBR));
- dict->SetString("MONTH_ABBRS",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_MONTH_ABBRS));
- dict->SetString("DAY_ABBRS",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_DAY_ABBRS));
- dict->SetString("SHORT_DATE_FORMAT",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SHORT_DATE_FORMAT));
- dict->SetString("FILES_DISPLAYED_SUMMARY",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILES_DISPLAYED_SUMMARY));
- dict->SetString("FILES_SELECTED_SUMMARY",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILES_SELECTED_SUMMARY));
- dict->SetString("FILE_IS_DIRECTORY",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_IS_DIRECTORY));
- dict->SetString("PARENT_DIRECTORY",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_PARENT_DIRECTORY));
-
- dict->SetString("ROOT_DIRECTORY_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ROOT_DIRECTORY_LABEL));
- dict->SetString("NAME_COLUMN_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_NAME_COLUMN_LABEL));
- dict->SetString("SIZE_COLUMN_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SIZE_COLUMN_LABEL));
- dict->SetString("DATE_COLUMN_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_DATE_COLUMN_LABEL));
-
- dict->SetString("CANCEL_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_CANCEL_LABEL));
- dict->SetString("OPEN_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_OPEN_LABEL));
- dict->SetString("SAVE_LABEL",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SAVE_LABEL));
-
- dict->SetString("SELECT_FOLDER_TITLE",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SELECT_FOLDER_TITLE));
- dict->SetString("SELECT_OPEN_FILE_TITLE",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SELECT_OPEN_FILE_TITLE));
- dict->SetString("SELECT_OPEN_MULTI_FILE_TITLE",
- l10n_util::GetStringUTF16(
- IDS_FILE_BROWSER_SELECT_OPEN_MULTI_FILE_TITLE));
- dict->SetString("SELECT_SAVEAS_FILE",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_SELECT_SAVEAS_FILE));
-
- dict->SetString("COMPUTING_SELECTION",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_COMPUTING_SELECTION));
- dict->SetString("NOTHING_SELECTED",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_NOTHING_SELECTED));
- dict->SetString("ONE_FILE_SELECTED",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_ONE_FILE_SELECTED));
- dict->SetString("MANY_FILES_SELECTED",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_MANY_FILES_SELECTED));
-
- dict->SetString("FILE_TYPE_UNKNOWN",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_UNKNOWN));
- dict->SetString("FILE_TYPE_UNKNOWNS",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_UNKNOWNS));
- dict->SetString("FILE_TYPE_FOLDER",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_FOLDER));
- dict->SetString("FILE_TYPE_FOLDERS",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_FOLDERS));
- dict->SetString("FILE_TYPE_IMAGE",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_IMAGE));
- dict->SetString("FILE_TYPE_IMAGES",
- l10n_util::GetStringUTF16(IDS_FILE_BROWSER_FILE_TYPE_IMAGES));
-
-
- SendResponse(true);
- return true;
-}
-
diff --git a/chrome/browser/extensions/extension_file_browser_private_api.h b/chrome/browser/extensions/extension_file_browser_private_api.h
index 7ef524f..aadcb3c 100644
--- a/chrome/browser/extensions/extension_file_browser_private_api.h
+++ b/chrome/browser/extensions/extension_file_browser_private_api.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.
@@ -7,7 +7,6 @@
#pragma once
#include <string>
-#include <vector>
#include "base/file_path.h"
#include "chrome/browser/extensions/extension_function.h"
@@ -34,106 +33,4 @@ class RequestLocalFileSystemFunction
DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.requestLocalFileSystem");
};
-// Parent class for the chromium extension APIs for the file dialog.
-class FileDialogFunction
- : public AsyncExtensionFunction {
- public:
- typedef std::vector<FilePath> FilePathVec;
-
- FileDialogFunction() {}
-
- protected:
- virtual ~FileDialogFunction() {}
-
- // Convert virtual paths to local paths on the file thread.
- typedef std::vector<std::string> VirtualPathVec;
- void GetLocalPathsOnFileThread(const VirtualPathVec& virtual_paths);
-
- // Callback with converted local paths.
- virtual void GetLocalPathsResponseOnUIThread(const FilePathVec&
- local_paths) {}
-};
-
-// Select a single file.
-class SelectFileFunction
- : public FileDialogFunction {
- public:
- SelectFileFunction() {}
-
- const FilePath& selected_file() const { return selected_file_; }
- int index() const { return index_; }
-
- protected:
- virtual ~SelectFileFunction() {}
-
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
-
- // FileDialogFunction overrides.
- virtual void GetLocalPathsResponseOnUIThread(const FilePathVec&
- local_paths) OVERRIDE;
-
- private:
- FilePath selected_file_;
- int index_;
-
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFile");
-};
-
-// Select multiple files.
-class SelectFilesFunction
- : public FileDialogFunction {
- public:
- SelectFilesFunction() {}
-
- const FilePathVec& selected_files() const { return selected_files_; }
-
- protected:
- virtual ~SelectFilesFunction() {}
-
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
-
- // FileDialogFunction overrides.
- virtual void GetLocalPathsResponseOnUIThread(const FilePathVec&
- local_paths) OVERRIDE;
-
- private:
- FilePathVec selected_files_;
-
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.selectFiles");
-};
-
-// Cancel file selection Dialog.
-class CancelFileDialogFunction
- : public FileDialogFunction {
- public:
- CancelFileDialogFunction() {}
-
- protected:
- virtual ~CancelFileDialogFunction() {}
-
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
-
- private:
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.cancelDialog");
-};
-
-// File Dialog Strings.
-class FileDialogStringsFunction
- : public FileDialogFunction {
- public:
- FileDialogStringsFunction() {}
-
- protected:
- virtual ~FileDialogStringsFunction() {}
-
- // AsyncExtensionFunction overrides.
- virtual bool RunImpl() OVERRIDE;
-
- private:
- DECLARE_EXTENSION_FUNCTION_NAME("fileBrowserPrivate.getStrings");
-};
-
#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FILE_BROWSER_PRIVATE_API_H_
diff --git a/chrome/browser/extensions/extension_function_dispatcher.cc b/chrome/browser/extensions/extension_function_dispatcher.cc
index afd9736..b0bd2bb 100644
--- a/chrome/browser/extensions/extension_function_dispatcher.cc
+++ b/chrome/browser/extensions/extension_function_dispatcher.cc
@@ -311,12 +311,6 @@ void FactoryRegistry::ResetFunctions() {
RegisterFunction<SetPreferenceFunction>();
RegisterFunction<ClearPreferenceFunction>();
- // File Dialog.
- RegisterFunction<SelectFileFunction>();
- RegisterFunction<SelectFilesFunction>();
- RegisterFunction<CancelFileDialogFunction>();
- RegisterFunction<FileDialogStringsFunction>();
-
#if defined(OS_CHROMEOS)
// Device Customization.
RegisterFunction<GetChromeosInfoFunction>();
diff --git a/chrome/browser/ui/views/file_manager_dialogs.cc b/chrome/browser/ui/views/file_manager_dialogs.cc
index fbfce50..e723f18 100644
--- a/chrome/browser/ui/views/file_manager_dialogs.cc
+++ b/chrome/browser/ui/views/file_manager_dialogs.cc
@@ -7,7 +7,6 @@
#include "base/memory/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/extensions/extension_file_browser_private_api.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
@@ -15,8 +14,6 @@
#include "chrome/browser/ui/shell_dialogs.h"
#include "chrome/browser/ui/webui/html_dialog_ui.h"
#include "content/browser/browser_thread.h"
-#include "content/common/notification_registrar.h"
-#include "content/common/notification_service.h"
#include "third_party/libjingle/source/talk/base/urlencode.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/size.h"
@@ -24,8 +21,7 @@
// Shows a dialog box for selecting a file or a folder.
class FileManagerDialog
: public SelectFileDialog,
- public HtmlDialogUIDelegate,
- public NotificationObserver {
+ public HtmlDialogUIDelegate {
public:
explicit FileManagerDialog(Listener* listener);
@@ -125,11 +121,6 @@ class FileManagerDialog
return true;
}
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
private:
virtual ~FileManagerDialog() {}
@@ -148,9 +139,6 @@ class FileManagerDialog
// The base url for the file manager extension.
static std::string s_extension_base_url_;
- // Listen for notifications from fileBrowserPrivate.
- NotificationRegistrar registrar_;
-
DISALLOW_COPY_AND_ASSIGN(FileManagerDialog);
};
@@ -190,13 +178,6 @@ void FileManagerDialog::SelectFile(
return;
}
- registrar_.Add(this, NotificationType::FILE_BROWSE_SELECTED,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::FILE_BROWSE_MULTI_SELECTED,
- NotificationService::AllSources());
- registrar_.Add(this, NotificationType::FILE_BROWSE_CANCEL_DIALOG,
- NotificationService::AllSources());
-
title_ = UTF16ToWide(title);
owner_window_ = owner_window;
@@ -292,32 +273,3 @@ std::string FileManagerDialog::GetArgumentsJson(
return rv;
}
-
-void FileManagerDialog::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- if (!listener_)
- return;
-
- switch (type.value) {
- case NotificationType::FILE_BROWSE_SELECTED: {
- SelectFileFunction* func = Source<SelectFileFunction>(source).ptr();
- listener_->FileSelected(func->selected_file(), func->index(), NULL);
- break;
- }
-
- case NotificationType::FILE_BROWSE_MULTI_SELECTED: {
- SelectFilesFunction* func = Source<SelectFilesFunction>(source).ptr();
- listener_->MultiFilesSelected(func->selected_files(), NULL);
- break;
- }
-
- case NotificationType::FILE_BROWSE_CANCEL_DIALOG: {
- listener_->FileSelectionCanceled(NULL);
- break;
- }
-
- default:
- break;
- }
-}
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 5298344..352d12bd 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -4492,6 +4492,7 @@
}
]
},
+
{
"namespace":"fileBrowserPrivate",
"nodoc": "true",
@@ -4512,60 +4513,10 @@
]
}
]
- },
- {
- "name": "selectFiles",
- "type": "function",
- "description": "Select multiple files.",
- "parameters": [
- {
- "type": "array",
- "description": "Array of selected paths",
- "items": {"type": "string"}
- }
- ]
- },
- {
- "name": "selectFile",
- "type": "function",
- "description": "Select a file.",
- "parameters": [
- {
- "type": "string",
- "description": "A selected path"
- },
- {
- "type": "integer",
- "description": "Index of Filter"
- }
- ]
- },
- {
- "name": "cancelDialog",
- "type": "function",
- "description": "Cancel file selection.",
- "parameters": []
- },
- {
- "name": "getStrings",
- "type": "function",
- "description": "Get Strings.",
- "parameters": [
- {
- "type": "function",
- "name": "callback",
- "parameters": [
- {
- "type": "object",
- "properties": {},
- "additionalProperties": {"type": "string"}
- }
- ]
- }
- ]
}
]
},
+
{
"namespace":"webstorePrivate",
"nodoc": "true",
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index d615058..e65d9e1 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -257,14 +257,6 @@ const char* const Extension::kHostedAppPermissionNames[] = {
const size_t Extension::kNumHostedAppPermissions =
arraysize(Extension::kHostedAppPermissionNames);
-const char* const Extension::kComponentPrivatePermissionNames[] = {
- Extension::kFileBrowserPrivatePermission,
- Extension::kWebstorePrivatePermission,
- Extension::kChromeosInfoPrivatePermissions,
-};
-const size_t Extension::kNumComponentPrivatePermissions =
- arraysize(Extension::kComponentPrivatePermissionNames);
-
// We purposefully don't put this into kPermissionNames.
const char Extension::kOldUnlimitedStoragePermission[] = "unlimited_storage";
@@ -1910,10 +1902,18 @@ bool Extension::InitFromValue(const DictionaryValue& source, int flags,
return false;
}
- // Only COMPONENT extensions can use private APIs.
+ // Only COMPONENT extensions can use the webstorePrivate and
+ // fileBrowserPrivate APIs.
// TODO(asargent) - We want a more general purpose mechanism for this,
// and better error messages. (http://crbug.com/54013)
- if (!ComponentPrivatePermission(permission_str)) {
+ if ((permission_str == kWebstorePrivatePermission ||
+ permission_str == kFileBrowserPrivatePermission) &&
+ location_ != Extension::COMPONENT) {
+ continue;
+ }
+
+ if (permission_str == kChromeosInfoPrivatePermissions &&
+ location_ != Extension::COMPONENT) {
continue;
}
@@ -2386,19 +2386,6 @@ void Extension::InitEffectiveHostPermissions() {
}
}
-bool Extension::ComponentPrivatePermission
- (const std::string& permission) const {
- if (location() == Extension::COMPONENT)
- return true;
-
- // Non-component extensions are not allowed to access private apis.
- for (size_t i = 0; i < Extension::kNumComponentPrivatePermissions; ++i) {
- if (permission == Extension::kComponentPrivatePermissionNames[i])
- return false;
- }
- return true;
-}
-
bool Extension::HasMultipleUISurfaces() const {
int num_surfaces = 0;
diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h
index 7c994b2..4d48ccd 100644
--- a/chrome/common/extensions/extension.h
+++ b/chrome/common/extensions/extension.h
@@ -205,8 +205,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
static const size_t kNumPermissions;
static const char* const kHostedAppPermissionNames[];
static const size_t kNumHostedAppPermissions;
- static const char* const kComponentPrivatePermissionNames[];
- static const size_t kNumComponentPrivatePermissions;
// The old name for the unlimited storage permission, which is deprecated but
// still accepted as meaning the same thing as kUnlimitedStoragePermission.
@@ -626,10 +624,6 @@ class Extension : public base::RefCountedThreadSafe<Extension> {
// kPermissions).
bool IsAPIPermission(const std::string& permission) const;
- // Returns true if this is a component, or we are not attempting to access a
- // component-private permission.
- bool ComponentPrivatePermission(const std::string& permission) const;
-
// The set of unique API install messages that the extension has.
// NOTE: This only includes messages related to permissions declared in the
// "permissions" key in the manifest. Permissions implied from other features