Commit 6aea4da2 authored by zork@chromium.org's avatar zork@chromium.org

Add mime_type_handler key to extension manifests.

This specifies the viewer that will be used to render documents that are
a supported MIME type for the extension.

BUG=366409

Review URL: https://codereview.chromium.org/254503002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266821 0039d316-1c4b-4281-b951-d872f2087c98
parent 76086fd3
...@@ -213,6 +213,18 @@ ...@@ -213,6 +213,18 @@
"mhjfbmdgcfjbbpaeojofohoefgiehjai" // PDF "mhjfbmdgcfjbbpaeojofohoefgiehjai" // PDF
] ]
}, },
"mime_types_handler": {
"channel": "stable",
"extension_types": [ "extension", "legacy_packaged_app", "platform_app" ],
"whitelist": [
"oickdpebdnfbgkcaoklfcdhjniefkcji", // browser_tests
"gbkeegbaiigmenfmjfclcdgdpimamgkj", // QuickOffice
"ionpfmkccalenbmnddpbmocokhaknphg", // QuickOffice Dev
"bpmcpldpdmajfigpchkicefoigmkfalc", // Quickoffice component extension
"ehibbfinohgbchlgdbfpikodjaojhccn", // Editor
"mhjfbmdgcfjbbpaeojofohoefgiehjai" // PDF
]
},
"minimum_chrome_version": { "minimum_chrome_version": {
"channel": "stable", "channel": "stable",
"extension_types": [ "extension_types": [
......
...@@ -99,10 +99,19 @@ bool MimeTypesHandlerParser::Parse(extensions::Extension* extension, ...@@ -99,10 +99,19 @@ bool MimeTypesHandlerParser::Parse(extensions::Extension* extension,
info->handler_.AddMIMEType(filter); info->handler_.AddMIMEType(filter);
} }
std::string mime_types_handler;
if (extension->manifest()->GetString(keys::kMimeTypesHandler,
&mime_types_handler)) {
info->handler_.set_handler_url(mime_types_handler);
}
extension->SetManifestData(keys::kMimeTypesHandler, info.release()); extension->SetManifestData(keys::kMimeTypesHandler, info.release());
return true; return true;
} }
const std::vector<std::string> MimeTypesHandlerParser::Keys() const { const std::vector<std::string> MimeTypesHandlerParser::Keys() const {
return SingleKey(keys::kMIMETypes); std::vector<std::string> keys;
keys.push_back(keys::kMIMETypes);
keys.push_back(keys::kMimeTypesHandler);
return keys;
} }
...@@ -34,6 +34,13 @@ class MimeTypesHandler { ...@@ -34,6 +34,13 @@ class MimeTypesHandler {
// Tests if the handler has registered a filter for the MIME type. // Tests if the handler has registered a filter for the MIME type.
bool CanHandleMIMEType(const std::string& mime_type) const; bool CanHandleMIMEType(const std::string& mime_type) const;
// Set the URL that will be used to handle MIME type requests.
void set_handler_url(const std::string& handler_url) {
handler_url_ = handler_url;
}
// The URL that will be used to handle MIME type requests.
const std::string handler_url() const { return handler_url_; }
private: private:
// The id for the extension this action belongs to (as defined in the // The id for the extension this action belongs to (as defined in the
// extension manifest). // extension manifest).
...@@ -41,6 +48,8 @@ class MimeTypesHandler { ...@@ -41,6 +48,8 @@ class MimeTypesHandler {
// A list of MIME type filters. // A list of MIME type filters.
std::set<std::string> mime_type_set_; std::set<std::string> mime_type_set_;
std::string handler_url_;
}; };
class MimeTypesHandlerParser : public extensions::ManifestHandler { class MimeTypesHandlerParser : public extensions::ManifestHandler {
......
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