| 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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 return delegate->ReportData(flags, progress, max_progress); | 474 return delegate->ReportData(flags, progress, max_progress); |
| 472 } | 475 } |
| 473 | 476 |
| 474 HRESULT hr = FillBuffer(); | 477 HRESULT hr = FillBuffer(); |
| 475 | 478 |
| 476 bool last_chance = false; | 479 bool last_chance = false; |
| 477 if (hr == S_OK || hr == S_FALSE) { | 480 if (hr == S_OK || hr == S_FALSE) { |
| 478 last_chance = true; | 481 last_chance = true; |
| 479 } | 482 } |
| 480 | 483 |
| 481 renderer_type_ = DetermineRendererType(buffer_, buffer_size_, last_chance); | 484 renderer_type_ = SkipMetadataCheck() ? RENDERER_TYPE_OTHER |
| 485 : DetermineRendererType(buffer_, buffer_size_, last_chance); |
| 482 | 486 |
| 483 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { | 487 if (renderer_type_ == RENDERER_TYPE_UNDETERMINED) { |
| 484 // do not report anything, we need more data. | 488 // do not report anything, we need more data. |
| 485 return S_OK; | 489 return S_OK; |
| 486 } | 490 } |
| 487 | 491 |
| 488 if (IsChrome(renderer_type_)) { | 492 if (IsChrome(renderer_type_)) { |
| 489 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " << kChromeMimeType; | 493 DVLOG(1) << "Forwarding BINDSTATUS_MIMETYPEAVAILABLE " << kChromeMimeType; |
| 490 SaveReferrer(delegate); | 494 SaveReferrer(delegate); |
| 491 delegate->ReportProgress(BINDSTATUS_MIMETYPEAVAILABLE, kChromeMimeType); | 495 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 | 1001 // Explicit release, otherwise ~CComObjectStackEx will complain about |
| 998 // outstanding reference to us, because it runs before ~FakeProtocol | 1002 // outstanding reference to us, because it runs before ~FakeProtocol |
| 999 prot.transaction_.Release(); | 1003 prot.transaction_.Release(); |
| 1000 } | 1004 } |
| 1001 } | 1005 } |
| 1002 | 1006 |
| 1003 void TransactionHooks::RevertHooks() { | 1007 void TransactionHooks::RevertHooks() { |
| 1004 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 1008 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
| 1005 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 1009 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
| 1006 } | 1010 } |
| OLD | NEW |