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 <htiframe.h> | 5 #include <htiframe.h> |
6 #include <mshtml.h> | 6 #include <mshtml.h> |
7 | 7 |
8 #include "chrome_frame/protocol_sink_wrap.h" | 8 #include "chrome_frame/protocol_sink_wrap.h" |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 END_VTABLE_PATCHES() | 79 END_VTABLE_PATCHES() |
80 | 80 |
81 // | 81 // |
82 // ProtocolSinkWrap implementation | 82 // ProtocolSinkWrap implementation |
83 | 83 |
84 // Static map initialization | 84 // Static map initialization |
85 ProtData::ProtocolDataMap ProtData::datamap_; | 85 ProtData::ProtocolDataMap ProtData::datamap_; |
86 Lock ProtData::datamap_lock_; | 86 Lock ProtData::datamap_lock_; |
87 | 87 |
88 ProtocolSinkWrap::ProtocolSinkWrap() { | 88 ProtocolSinkWrap::ProtocolSinkWrap() { |
89 DLOG(INFO) << __FUNCTION__ << base::StringPrintf(" 0x%08X", this); | 89 DVLOG(1) << __FUNCTION__ << base::StringPrintf(" 0x%08X", this); |
90 } | 90 } |
91 | 91 |
92 ProtocolSinkWrap::~ProtocolSinkWrap() { | 92 ProtocolSinkWrap::~ProtocolSinkWrap() { |
93 DLOG(INFO) << __FUNCTION__ << base::StringPrintf(" 0x%08X", this); | 93 DVLOG(1) << __FUNCTION__ << base::StringPrintf(" 0x%08X", this); |
94 } | 94 } |
95 | 95 |
96 ScopedComPtr<IInternetProtocolSink> ProtocolSinkWrap::CreateNewSink( | 96 ScopedComPtr<IInternetProtocolSink> ProtocolSinkWrap::CreateNewSink( |
97 IInternetProtocolSink* sink, ProtData* data) { | 97 IInternetProtocolSink* sink, ProtData* data) { |
98 DCHECK(sink != NULL); | 98 DCHECK(sink != NULL); |
99 DCHECK(data != NULL); | 99 DCHECK(data != NULL); |
100 CComObject<ProtocolSinkWrap>* new_sink = NULL; | 100 CComObject<ProtocolSinkWrap>* new_sink = NULL; |
101 CComObject<ProtocolSinkWrap>::CreateInstance(&new_sink); | 101 CComObject<ProtocolSinkWrap>::CreateInstance(&new_sink); |
102 new_sink->delegate_ = sink; | 102 new_sink->delegate_ = sink; |
103 new_sink->prot_data_ = data; | 103 new_sink->prot_data_ = data; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 // IInternetProtocolSink methods | 149 // IInternetProtocolSink methods |
150 STDMETHODIMP ProtocolSinkWrap::Switch(PROTOCOLDATA* protocol_data) { | 150 STDMETHODIMP ProtocolSinkWrap::Switch(PROTOCOLDATA* protocol_data) { |
151 HRESULT hr = E_FAIL; | 151 HRESULT hr = E_FAIL; |
152 if (delegate_) | 152 if (delegate_) |
153 hr = delegate_->Switch(protocol_data); | 153 hr = delegate_->Switch(protocol_data); |
154 return hr; | 154 return hr; |
155 } | 155 } |
156 | 156 |
157 STDMETHODIMP ProtocolSinkWrap::ReportProgress(ULONG status_code, | 157 STDMETHODIMP ProtocolSinkWrap::ReportProgress(ULONG status_code, |
158 LPCWSTR status_text) { | 158 LPCWSTR status_text) { |
159 DLOG(INFO) << "ProtocolSinkWrap::ReportProgress: " | 159 DVLOG(1) << "ProtocolSinkWrap::ReportProgress: " |
160 << BindStatus2Str(status_code) | 160 << BindStatus2Str(status_code) |
161 << " Status: " << (status_text ? status_text : L""); | 161 << " Status: " << (status_text ? status_text : L""); |
162 | 162 |
163 HRESULT hr = prot_data_->ReportProgress(delegate_, status_code, status_text); | 163 HRESULT hr = prot_data_->ReportProgress(delegate_, status_code, status_text); |
164 return hr; | 164 return hr; |
165 } | 165 } |
166 | 166 |
167 STDMETHODIMP ProtocolSinkWrap::ReportData(DWORD flags, ULONG progress, | 167 STDMETHODIMP ProtocolSinkWrap::ReportData(DWORD flags, ULONG progress, |
168 ULONG max_progress) { | 168 ULONG max_progress) { |
169 DCHECK(delegate_); | 169 DCHECK(delegate_); |
170 DLOG(INFO) << "ProtocolSinkWrap::ReportData: " << Bscf2Str(flags) << | 170 DVLOG(1) << "ProtocolSinkWrap::ReportData: " << Bscf2Str(flags) |
171 " progress: " << progress << " progress_max: " << max_progress; | 171 << " progress: " << progress << " progress_max: " << max_progress; |
172 | 172 |
173 HRESULT hr = prot_data_->ReportData(delegate_, flags, progress, max_progress); | 173 HRESULT hr = prot_data_->ReportData(delegate_, flags, progress, max_progress); |
174 return hr; | 174 return hr; |
175 } | 175 } |
176 | 176 |
177 STDMETHODIMP ProtocolSinkWrap::ReportResult(HRESULT result, DWORD error, | 177 STDMETHODIMP ProtocolSinkWrap::ReportResult(HRESULT result, DWORD error, |
178 LPCWSTR result_text) { | 178 LPCWSTR result_text) { |
179 DLOG(INFO) << "ProtocolSinkWrap::ReportResult: result: " << result << | 179 DVLOG(1) << "ProtocolSinkWrap::ReportResult: result: " << result |
180 " error: " << error << " Text: " << (result_text ? result_text : L""); | 180 << " error: " << error |
| 181 << " Text: " << (result_text ? result_text : L""); |
181 ExceptionBarrier barrier; | 182 ExceptionBarrier barrier; |
182 HRESULT hr = prot_data_->ReportResult(delegate_, result, error, result_text); | 183 HRESULT hr = prot_data_->ReportResult(delegate_, result, error, result_text); |
183 return hr; | 184 return hr; |
184 } | 185 } |
185 | 186 |
186 | 187 |
187 // Helpers | 188 // Helpers |
188 ScopedComPtr<IBindCtx> BindCtxFromIBindInfo(IInternetBindInfo* bind_info) { | 189 ScopedComPtr<IBindCtx> BindCtxFromIBindInfo(IInternetBindInfo* bind_info) { |
189 LPOLESTR bind_ctx_string = NULL; | 190 LPOLESTR bind_ctx_string = NULL; |
190 ULONG count; | 191 ULONG count; |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 } | 354 } |
354 | 355 |
355 // ProtData | 356 // ProtData |
356 ProtData::ProtData(IInternetProtocol* protocol, | 357 ProtData::ProtData(IInternetProtocol* protocol, |
357 InternetProtocol_Read_Fn read_fun, const wchar_t* url) | 358 InternetProtocol_Read_Fn read_fun, const wchar_t* url) |
358 : has_suggested_mime_type_(false), has_server_mime_type_(false), | 359 : has_suggested_mime_type_(false), has_server_mime_type_(false), |
359 buffer_size_(0), buffer_pos_(0), | 360 buffer_size_(0), buffer_pos_(0), |
360 renderer_type_(RENDERER_TYPE_UNDETERMINED), protocol_(protocol), | 361 renderer_type_(RENDERER_TYPE_UNDETERMINED), protocol_(protocol), |
361 read_fun_(read_fun), url_(url) { | 362 read_fun_(read_fun), url_(url) { |
362 memset(buffer_, 0, arraysize(buffer_)); | 363 memset(buffer_, 0, arraysize(buffer_)); |
363 DLOG(INFO) << __FUNCTION__ << " " << this; | 364 DVLOG(1) << __FUNCTION__ << " " << this; |
364 | 365 |
365 // Add to map. | 366 // Add to map. |
366 AutoLock lock(datamap_lock_); | 367 AutoLock lock(datamap_lock_); |
367 DCHECK(datamap_.end() == datamap_.find(protocol_)); | 368 DCHECK(datamap_.end() == datamap_.find(protocol_)); |
368 datamap_[protocol] = this; | 369 datamap_[protocol] = this; |
369 } | 370 } |
370 | 371 |
371 ProtData::~ProtData() { | 372 ProtData::~ProtData() { |
372 DLOG(INFO) << __FUNCTION__ << " " << this; | 373 DVLOG(1) << __FUNCTION__ << " " << this; |
373 Invalidate(); | 374 Invalidate(); |
374 } | 375 } |
375 | 376 |
376 HRESULT ProtData::Read(void* buffer, ULONG size, ULONG* size_read) { | 377 HRESULT ProtData::Read(void* buffer, ULONG size, ULONG* size_read) { |
377 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { | 378 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
378 return E_PENDING; | 379 return E_PENDING; |
379 } | 380 } |
380 | 381 |
381 const ULONG bytes_available = buffer_size_ - buffer_pos_; | 382 const ULONG bytes_available = buffer_size_ - buffer_pos_; |
382 const ULONG bytes_to_copy = std::min(bytes_available, size); | 383 const ULONG bytes_to_copy = std::min(bytes_available, size); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // We may ask CTransaction (our protocol_ member) for IWinInetHttpInfo. | 453 // We may ask CTransaction (our protocol_ member) for IWinInetHttpInfo. |
453 ScopedComPtr<IWinInetHttpInfo> info; | 454 ScopedComPtr<IWinInetHttpInfo> info; |
454 info.QueryFrom(delegate); | 455 info.QueryFrom(delegate); |
455 renderer_type_ = DetermineRendererTypeFromMetaData(suggested_mime_type_, | 456 renderer_type_ = DetermineRendererTypeFromMetaData(suggested_mime_type_, |
456 url_, info); | 457 url_, info); |
457 } | 458 } |
458 | 459 |
459 if (IsChrome(renderer_type_)) { | 460 if (IsChrome(renderer_type_)) { |
460 // Suggested mime type is "text/html" and we have DEFAULT_RENDERER, | 461 // Suggested mime type is "text/html" and we have DEFAULT_RENDERER, |
461 // OPT_IN_URL, or RESPONSE_HEADER. | 462 // OPT_IN_URL, or RESPONSE_HEADER. |
462 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 463 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
463 << kChromeMimeType; | 464 << kChromeMimeType; |
464 SaveReferrer(delegate); | 465 SaveReferrer(delegate); |
465 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 466 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
466 } else if (renderer_type_ == RENDERER_TYPE_OTHER) { | 467 } else if (renderer_type_ == RENDERER_TYPE_OTHER) { |
467 // Suggested mime type is not "text/html" - we are not interested in | 468 // Suggested mime type is not "text/html" - we are not interested in |
468 // this request anymore. | 469 // this request anymore. |
469 FireSuggestedMimeType(delegate); | 470 FireSuggestedMimeType(delegate); |
470 } else { | 471 } else { |
471 // Suggested mime type is "text/html"; We will try to sniff the | 472 // Suggested mime type is "text/html"; We will try to sniff the |
472 // HTML content in ReportData. | 473 // HTML content in ReportData. |
473 DCHECK_EQ(RENDERER_TYPE_UNDETERMINED, renderer_type_); | 474 DCHECK_EQ(RENDERER_TYPE_UNDETERMINED, renderer_type_); |
(...skipping 22 matching lines...) Expand all Loading... |
496 } | 497 } |
497 | 498 |
498 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); | 499 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); |
499 | 500 |
500 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { | 501 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
501 // do not report anything, we need more data. | 502 // do not report anything, we need more data. |
502 return S_OK; | 503 return S_OK; |
503 } | 504 } |
504 | 505 |
505 if (IsChrome(renderer_type_)) { | 506 if (IsChrome(renderer_type_)) { |
506 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 507 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " << kChromeMimeType; |
507 << kChromeMimeType; | |
508 SaveReferrer(delegate); | 508 SaveReferrer(delegate); |
509 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 509 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
510 } | 510 } |
511 | 511 |
512 if (renderer_type_ == RENDERER_TYPE_OTHER) { | 512 if (renderer_type_ == RENDERER_TYPE_OTHER) { |
513 FireSuggestedMimeType(delegate); | 513 FireSuggestedMimeType(delegate); |
514 } | 514 } |
515 | 515 |
516 // This is the first data notification we forward, since up to now we hold | 516 // This is the first data notification we forward, since up to now we hold |
517 // the content received. | 517 // the content received. |
518 flags |= BSCF_FIRSTDATANOTIFICATION; | 518 flags |= BSCF_FIRSTDATANOTIFICATION; |
519 | 519 |
520 if (hr == S_FALSE) { | 520 if (hr == S_FALSE) { |
521 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); | 521 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); |
522 } | 522 } |
523 | 523 |
524 return delegate->ReportData(flags, progress, max_progress); | 524 return delegate->ReportData(flags, progress, max_progress); |
525 } | 525 } |
526 | 526 |
527 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, | 527 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, |
528 DWORD error, LPCWSTR result_text) { | 528 DWORD error, LPCWSTR result_text) { |
529 // We may receive ReportResult without ReportData, if the connection fails | 529 // We may receive ReportResult without ReportData, if the connection fails |
530 // for example. | 530 // for example. |
531 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { | 531 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
532 DLOG(INFO) << "ReportResult received but renderer type is yet unknown."; | 532 DVLOG(1) << "ReportResult received but renderer type is yet unknown."; |
533 renderer_type_ = RENDERER_TYPE_OTHER; | 533 renderer_type_ = RENDERER_TYPE_OTHER; |
534 FireSuggestedMimeType(delegate); | 534 FireSuggestedMimeType(delegate); |
535 } | 535 } |
536 | 536 |
537 HRESULT hr = S_OK; | 537 HRESULT hr = S_OK; |
538 if (delegate) | 538 if (delegate) |
539 hr = delegate->ReportResult(result, error, result_text); | 539 hr = delegate->ReportResult(result, error, result_text); |
540 return hr; | 540 return hr; |
541 } | 541 } |
542 | 542 |
(...skipping 19 matching lines...) Expand all Loading... |
562 return hr_read; | 562 return hr_read; |
563 } | 563 } |
564 | 564 |
565 void ProtData::SaveSuggestedMimeType(LPCWSTR status_text) { | 565 void ProtData::SaveSuggestedMimeType(LPCWSTR status_text) { |
566 has_suggested_mime_type_ = true; | 566 has_suggested_mime_type_ = true; |
567 suggested_mime_type_.Allocate(status_text); | 567 suggested_mime_type_.Allocate(status_text); |
568 } | 568 } |
569 | 569 |
570 void ProtData::FireSuggestedMimeType(IInternetProtocolSink* delegate) { | 570 void ProtData::FireSuggestedMimeType(IInternetProtocolSink* delegate) { |
571 if (has_server_mime_type_) { | 571 if (has_server_mime_type_) { |
572 DLOG(INFO) << "Forwarding BINDSTATUS_SERVER_MIMETYPEAVAILABLE " | 572 DVLOG(1) << "Forwarding BINDSTATUS_SERVER_MIMETYPEAVAILABLE " |
573 << suggested_mime_type_; | 573 << suggested_mime_type_; |
574 delegate->ReportProgress(BINDSTATUS_SERVER_MIMETYPEAVAILABLE, | 574 delegate->ReportProgress(BINDSTATUS_SERVER_MIMETYPEAVAILABLE, |
575 suggested_mime_type_); | 575 suggested_mime_type_); |
576 } | 576 } |
577 | 577 |
578 if (has_suggested_mime_type_) { | 578 if (has_suggested_mime_type_) { |
579 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 579 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
580 << suggested_mime_type_; | 580 << suggested_mime_type_; |
581 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, | 581 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, |
582 suggested_mime_type_); | 582 suggested_mime_type_); |
583 } | 583 } |
584 } | 584 } |
585 | 585 |
586 void ProtData::SaveReferrer(IInternetProtocolSink* delegate) { | 586 void ProtData::SaveReferrer(IInternetProtocolSink* delegate) { |
587 DCHECK(IsChrome(renderer_type_)); | 587 DCHECK(IsChrome(renderer_type_)); |
588 ScopedComPtr<IWinInetHttpInfo> info; | 588 ScopedComPtr<IWinInetHttpInfo> info; |
589 info.QueryFrom(delegate); | 589 info.QueryFrom(delegate); |
590 if (info) { | 590 if (info) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 IInternetBindInfo* bind_info, DWORD flags, HANDLE_PTR reserved) { | 674 IInternetBindInfo* bind_info, DWORD flags, HANDLE_PTR reserved) { |
675 DCHECK(orig_start); | 675 DCHECK(orig_start); |
676 if (!url || !prot_sink || !bind_info) | 676 if (!url || !prot_sink || !bind_info) |
677 return E_INVALIDARG; | 677 return E_INVALIDARG; |
678 DLOG_IF(INFO, url != NULL) << "OnStart: " << url << PiFlags2Str(flags); | 678 DLOG_IF(INFO, url != NULL) << "OnStart: " << url << PiFlags2Str(flags); |
679 | 679 |
680 ScopedComPtr<IBindCtx> bind_ctx = BindCtxFromIBindInfo(bind_info); | 680 ScopedComPtr<IBindCtx> bind_ctx = BindCtxFromIBindInfo(bind_info); |
681 if (!bind_ctx) { | 681 if (!bind_ctx) { |
682 // MSHTML sometimes takes a short path, skips the creation of | 682 // MSHTML sometimes takes a short path, skips the creation of |
683 // moniker and binding, by directly grabbing protocol from InternetSession | 683 // moniker and binding, by directly grabbing protocol from InternetSession |
684 DLOG(INFO) << "DirectBind for " << url; | 684 DVLOG(1) << "DirectBind for " << url; |
685 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, | 685 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, |
686 flags, reserved); | 686 flags, reserved); |
687 } | 687 } |
688 | 688 |
689 scoped_refptr<ProtData> prot_data = ProtData::DataFromProtocol(protocol); | 689 scoped_refptr<ProtData> prot_data = ProtData::DataFromProtocol(protocol); |
690 if (prot_data && !HasProtData(bind_ctx)) { | 690 if (prot_data && !HasProtData(bind_ctx)) { |
691 prot_data->Invalidate(); | 691 prot_data->Invalidate(); |
692 prot_data = NULL; | 692 prot_data = NULL; |
693 } | 693 } |
694 | 694 |
695 if (HandleAttachToExistingExternalTab(url, protocol, prot_sink, bind_ctx)) { | 695 if (HandleAttachToExistingExternalTab(url, protocol, prot_sink, bind_ctx)) { |
696 return S_OK; | 696 return S_OK; |
697 } | 697 } |
698 | 698 |
699 if (IsCFRequest(bind_ctx)) { | 699 if (IsCFRequest(bind_ctx)) { |
700 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, | 700 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, |
701 flags, reserved); | 701 flags, reserved); |
702 } | 702 } |
703 | 703 |
704 if (prot_data) { | 704 if (prot_data) { |
705 DLOG(INFO) << "Found existing ProtData!"; | 705 DVLOG(1) << "Found existing ProtData!"; |
706 prot_data->UpdateUrl(url); | 706 prot_data->UpdateUrl(url); |
707 ScopedComPtr<IInternetProtocolSink> new_sink = | 707 ScopedComPtr<IInternetProtocolSink> new_sink = |
708 ProtocolSinkWrap::CreateNewSink(prot_sink, prot_data); | 708 ProtocolSinkWrap::CreateNewSink(prot_sink, prot_data); |
709 return ForwardWrappedHookStart(orig_start, protocol, url, new_sink, | 709 return ForwardWrappedHookStart(orig_start, protocol, url, new_sink, |
710 bind_info, flags, reserved); | 710 bind_info, flags, reserved); |
711 } | 711 } |
712 | 712 |
713 if (!ShouldWrapSink(prot_sink, url)) { | 713 if (!ShouldWrapSink(prot_sink, url)) { |
714 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, | 714 return ForwardHookStart(orig_start, protocol, url, prot_sink, bind_info, |
715 flags, reserved); | 715 flags, reserved); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 return E_INVALIDARG; | 749 return E_INVALIDARG; |
750 | 750 |
751 ScopedBstr url; | 751 ScopedBstr url; |
752 uri->GetPropertyBSTR(Uri_PROPERTY_ABSOLUTE_URI, url.Receive(), 0); | 752 uri->GetPropertyBSTR(Uri_PROPERTY_ABSOLUTE_URI, url.Receive(), 0); |
753 DLOG_IF(INFO, url != NULL) << "OnStartEx: " << url << PiFlags2Str(flags); | 753 DLOG_IF(INFO, url != NULL) << "OnStartEx: " << url << PiFlags2Str(flags); |
754 | 754 |
755 ScopedComPtr<IBindCtx> bind_ctx = BindCtxFromIBindInfo(bind_info); | 755 ScopedComPtr<IBindCtx> bind_ctx = BindCtxFromIBindInfo(bind_info); |
756 if (!bind_ctx) { | 756 if (!bind_ctx) { |
757 // MSHTML sometimes takes a short path, skips the creation of | 757 // MSHTML sometimes takes a short path, skips the creation of |
758 // moniker and binding, by directly grabbing protocol from InternetSession. | 758 // moniker and binding, by directly grabbing protocol from InternetSession. |
759 DLOG(INFO) << "DirectBind for " << url; | 759 DVLOG(1) << "DirectBind for " << url; |
760 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, | 760 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, |
761 bind_info, flags, reserved); | 761 bind_info, flags, reserved); |
762 } | 762 } |
763 | 763 |
764 scoped_refptr<ProtData> prot_data = ProtData::DataFromProtocol(protocol); | 764 scoped_refptr<ProtData> prot_data = ProtData::DataFromProtocol(protocol); |
765 if (prot_data && !HasProtData(bind_ctx)) { | 765 if (prot_data && !HasProtData(bind_ctx)) { |
766 prot_data->Invalidate(); | 766 prot_data->Invalidate(); |
767 prot_data = NULL; | 767 prot_data = NULL; |
768 } | 768 } |
769 | 769 |
770 if (HandleAttachToExistingExternalTab(url, protocol, prot_sink, bind_ctx)) { | 770 if (HandleAttachToExistingExternalTab(url, protocol, prot_sink, bind_ctx)) { |
771 return S_OK; | 771 return S_OK; |
772 } | 772 } |
773 | 773 |
774 if (IsCFRequest(bind_ctx)) { | 774 if (IsCFRequest(bind_ctx)) { |
775 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, | 775 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, |
776 bind_info, flags, reserved); | 776 bind_info, flags, reserved); |
777 } | 777 } |
778 | 778 |
779 if (prot_data) { | 779 if (prot_data) { |
780 DLOG(INFO) << "Found existing ProtData!"; | 780 DVLOG(1) << "Found existing ProtData!"; |
781 prot_data->UpdateUrl(url); | 781 prot_data->UpdateUrl(url); |
782 ScopedComPtr<IInternetProtocolSink> new_sink = | 782 ScopedComPtr<IInternetProtocolSink> new_sink = |
783 ProtocolSinkWrap::CreateNewSink(prot_sink, prot_data); | 783 ProtocolSinkWrap::CreateNewSink(prot_sink, prot_data); |
784 return ForwardWrappedHookStartEx(orig_start_ex, protocol, uri, new_sink, | 784 return ForwardWrappedHookStartEx(orig_start_ex, protocol, uri, new_sink, |
785 bind_info, flags, reserved); | 785 bind_info, flags, reserved); |
786 } | 786 } |
787 | 787 |
788 if (!ShouldWrapSink(prot_sink, url)) { | 788 if (!ShouldWrapSink(prot_sink, url)) { |
789 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, | 789 return ForwardHookStartEx(orig_start_ex, protocol, uri, prot_sink, |
790 bind_info, flags, reserved); | 790 bind_info, flags, reserved); |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
954 // Explicit release, otherwise ~CComObjectStackEx will complain about | 954 // Explicit release, otherwise ~CComObjectStackEx will complain about |
955 // outstanding reference to us, because it runs before ~FakeProtocol | 955 // outstanding reference to us, because it runs before ~FakeProtocol |
956 prot.transaction_.Release(); | 956 prot.transaction_.Release(); |
957 } | 957 } |
958 } | 958 } |
959 | 959 |
960 void TransactionHooks::RevertHooks() { | 960 void TransactionHooks::RevertHooks() { |
961 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 961 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
962 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 962 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
963 } | 963 } |
OLD | NEW |