diff options
author | cmihail <cmihail@chromium.org> | 2016-02-24 18:15:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-25 02:16:28 +0000 |
commit | 20232c23c12a81d98b69d10c9e18c0b4292606cb (patch) | |
tree | 669678e9e8b9e74461c8d963710f64018f04b277 /extensions/browser/api | |
parent | 3d3507bd86994743e974e04ecfc97db4f640a007 (diff) | |
download | chromium_src-20232c23c12a81d98b69d10c9e18c0b4292606cb.zip chromium_src-20232c23c12a81d98b69d10c9e18c0b4292606cb.tar.gz chromium_src-20232c23c12a81d98b69d10c9e18c0b4292606cb.tar.bz2 |
Add directories handling support for apps/extensions.
The change introduces a "include_directories" entry in the manifest
file for file_handlers. In case the value is true, the file handler
becomes a generic handler and adds the given extension to the right
click menu.
BUG=415897
R=mtomasz@chromium.org
Review URL: https://codereview.chromium.org/1407473003
Cr-Commit-Position: refs/heads/master@{#377467}
Diffstat (limited to 'extensions/browser/api')
-rw-r--r-- | extensions/browser/api/app_runtime/app_runtime_api.cc | 8 | ||||
-rw-r--r-- | extensions/browser/api/app_runtime/app_runtime_api.h | 3 |
2 files changed, 7 insertions, 4 deletions
diff --git a/extensions/browser/api/app_runtime/app_runtime_api.cc b/extensions/browser/api/app_runtime/app_runtime_api.cc index 67f3ead..fca709b 100644 --- a/extensions/browser/api/app_runtime/app_runtime_api.cc +++ b/extensions/browser/api/app_runtime/app_runtime_api.cc @@ -11,6 +11,7 @@ #include "base/metrics/histogram.h" #include "base/time/time.h" #include "base/values.h" +#include "extensions/browser/entry_info.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_prefs.h" #include "extensions/browser/extensions_browser_client.h" @@ -162,7 +163,7 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( BrowserContext* context, const Extension* extension, const std::string& handler_id, - const std::vector<std::string>& mime_types, + const std::vector<EntryInfo>& entries, const std::vector<GrantedFileEntry>& file_entries) { // TODO(sergeygs): Use the same way of creating an event (using the generated // boilerplate) as below in DispatchOnLaunchedEventWithUrl. @@ -176,14 +177,15 @@ void AppRuntimeEventRouter::DispatchOnLaunchedEventWithFileEntries( } scoped_ptr<base::ListValue> items(new base::ListValue); - DCHECK(file_entries.size() == mime_types.size()); + DCHECK(file_entries.size() == entries.size()); for (size_t i = 0; i < file_entries.size(); ++i) { scoped_ptr<base::DictionaryValue> launch_item(new base::DictionaryValue); launch_item->SetString("fileSystemId", file_entries[i].filesystem_id); launch_item->SetString("baseName", file_entries[i].registered_name); - launch_item->SetString("mimeType", mime_types[i]); + launch_item->SetString("mimeType", entries[i].mime_type); launch_item->SetString("entryId", file_entries[i].id); + launch_item->SetBoolean("isDirectory", entries[i].is_directory); items->Append(launch_item.release()); } launch_data->Set("items", items.release()); diff --git a/extensions/browser/api/app_runtime/app_runtime_api.h b/extensions/browser/api/app_runtime/app_runtime_api.h index 38f6fd6..35a28d2 100644 --- a/extensions/browser/api/app_runtime/app_runtime_api.h +++ b/extensions/browser/api/app_runtime/app_runtime_api.h @@ -25,6 +25,7 @@ class WebContents; namespace extensions { class Extension; +struct EntryInfo; struct GrantedFileEntry; class AppRuntimeEventRouter { @@ -64,7 +65,7 @@ class AppRuntimeEventRouter { content::BrowserContext* context, const Extension* extension, const std::string& handler_id, - const std::vector<std::string>& mime_types, + const std::vector<EntryInfo>& entries, const std::vector<GrantedFileEntry>& file_entries); // |handler_id| corresponds to the id of the url_handlers item |