summaryrefslogtreecommitdiffstats
path: root/chrome_frame/protocol_sink_wrap.cc
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 19:40:09 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-17 19:40:09 +0000
commit2045b41427fd10137d9c97dbc3d2ab536fd45480 (patch)
treeb4b3e619e7c9d81cc3da8f51eb2767ecb2ab44f3 /chrome_frame/protocol_sink_wrap.cc
parenteb2f8aed885e4580a2afda2c02b2cc884d9b97b1 (diff)
downloadchromium_src-2045b41427fd10137d9c97dbc3d2ab536fd45480.zip
chromium_src-2045b41427fd10137d9c97dbc3d2ab536fd45480.tar.gz
chromium_src-2045b41427fd10137d9c97dbc3d2ab536fd45480.tar.bz2
Support rendering in Chrome Frame if the content-type of the top level request is [application/xhtml+xml, image/svg, image/svg+xml, video/ogg, video/webm,video/mp4] or text/html
BUG=51982 Review URL: http://codereview.chromium.org/3107019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56398 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/protocol_sink_wrap.cc')
-rw-r--r--chrome_frame/protocol_sink_wrap.cc46
1 files changed, 35 insertions, 11 deletions
diff --git a/chrome_frame/protocol_sink_wrap.cc b/chrome_frame/protocol_sink_wrap.cc
index 5d28438..b7ef18f 100644
--- a/chrome_frame/protocol_sink_wrap.cc
+++ b/chrome_frame/protocol_sink_wrap.cc
@@ -248,18 +248,31 @@ void PutProtData(IBindCtx* pbc, ProtData* data) {
}
bool IsTextHtml(const wchar_t* status_text) {
- if (!status_text)
- return false;
- size_t status_text_length = lstrlenW(status_text);
- const wchar_t* status_text_end = status_text +
- std::min(status_text_length, arraysize(kTextHtmlMimeType) - 1);
- bool is_text_html = LowerCaseEqualsASCII(status_text, status_text_end,
- kTextHtmlMimeType);
+ const std::wstring str = status_text;
+ bool is_text_html = LowerCaseEqualsASCII(str, kTextHtmlMimeType);
return is_text_html;
}
+bool IsAdditionallySupportedContentType(const wchar_t* status_text) {
+ const std::wstring str = status_text;
+ if (LowerCaseEqualsASCII(str, "application/xhtml+xml"))
+ return true;
+ if (LowerCaseEqualsASCII(str, "image/svg"))
+ return true;
+ if (LowerCaseEqualsASCII(str, "image/svg+xml"))
+ return true;
+ if (LowerCaseEqualsASCII(str, "video/ogg"))
+ return true;
+ if (LowerCaseEqualsASCII(str, "video/webm"))
+ return true;
+ if (LowerCaseEqualsASCII(str, "video/mp4"))
+ return true;
+
+ return false;
+}
+
// Returns:
-// CHROME: if suggested mime type is "text/html" and at least one of the
+// CHROME: if suggested mime type is a supported one and at least one of the
// following is true: 1) X-UA-Compatible tag is in HTTP headers.
// 2) Url is listed in OptInURLs registry key.
// OTHER: if suggested mime type is not text/html.
@@ -268,9 +281,13 @@ RendererType DetermineRendererTypeFromMetaData(
const wchar_t* suggested_mime_type,
const std::wstring& url,
IWinInetHttpInfo* info) {
- if (!IsTextHtml(suggested_mime_type)) {
+
+ bool is_text_html = IsTextHtml(suggested_mime_type);
+ bool is_supported_content_type = is_text_html ||
+ IsAdditionallySupportedContentType(suggested_mime_type);
+
+ if (!is_supported_content_type)
return OTHER;
- }
if (!url.empty() && IsOptInUrl(url.c_str())) {
return CHROME;
@@ -287,7 +304,14 @@ RendererType DetermineRendererTypeFromMetaData(
}
}
}
- return UNDETERMINED;
+
+ // We can (and want) to sniff the content.
+ if (is_text_html) {
+ return UNDETERMINED;
+ }
+
+ // We cannot sniff the content.
+ return OTHER;
}
RendererType DetermineRendererType(void* buffer, DWORD size, bool last_chance) {