OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <algorithm> | |
7 | 8 |
8 #include "chrome_frame/protocol_sink_wrap.h" | 9 #include "chrome_frame/protocol_sink_wrap.h" |
9 | 10 |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
12 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
13 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
16 #include "base/win/scoped_bstr.h" | 17 #include "base/win/scoped_bstr.h" |
17 #include "chrome_frame/bho.h" | 18 #include "chrome_frame/bho.h" |
18 #include "chrome_frame/bind_context_info.h" | 19 #include "chrome_frame/bind_context_info.h" |
19 #include "chrome_frame/exception_barrier.h" | 20 #include "chrome_frame/exception_barrier.h" |
20 #include "chrome_frame/function_stub.h" | 21 #include "chrome_frame/function_stub.h" |
21 #include "chrome_frame/policy_settings.h" | 22 #include "chrome_frame/policy_settings.h" |
22 #include "chrome_frame/utils.h" | 23 #include "chrome_frame/utils.h" |
23 | 24 |
25 using std::min; | |
26 | |
24 // BINDSTATUS_SERVER_MIMETYPEAVAILABLE == 54. Introduced in IE 8, so | 27 // BINDSTATUS_SERVER_MIMETYPEAVAILABLE == 54. Introduced in IE 8, so |
25 // not in everyone's headers yet. See: | 28 // not in everyone's headers yet. See: |
26 // http://msdn.microsoft.com/en-us/library/ms775133(VS.85,loband).aspx | 29 // http://msdn.microsoft.com/en-us/library/ms775133(VS.85,loband).aspx |
27 #ifndef BINDSTATUS_SERVER_MIMETYPEAVAILABLE | 30 #ifndef BINDSTATUS_SERVER_MIMETYPEAVAILABLE |
28 #define BINDSTATUS_SERVER_MIMETYPEAVAILABLE 54 | 31 #define BINDSTATUS_SERVER_MIMETYPEAVAILABLE 54 |
29 #endif | 32 #endif |
30 | 33 |
31 bool ProtocolSinkWrap::ignore_xua_ = false; | 34 bool ProtocolSinkWrap::ignore_xua_ = false; |
32 | 35 |
33 static const char kTextHtmlMimeType[] = "text/html"; | 36 static const char kTextHtmlMimeType[] = "text/html"; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
458 return S_OK; | 461 return S_OK; |
459 } | 462 } |
460 | 463 |
461 // We are just pass through at this point, avoid false positive crash reports. | 464 // We are just pass through at this point, avoid false positive crash reports. |
462 ExceptionBarrierReportOnlyModule barrier; | 465 ExceptionBarrierReportOnlyModule barrier; |
463 return delegate->ReportProgress(status_code, status_text); | 466 return delegate->ReportProgress(status_code, status_text); |
464 } | 467 } |
465 | 468 |
466 HRESULT ProtData::ReportData(IInternetProtocolSink* delegate, | 469 HRESULT ProtData::ReportData(IInternetProtocolSink* delegate, |
467 DWORD flags, ULONG progress, ULONG max_progress) { | 470 DWORD flags, ULONG progress, ULONG max_progress) { |
471 bool ignore_Use_GCF_MetaData = SkipMetaDataCheck(); | |
grt (UTC plus 2)
2013/08/02 01:42:50
since SkipMetaDataCheck may do work (hit the regis
| |
468 if (renderer_type_ != RENDERER_TYPE_UNDETERMINED) { | 472 if (renderer_type_ != RENDERER_TYPE_UNDETERMINED) { |
469 // We are just pass through now, avoid false positive crash reports. | 473 // We are just pass through now, avoid false positive crash reports. |
470 ExceptionBarrierReportOnlyModule barrier; | 474 ExceptionBarrierReportOnlyModule barrier; |
471 return delegate->ReportData(flags, progress, max_progress); | 475 return delegate->ReportData(flags, progress, max_progress); |
472 } | 476 } |
473 | 477 |
474 HRESULT hr = FillBuffer(); | 478 HRESULT hr = FillBuffer(); |
475 | 479 |
476 bool last_chance = false; | 480 bool last_chance = false; |
477 if (hr == S_OK || hr == S_FALSE) { | 481 if (hr == S_OK || hr == S_FALSE) { |
478 last_chance = true; | 482 last_chance = true; |
479 } | 483 } |
480 | 484 |
481 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); | 485 renderer_type_ = ignore_Use_GCF_MetaData ? RENDERER_TYPE_OTHER |
486 : DetermineRendererType(buffer_, buffer_size_, last_chance); | |
482 | 487 |
483 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { | 488 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
484 // do not report anything, we need more data. | 489 // do not report anything, we need more data. |
485 return S_OK; | 490 return S_OK; |
486 } | 491 } |
487 | 492 |
488 if (IsChrome(renderer_type_)) { | 493 if (IsChrome(renderer_type_)) { |
489 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " << kChromeMimeType; | 494 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " << kChromeMimeType; |
490 SaveReferrer(delegate); | 495 SaveReferrer(delegate); |
491 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 496 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
997 // Explicit release, otherwise ~CComObjectStackEx will complain about | 1002 // Explicit release, otherwise ~CComObjectStackEx will complain about |
998 // outstanding reference to us, because it runs before ~FakeProtocol | 1003 // outstanding reference to us, because it runs before ~FakeProtocol |
999 prot.transaction_.Release(); | 1004 prot.transaction_.Release(); |
1000 } | 1005 } |
1001 } | 1006 } |
1002 | 1007 |
1003 void TransactionHooks::RevertHooks() { | 1008 void TransactionHooks::RevertHooks() { |
1004 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 1009 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
1005 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 1010 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
1006 } | 1011 } |
OLD | NEW |