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/common/manifest_handlers | |
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/common/manifest_handlers')
-rw-r--r-- | extensions/common/manifest_handlers/file_handler_info.cc | 14 | ||||
-rw-r--r-- | extensions/common/manifest_handlers/file_handler_info.h | 3 |
2 files changed, 15 insertions, 2 deletions
diff --git a/extensions/common/manifest_handlers/file_handler_info.cc b/extensions/common/manifest_handlers/file_handler_info.cc index 9b0989a..b525c14 100644 --- a/extensions/common/manifest_handlers/file_handler_info.cc +++ b/extensions/common/manifest_handlers/file_handler_info.cc @@ -25,7 +25,7 @@ const int kMaxTypeAndExtensionHandlers = 200; const char kNotRecognized[] = "'%s' is not a recognized file handler property."; } -FileHandlerInfo::FileHandlerInfo() {} +FileHandlerInfo::FileHandlerInfo() : include_directories(false) {} FileHandlerInfo::~FileHandlerInfo() {} FileHandlers::FileHandlers() {} @@ -71,8 +71,18 @@ bool LoadFileHandler(const std::string& handler_id, return false; } + handler.include_directories = false; + if (handler_info.HasKey("include_directories") && + !handler_info.GetBoolean("include_directories", + &handler.include_directories)) { + *error = ErrorUtils::FormatErrorMessageUTF16( + errors::kInvalidFileHandlerIncludeDirectories, handler_id); + return false; + } + if ((!mime_types || mime_types->empty()) && - (!file_extensions || file_extensions->empty())) { + (!file_extensions || file_extensions->empty()) && + !handler.include_directories) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidFileHandlerNoTypeOrExtension, handler_id); diff --git a/extensions/common/manifest_handlers/file_handler_info.h b/extensions/common/manifest_handlers/file_handler_info.h index ac458e1..ac9e51d 100644 --- a/extensions/common/manifest_handlers/file_handler_info.h +++ b/extensions/common/manifest_handlers/file_handler_info.h @@ -27,6 +27,9 @@ struct FileHandlerInfo { // MIME types associated with this handler. std::set<std::string> types; + + // True if the handler can manage directories. + bool include_directories; }; typedef std::vector<FileHandlerInfo> FileHandlersInfo; |