| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 if (renderer_type_ == CHROME) { | 413 if (renderer_type_ == CHROME) { |
| 414 // Suggested mime type is "text/html" and we either have OptInUrl | 414 // Suggested mime type is "text/html" and we either have OptInUrl |
| 415 // or X-UA-Compatible HTTP headers. | 415 // or X-UA-Compatible HTTP headers. |
| 416 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 416 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
| 417 << kChromeMimeType; | 417 << kChromeMimeType; |
| 418 SaveReferrer(delegate); | 418 SaveReferrer(delegate); |
| 419 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 419 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
| 420 } else if (renderer_type_ == OTHER) { | 420 } else if (renderer_type_ == OTHER) { |
| 421 // Suggested mime type is not "text/html" - we are not interested in | 421 // Suggested mime type is not "text/html" - we are not interested in |
| 422 // this request anymore. | 422 // this request anymore. |
| 423 FireSugestedMimeType(delegate); | 423 FireSuggestedMimeType(delegate); |
| 424 } else { | 424 } else { |
| 425 // Suggested mime type is "text/html"; We will try to sniff the | 425 // Suggested mime type is "text/html"; We will try to sniff the |
| 426 // HTML content in ReportData. | 426 // HTML content in ReportData. |
| 427 DCHECK_EQ(UNDETERMINED, renderer_type_); | 427 DCHECK_EQ(UNDETERMINED, renderer_type_); |
| 428 } | 428 } |
| 429 return S_OK; | 429 return S_OK; |
| 430 } | 430 } |
| 431 | 431 |
| 432 return delegate->ReportProgress(status_code, status_text); | 432 return delegate->ReportProgress(status_code, status_text); |
| 433 } | 433 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 453 } | 453 } |
| 454 | 454 |
| 455 if (renderer_type_ == CHROME) { | 455 if (renderer_type_ == CHROME) { |
| 456 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 456 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
| 457 << kChromeMimeType; | 457 << kChromeMimeType; |
| 458 SaveReferrer(delegate); | 458 SaveReferrer(delegate); |
| 459 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 459 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
| 460 } | 460 } |
| 461 | 461 |
| 462 if (renderer_type_ == OTHER) { | 462 if (renderer_type_ == OTHER) { |
| 463 FireSugestedMimeType(delegate); | 463 FireSuggestedMimeType(delegate); |
| 464 } | 464 } |
| 465 | 465 |
| 466 // This is the first data notification we forward, since up to now we hold | 466 // This is the first data notification we forward, since up to now we hold |
| 467 // the content received. | 467 // the content received. |
| 468 flags |= BSCF_FIRSTDATANOTIFICATION; | 468 flags |= BSCF_FIRSTDATANOTIFICATION; |
| 469 | 469 |
| 470 if (hr == S_FALSE) { | 470 if (hr == S_FALSE) { |
| 471 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); | 471 flags |= (BSCF_LASTDATANOTIFICATION | BSCF_DATAFULLYAVAILABLE); |
| 472 } | 472 } |
| 473 | 473 |
| 474 return delegate->ReportData(flags, progress, max_progress); | 474 return delegate->ReportData(flags, progress, max_progress); |
| 475 } | 475 } |
| 476 | 476 |
| 477 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, | 477 HRESULT ProtData::ReportResult(IInternetProtocolSink* delegate, HRESULT result, |
| 478 DWORD error, LPCWSTR result_text) { | 478 DWORD error, LPCWSTR result_text) { |
| 479 // We may receive ReportResult without ReportData, if the connection fails | 479 // We may receive ReportResult without ReportData, if the connection fails |
| 480 // for example. | 480 // for example. |
| 481 if (renderer_type_ == UNDETERMINED) { | 481 if (renderer_type_ == UNDETERMINED) { |
| 482 DLOG(INFO) << "ReportResult received but renderer type is yet unknown."; | 482 DLOG(INFO) << "ReportResult received but renderer type is yet unknown."; |
| 483 renderer_type_ = OTHER; | 483 renderer_type_ = OTHER; |
| 484 FireSugestedMimeType(delegate); | 484 FireSuggestedMimeType(delegate); |
| 485 } | 485 } |
| 486 | 486 |
| 487 HRESULT hr = S_OK; | 487 HRESULT hr = S_OK; |
| 488 if (delegate) | 488 if (delegate) |
| 489 hr = delegate->ReportResult(result, error, result_text); | 489 hr = delegate->ReportResult(result, error, result_text); |
| 490 return hr; | 490 return hr; |
| 491 } | 491 } |
| 492 | 492 |
| 493 | 493 |
| 494 void ProtData::UpdateUrl(const wchar_t* url) { | 494 void ProtData::UpdateUrl(const wchar_t* url) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 510 } | 510 } |
| 511 | 511 |
| 512 return hr_read; | 512 return hr_read; |
| 513 } | 513 } |
| 514 | 514 |
| 515 void ProtData::SaveSuggestedMimeType(LPCWSTR status_text) { | 515 void ProtData::SaveSuggestedMimeType(LPCWSTR status_text) { |
| 516 has_suggested_mime_type_ = true; | 516 has_suggested_mime_type_ = true; |
| 517 suggested_mime_type_.Allocate(status_text); | 517 suggested_mime_type_.Allocate(status_text); |
| 518 } | 518 } |
| 519 | 519 |
| 520 void ProtData::FireSugestedMimeType(IInternetProtocolSink* delegate) { | 520 void ProtData::FireSuggestedMimeType(IInternetProtocolSink* delegate) { |
| 521 if (has_server_mime_type_) { | 521 if (has_server_mime_type_) { |
| 522 DLOG(INFO) << "Forwarding BINDSTATUS_SERVER_MIMETYPEAVAILABLE " | 522 DLOG(INFO) << "Forwarding BINDSTATUS_SERVER_MIMETYPEAVAILABLE " |
| 523 << suggested_mime_type_; | 523 << suggested_mime_type_; |
| 524 delegate->ReportProgress(BINDSTATUS_SERVER_MIMETYPEAVAILABLE, | 524 delegate->ReportProgress(BINDSTATUS_SERVER_MIMETYPEAVAILABLE, |
| 525 suggested_mime_type_); | 525 suggested_mime_type_); |
| 526 } | 526 } |
| 527 | 527 |
| 528 if (has_suggested_mime_type_) { | 528 if (has_suggested_mime_type_) { |
| 529 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " | 529 DLOG(INFO) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " |
| 530 << suggested_mime_type_; | 530 << suggested_mime_type_; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 // Explicit release, otherwise ~CComObjectStackEx will complain about | 863 // Explicit release, otherwise ~CComObjectStackEx will complain about |
| 864 // outstanding reference to us, because it runs before ~FakeProtocol | 864 // outstanding reference to us, because it runs before ~FakeProtocol |
| 865 prot.transaction_.Release(); | 865 prot.transaction_.Release(); |
| 866 } | 866 } |
| 867 } | 867 } |
| 868 | 868 |
| 869 void TransactionHooks::RevertHooks() { | 869 void TransactionHooks::RevertHooks() { |
| 870 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 870 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
| 871 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 871 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
| 872 } | 872 } |
| OLD | NEW |