Commit 8e432c7f authored by asargent@chromium.org's avatar asargent@chromium.org

Whitelist the fileSystem.write API for an internally developed extension

BUG=179010

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192867 0039d316-1c4b-4281-b951-d872f2087c98
parent 1c5499cd
......@@ -485,21 +485,31 @@ bool FileSystemChooseEntryFunction::ShowPicker(
const ui::SelectFileDialog::FileTypeInfo& file_type_info,
ui::SelectFileDialog::Type picker_type,
EntryType entry_type) {
ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
if (!shell_window) {
error_ = kInvalidCallingPage;
return false;
// TODO(asargent/benwells) - As a short term remediation for crbug.com/179010
// we're adding the ability for a whitelisted extension to use this API since
// chrome.fileBrowserHandler.selectFile is ChromeOS-only. Eventually we'd
// like a better solution and likely this code will go back to being
// platform-app only.
content::WebContents* web_contents = NULL;
if (extension_->is_platform_app()) {
ShellWindowRegistry* registry = ShellWindowRegistry::Get(profile());
DCHECK(registry);
ShellWindow* shell_window = registry->GetShellWindowForRenderViewHost(
render_view_host());
if (!shell_window) {
error_ = kInvalidCallingPage;
return false;
}
web_contents = shell_window->web_contents();
} else {
web_contents = GetAssociatedWebContents();
}
// The file picker will hold a reference to this function instance, preventing
// its destruction (and subsequent sending of the function response) until the
// user has selected a file or cancelled the picker. At that point, the picker
// will delete itself, which will also free the function instance.
new FilePicker(this, shell_window->web_contents(), suggested_name,
file_type_info, picker_type, entry_type);
new FilePicker(this, web_contents, suggested_name, file_type_info,
picker_type, entry_type);
return true;
}
......
......@@ -167,14 +167,22 @@
"extension_types": ["extension", "packaged_app"],
"location": "component"
},
"fileSystem": {
"fileSystem": [{
"channel": "stable",
"extension_types": ["platform_app"]
},
"fileSystem.write": {
},{
"channel": "stable",
"extension_types": ["extension"],
"whitelist": [ "2FC374607C2DF285634B67C64A2E356C607091C3" ]
}],
"fileSystem.write": [{
"channel": "stable",
"extension_types": ["platform_app"]
},
},{
"channel": "stable",
"extension_types": ["extension"],
"whitelist": [ "2FC374607C2DF285634B67C64A2E356C607091C3" ]
}],
"fontSettings": {
"channel": "stable",
"extension_types": ["extension", "packaged_app"]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment