| OLD | NEW |
| 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/http_negotiate.h" | 5 #include "chrome_frame/http_negotiate.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <htiframe.h> | 9 #include <htiframe.h> |
| 10 | 10 |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 DLOG(WARNING) << base::StringPrintf( | 259 DLOG(WARNING) << base::StringPrintf( |
| 260 "IBindStatusCallback not supported 0x%08X", hr); | 260 "IBindStatusCallback not supported 0x%08X", hr); |
| 261 } | 261 } |
| 262 return hr; | 262 return hr; |
| 263 } | 263 } |
| 264 | 264 |
| 265 // static | 265 // static |
| 266 HRESULT HttpNegotiatePatch::BeginningTransaction( | 266 HRESULT HttpNegotiatePatch::BeginningTransaction( |
| 267 IHttpNegotiate_BeginningTransaction_Fn original, IHttpNegotiate* me, | 267 IHttpNegotiate_BeginningTransaction_Fn original, IHttpNegotiate* me, |
| 268 LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR* additional_headers) { | 268 LPCWSTR url, LPCWSTR headers, DWORD reserved, LPWSTR* additional_headers) { |
| 269 DLOG(INFO) << __FUNCTION__ << " " << url << " headers:\n" << headers; | 269 DVLOG(1) << __FUNCTION__ << " " << url << " headers:\n" << headers; |
| 270 | 270 |
| 271 HRESULT hr = original(me, url, headers, reserved, additional_headers); | 271 HRESULT hr = original(me, url, headers, reserved, additional_headers); |
| 272 | 272 |
| 273 if (FAILED(hr)) { | 273 if (FAILED(hr)) { |
| 274 DLOG(WARNING) << __FUNCTION__ << " Delegate returned an error"; | 274 DLOG(WARNING) << __FUNCTION__ << " Delegate returned an error"; |
| 275 return hr; | 275 return hr; |
| 276 } | 276 } |
| 277 | 277 |
| 278 NavigationManager* mgr = NavigationManager::GetThreadInstance(); | 278 NavigationManager* mgr = NavigationManager::GetThreadInstance(); |
| 279 if (mgr && mgr->IsTopLevelUrl(url)) { | 279 if (mgr && mgr->IsTopLevelUrl(url)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 290 // called twice. The first call contains the referrer while the | 290 // called twice. The first call contains the referrer while the |
| 291 // second call does not. We set the referrer only if the URL in the | 291 // second call does not. We set the referrer only if the URL in the |
| 292 // navigation manager changes. The URL in the navigation manager | 292 // navigation manager changes. The URL in the navigation manager |
| 293 // is reset in BeforeNavigate2 | 293 // is reset in BeforeNavigate2 |
| 294 if (!referrer.empty()) { | 294 if (!referrer.empty()) { |
| 295 DCHECK(mgr->referrer().empty()); | 295 DCHECK(mgr->referrer().empty()); |
| 296 mgr->set_referrer(referrer); | 296 mgr->set_referrer(referrer); |
| 297 } | 297 } |
| 298 } | 298 } |
| 299 } else { | 299 } else { |
| 300 DLOG(INFO) << "No IWebBrowser2"; | 300 DVLOG(1) << "No IWebBrowser2"; |
| 301 } | 301 } |
| 302 } else { | 302 } else { |
| 303 DLOG(INFO) << "No NavigationManager"; | 303 DVLOG(1) << "No NavigationManager"; |
| 304 } | 304 } |
| 305 | 305 |
| 306 std::string updated(AppendCFUserAgentString(headers, *additional_headers)); | 306 std::string updated(AppendCFUserAgentString(headers, *additional_headers)); |
| 307 *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( | 307 *additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc( |
| 308 *additional_headers, (updated.length() + 1) * sizeof(wchar_t))); | 308 *additional_headers, (updated.length() + 1) * sizeof(wchar_t))); |
| 309 lstrcpyW(*additional_headers, ASCIIToWide(updated).c_str()); | 309 lstrcpyW(*additional_headers, ASCIIToWide(updated).c_str()); |
| 310 return S_OK; | 310 return S_OK; |
| 311 } | 311 } |
| 312 | 312 |
| 313 // static | 313 // static |
| (...skipping 24 matching lines...) Expand all Loading... |
| 338 } | 338 } |
| 339 | 339 |
| 340 hr = original(me, reserved, binding); | 340 hr = original(me, reserved, binding); |
| 341 return hr; | 341 return hr; |
| 342 } | 342 } |
| 343 | 343 |
| 344 // static | 344 // static |
| 345 HRESULT HttpNegotiatePatch::ReportProgress( | 345 HRESULT HttpNegotiatePatch::ReportProgress( |
| 346 IInternetProtocolSink_ReportProgress_Fn original, IInternetProtocolSink* me, | 346 IInternetProtocolSink_ReportProgress_Fn original, IInternetProtocolSink* me, |
| 347 ULONG status_code, LPCWSTR status_text) { | 347 ULONG status_code, LPCWSTR status_text) { |
| 348 DLOG(INFO) << __FUNCTION__ | 348 DVLOG(1) << __FUNCTION__ |
| 349 << base::StringPrintf(" %i %ls", status_code, status_text); | 349 << base::StringPrintf(" %i %ls", status_code, status_text); |
| 350 bool updated_mime_type = false; | 350 bool updated_mime_type = false; |
| 351 | 351 |
| 352 if (status_code == BINDSTATUS_MIMETYPEAVAILABLE || | 352 if (status_code == BINDSTATUS_MIMETYPEAVAILABLE || |
| 353 status_code == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE || | 353 status_code == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE || |
| 354 status_code == LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE) { | 354 status_code == LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE) { |
| 355 DCHECK(lstrlenW(status_text)); | 355 DCHECK(lstrlenW(status_text)); |
| 356 bool render_in_chrome_frame = false; | 356 bool render_in_chrome_frame = false; |
| 357 bool is_top_level_request = !IsSubFrameRequest(me); | 357 bool is_top_level_request = !IsSubFrameRequest(me); |
| 358 // NOTE: After switching over to using the onhttpequiv notification from | 358 // NOTE: After switching over to using the onhttpequiv notification from |
| 359 // mshtml we can expect to see sub frames being created even before the | 359 // mshtml we can expect to see sub frames being created even before the |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 break; | 402 break; |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 } | 405 } |
| 406 } | 406 } |
| 407 } | 407 } |
| 408 } | 408 } |
| 409 | 409 |
| 410 if (render_in_chrome_frame) { | 410 if (render_in_chrome_frame) { |
| 411 if (IsTextHtmlMimeType(status_text)) { | 411 if (IsTextHtmlMimeType(status_text)) { |
| 412 DLOG(INFO) << "- changing mime type to " << kChromeMimeType; | 412 DVLOG(1) << "- changing mime type to " << kChromeMimeType; |
| 413 status_text = kChromeMimeType; | 413 status_text = kChromeMimeType; |
| 414 updated_mime_type = true; | 414 updated_mime_type = true; |
| 415 } else { | 415 } else { |
| 416 DLOG(INFO) << "- don't want to render " << status_text << " in cf"; | 416 DVLOG(1) << "- don't want to render " << status_text << " in cf"; |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 if (updated_mime_type) { | 421 if (updated_mime_type) { |
| 422 // Report all crashes in the exception handler as we updated the mime type. | 422 // Report all crashes in the exception handler as we updated the mime type. |
| 423 // Note that this avoids having the VEH report a crash if an SEH earlier in | 423 // Note that this avoids having the VEH report a crash if an SEH earlier in |
| 424 // the chain handles the exception. | 424 // the chain handles the exception. |
| 425 ExceptionBarrier barrier; | 425 ExceptionBarrier barrier; |
| 426 return original(me, status_code, status_text); | 426 return original(me, status_code, status_text); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 STDMETHODIMP UserAgentAddOn::OnResponse(DWORD response_code, | 462 STDMETHODIMP UserAgentAddOn::OnResponse(DWORD response_code, |
| 463 LPCWSTR response_headers, LPCWSTR request_headers, | 463 LPCWSTR response_headers, LPCWSTR request_headers, |
| 464 LPWSTR* additional_headers) { | 464 LPWSTR* additional_headers) { |
| 465 HRESULT hr = S_OK; | 465 HRESULT hr = S_OK; |
| 466 if (delegate_) { | 466 if (delegate_) { |
| 467 hr = delegate_->OnResponse(response_code, response_headers, request_headers, | 467 hr = delegate_->OnResponse(response_code, response_headers, request_headers, |
| 468 additional_headers); | 468 additional_headers); |
| 469 } | 469 } |
| 470 return hr; | 470 return hr; |
| 471 } | 471 } |
| OLD | NEW |