Commit f231bc89 authored by gbillock@chromium.org's avatar gbillock@chromium.org

intents: Add conditional web intents dispatch for docs types.

R=rdsmith@chromium.org
BUG=141244


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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152107 0039d316-1c4b-4281-b951-d872f2087c98
parent b651c878
......@@ -392,6 +392,27 @@ bool ChromeDownloadManagerDelegate::ShouldOpenWithWebIntents(
}
#endif // defined(OS_CHROMEOS)
// If QuickOffice extension is installed, use web intents to handle the
// downloaded file.
const char* kQuickOfficeExtensionId = "gbkeegbaiigmenfmjfclcdgdpimamgkj";
ExtensionServiceInterface* extension_service =
profile_->GetExtensionService();
if (extension_service &&
extension_service->GetInstalledExtension(kQuickOfficeExtensionId) &&
extension_service->IsExtensionEnabled(kQuickOfficeExtensionId)) {
if (mime_type == "application/msword" ||
mime_type == "application/vnd.ms-powerpoint" ||
mime_type == "application/vnd.ms-excel" ||
mime_type == "application/vnd.openxmlformats-officedocument."
"wordprocessingml.document" ||
mime_type == "application/vnd.openxmlformats-officedocument."
"presentationml.presentation" ||
mime_type == "application/vnd.openxmlformats-officedocument."
"spreadsheetml.sheet") {
return true;
}
}
return false;
}
......
......@@ -49,9 +49,13 @@ bool MimeTypesAreEqual(const string16& type1, const string16& type2) {
// We don't have a MIME matcher that allows patterns on both sides
// Instead, we do two comparisons, treating each type in turn as a
// pattern. If either one matches, we consider this a MIME match.
if (net::MatchesMimeType(UTF16ToUTF8(type1), UTF16ToUTF8(type2)))
std::string t1 = UTF16ToUTF8(type1);
std::string t2 = UTF16ToUTF8(type2);
StringToLowerASCII(&t1);
StringToLowerASCII(&t2);
if (net::MatchesMimeType(t1, t2))
return true;
return net::MatchesMimeType(UTF16ToUTF8(type2), UTF16ToUTF8(type1));
return net::MatchesMimeType(t2, t1);
}
// Returns true if the passed string is a MIME type. Works by comparing string
......
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