summaryrefslogtreecommitdiffstats
path: root/chrome_frame/urlmon_bind_status_callback.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 00:29:30 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-26 00:29:30 +0000
commit99516b793712a94107f50654943814bcccc13984 (patch)
tree827ac1d4072382d0fee43b0789b9c94bf18fa42d /chrome_frame/urlmon_bind_status_callback.cc
parente2d9d183c7176d8c147997d084bf35ee9c5478e7 (diff)
downloadchromium_src-99516b793712a94107f50654943814bcccc13984.zip
chromium_src-99516b793712a94107f50654943814bcccc13984.tar.gz
chromium_src-99516b793712a94107f50654943814bcccc13984.tar.bz2
Don't assume that the mime type for documents that mshtml rejects is CF(!)
TEST=If a web site reports a content type that mshtml cannot render (e.g application/text, application/pdf etc) we didn't have a check for our mime type. BUG=none Review URL: http://codereview.chromium.org/976007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/urlmon_bind_status_callback.cc')
-rw-r--r--chrome_frame/urlmon_bind_status_callback.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/chrome_frame/urlmon_bind_status_callback.cc b/chrome_frame/urlmon_bind_status_callback.cc
index ec7fefc..4b195b9 100644
--- a/chrome_frame/urlmon_bind_status_callback.cc
+++ b/chrome_frame/urlmon_bind_status_callback.cc
@@ -160,6 +160,7 @@ HRESULT CFUrlmonBindStatusCallback::GetBindInfo(DWORD* bindf,
HRESULT CFUrlmonBindStatusCallback::OnDataAvailable(DWORD bscf, DWORD size,
FORMATETC* format_etc,
STGMEDIUM* stgmed) {
+ DCHECK(format_etc);
#ifndef NDEBUG
wchar_t clip_fmt_name[MAX_PATH] = {0};
if (format_etc) {
@@ -187,14 +188,18 @@ HRESULT CFUrlmonBindStatusCallback::OnDataAvailable(DWORD bscf, DWORD size,
DLOG(INFO) << __FUNCTION__ << StringPrintf(" - 0x%08x", hr);
if (hr == INET_E_TERMINATED_BIND) {
- // We want to complete fetching the entire document even though the
- // delegate isn't interested in continuing.
- // This happens when we switch from mshtml to CF.
- // We take over and buffer the document and once we're done, we report
- // INET_E_TERMINATED to mshtml so that it will continue as usual.
- hr = S_OK;
- only_buffer_ = true;
- binding_delegate_->OverrideBindResults(INET_E_TERMINATED_BIND);
+ // Check if the content type is CF's mime type.
+ UINT cf_format = ::RegisterClipboardFormatW(kChromeMimeType);
+ if (format_etc->cfFormat == cf_format) {
+ // We want to complete fetching the entire document even though the
+ // delegate isn't interested in continuing.
+ // This happens when we switch from mshtml to CF.
+ // We take over and buffer the document and once we're done, we report
+ // INET_E_TERMINATED to mshtml so that it will continue as usual.
+ hr = S_OK;
+ only_buffer_ = true;
+ binding_delegate_->OverrideBindResults(INET_E_TERMINATED_BIND);
+ }
}
if (only_buffer_) {