| Index: extensions/common/manifest_handlers/file_handler_info.cc
|
| diff --git a/extensions/common/manifest_handlers/file_handler_info.cc b/extensions/common/manifest_handlers/file_handler_info.cc
|
| index 68ef8322fc6a3e8178d644032a867512ca0bac4c..5cc615edaf6b4949ea910e015ca8f195f10cfb24 100644
|
| --- a/extensions/common/manifest_handlers/file_handler_info.cc
|
| +++ b/extensions/common/manifest_handlers/file_handler_info.cc
|
| @@ -21,12 +21,31 @@ namespace extensions {
|
| namespace keys = manifest_keys;
|
| namespace errors = manifest_errors;
|
|
|
| +namespace file_handler_verbs {
|
| +
|
| +const char kOpenWith[] = "open_with";
|
| +const char kAddTo[] = "add_to";
|
| +const char kPackWith[] = "pack_with";
|
| +const char kShareWith[] = "share_with";
|
| +
|
| +} // namespace file_handler_verbs
|
| +
|
| namespace {
|
| +
|
| const int kMaxTypeAndExtensionHandlers = 200;
|
| const char kNotRecognized[] = "'%s' is not a recognized file handler property.";
|
| +
|
| +bool IsSupportedVerb(const std::string& verb) {
|
| + return verb == file_handler_verbs::kOpenWith ||
|
| + verb == file_handler_verbs::kAddTo ||
|
| + verb == file_handler_verbs::kPackWith ||
|
| + verb == file_handler_verbs::kShareWith;
|
| }
|
|
|
| -FileHandlerInfo::FileHandlerInfo() : include_directories(false) {}
|
| +} // namespace
|
| +
|
| +FileHandlerInfo::FileHandlerInfo()
|
| + : include_directories(false), verb(file_handler_verbs::kOpenWith) {}
|
| FileHandlerInfo::FileHandlerInfo(const FileHandlerInfo& other) = default;
|
| FileHandlerInfo::~FileHandlerInfo() {}
|
|
|
| @@ -82,6 +101,15 @@ bool LoadFileHandler(const std::string& handler_id,
|
| return false;
|
| }
|
|
|
| + handler.verb = file_handler_verbs::kOpenWith;
|
| + if (handler_info.HasKey(keys::kFileHandlerVerb) &&
|
| + (!handler_info.GetString(keys::kFileHandlerVerb, &handler.verb) ||
|
| + !IsSupportedVerb(handler.verb))) {
|
| + *error = ErrorUtils::FormatErrorMessageUTF16(
|
| + errors::kInvalidFileHandlerVerb, handler_id);
|
| + return false;
|
| + }
|
| +
|
| if ((!mime_types || mime_types->empty()) &&
|
| (!file_extensions || file_extensions->empty()) &&
|
| !handler.include_directories) {
|
| @@ -123,7 +151,8 @@ bool LoadFileHandler(const std::string& handler_id,
|
| for (base::DictionaryValue::Iterator it(handler_info); !it.IsAtEnd();
|
| it.Advance()) {
|
| if (it.key() != keys::kFileHandlerExtensions &&
|
| - it.key() != keys::kFileHandlerTypes) {
|
| + it.key() != keys::kFileHandlerTypes &&
|
| + it.key() != keys::kFileHandlerVerb) {
|
| install_warnings->push_back(
|
| InstallWarning(base::StringPrintf(kNotRecognized, it.key().c_str()),
|
| keys::kFileHandlers,
|
|
|