Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(320)

Side by Side Diff: chrome_frame/urlmon_bind_status_callback.cc

Issue 976007: Don't assume that the mime type for documents that mshtml rejects is CF (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome_frame/urlmon_moniker.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome_frame/urlmon_bind_status_callback.h" 5 #include "chrome_frame/urlmon_bind_status_callback.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 9
10 CFUrlmonBindStatusCallback::CFUrlmonBindStatusCallback() 10 CFUrlmonBindStatusCallback::CFUrlmonBindStatusCallback()
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 HRESULT CFUrlmonBindStatusCallback::GetBindInfo(DWORD* bindf, 153 HRESULT CFUrlmonBindStatusCallback::GetBindInfo(DWORD* bindf,
154 BINDINFO* bind_info) { 154 BINDINFO* bind_info) {
155 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i", 155 DLOG(INFO) << __FUNCTION__ << me() << StringPrintf(" tid=%i",
156 PlatformThread::CurrentId()); 156 PlatformThread::CurrentId());
157 return delegate_->GetBindInfo(bindf, bind_info); 157 return delegate_->GetBindInfo(bindf, bind_info);
158 } 158 }
159 159
160 HRESULT CFUrlmonBindStatusCallback::OnDataAvailable(DWORD bscf, DWORD size, 160 HRESULT CFUrlmonBindStatusCallback::OnDataAvailable(DWORD bscf, DWORD size,
161 FORMATETC* format_etc, 161 FORMATETC* format_etc,
162 STGMEDIUM* stgmed) { 162 STGMEDIUM* stgmed) {
163 DCHECK(format_etc);
163 #ifndef NDEBUG 164 #ifndef NDEBUG
164 wchar_t clip_fmt_name[MAX_PATH] = {0}; 165 wchar_t clip_fmt_name[MAX_PATH] = {0};
165 if (format_etc) { 166 if (format_etc) {
166 ::GetClipboardFormatNameW(format_etc->cfFormat, clip_fmt_name, 167 ::GetClipboardFormatNameW(format_etc->cfFormat, clip_fmt_name,
167 arraysize(clip_fmt_name)); 168 arraysize(clip_fmt_name));
168 } 169 }
169 DLOG(INFO) << __FUNCTION__ << me() 170 DLOG(INFO) << __FUNCTION__ << me()
170 << StringPrintf(" tid=%i original fmt=%ls", 171 << StringPrintf(" tid=%i original fmt=%ls",
171 PlatformThread::CurrentId(), clip_fmt_name); 172 PlatformThread::CurrentId(), clip_fmt_name);
172 173
173 DCHECK(stgmed); 174 DCHECK(stgmed);
174 DCHECK(stgmed->tymed == TYMED_ISTREAM); 175 DCHECK(stgmed->tymed == TYMED_ISTREAM);
175 176
176 if (bscf & BSCF_FIRSTDATANOTIFICATION) { 177 if (bscf & BSCF_FIRSTDATANOTIFICATION) {
177 DLOG(INFO) << "first data notification"; 178 DLOG(INFO) << "first data notification";
178 } 179 }
179 #endif 180 #endif
180 181
181 HRESULT hr = S_OK; 182 HRESULT hr = S_OK;
182 size_t bytes_read = 0; 183 size_t bytes_read = 0;
183 if (!only_buffer_) { 184 if (!only_buffer_) {
184 hr = data_->DelegateDataRead(delegate_, bscf, size, format_etc, stgmed, 185 hr = data_->DelegateDataRead(delegate_, bscf, size, format_etc, stgmed,
185 &bytes_read); 186 &bytes_read);
186 } 187 }
187 188
188 DLOG(INFO) << __FUNCTION__ << StringPrintf(" - 0x%08x", hr); 189 DLOG(INFO) << __FUNCTION__ << StringPrintf(" - 0x%08x", hr);
189 if (hr == INET_E_TERMINATED_BIND) { 190 if (hr == INET_E_TERMINATED_BIND) {
190 // We want to complete fetching the entire document even though the 191 // Check if the content type is CF's mime type.
191 // delegate isn't interested in continuing. 192 wchar_t format_name[MAX_PATH] = {0};
192 // This happens when we switch from mshtml to CF. 193 ::GetClipboardFormatNameW(format_etc->cfFormat, format_name,
amit 2010/03/26 00:13:23 nit: would it be better to compare the return valu
193 // We take over and buffer the document and once we're done, we report 194 arraysize(format_name));
194 // INET_E_TERMINATED to mshtml so that it will continue as usual. 195 DLOG(INFO) << StringPrintf("INET_E_TERMINATED_BIND for cf=%ls",
195 hr = S_OK; 196 format_name);
196 only_buffer_ = true; 197 if (lstrcmpiW(format_name, kChromeMimeType) == 0) {
197 binding_delegate_->OverrideBindResults(INET_E_TERMINATED_BIND); 198 // We want to complete fetching the entire document even though the
199 // delegate isn't interested in continuing.
200 // This happens when we switch from mshtml to CF.
201 // We take over and buffer the document and once we're done, we report
202 // INET_E_TERMINATED to mshtml so that it will continue as usual.
203 hr = S_OK;
204 only_buffer_ = true;
205 binding_delegate_->OverrideBindResults(INET_E_TERMINATED_BIND);
206 }
198 } 207 }
199 208
200 if (only_buffer_) { 209 if (only_buffer_) {
201 data_->CacheAll(stgmed->pstm); 210 data_->CacheAll(stgmed->pstm);
202 DCHECK(hr == S_OK); 211 DCHECK(hr == S_OK);
203 } 212 }
204 213
205 return hr; 214 return hr;
206 } 215 }
207 216
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 reserved); 286 reserved);
278 } 287 }
279 288
280 HRESULT CFUrlmonBindStatusCallback::GetSerializedClientCertContext( 289 HRESULT CFUrlmonBindStatusCallback::GetSerializedClientCertContext(
281 BYTE** cert, 290 BYTE** cert,
282 DWORD* cert_size) { 291 DWORD* cert_size) {
283 ScopedComPtr<IHttpNegotiate3> http_negotiate; 292 ScopedComPtr<IHttpNegotiate3> http_negotiate;
284 http_negotiate.QueryFrom(delegate_); 293 http_negotiate.QueryFrom(delegate_);
285 return http_negotiate->GetSerializedClientCertContext(cert, cert_size); 294 return http_negotiate->GetSerializedClientCertContext(cert, cert_size);
286 } 295 }
OLDNEW
« no previous file with comments | « no previous file | chrome_frame/urlmon_moniker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698