Chromium Code Reviews| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 if (bind_ctx_string) { | 138 if (bind_ctx_string) { |
| 139 IBindCtx* pbc = reinterpret_cast<IBindCtx*>(StringToInt(bind_ctx_string)); | 139 IBindCtx* pbc = reinterpret_cast<IBindCtx*>(StringToInt(bind_ctx_string)); |
| 140 bind_ctx.Attach(pbc); | 140 bind_ctx.Attach(pbc); |
| 141 CoTaskMemFree(bind_ctx_string); | 141 CoTaskMemFree(bind_ctx_string); |
| 142 } | 142 } |
| 143 | 143 |
| 144 return bind_ctx; | 144 return bind_ctx; |
| 145 } | 145 } |
| 146 | 146 |
| 147 bool ShouldWrapSink(IInternetProtocolSink* sink, const wchar_t* url) { | 147 bool ShouldWrapSink(IInternetProtocolSink* sink, const wchar_t* url) { |
| 148 // TODO(stoyan): check the url scheme for http/https. | 148 // Ignore everything that does not start with http:// or https://. |
| 149 // |url| is already normalized (i.e. no leading spaces, capital letters in | |
| 150 // protocol etc) and non-null (we check in Hook_Start). | |
| 151 DCHECK(url != NULL); | |
| 152 if ((url != StrStrW(url, L"http://")) && (url != StrStrW(url, L"https://"))) | |
|
tommi (sloooow) - chröme
2010/07/14 19:18:44
use StartsWith?
stoyan
2010/07/14 19:34:10
StartsWith wants me to create std::string object.
| |
| 153 return false; | |
| 154 | |
| 149 ScopedComPtr<IHttpNegotiate> http_negotiate; | 155 ScopedComPtr<IHttpNegotiate> http_negotiate; |
| 150 HRESULT hr = DoQueryService(GUID_NULL, sink, http_negotiate.Receive()); | 156 HRESULT hr = DoQueryService(GUID_NULL, sink, http_negotiate.Receive()); |
| 151 if (http_negotiate && !IsSubFrameRequest(http_negotiate)) | 157 if (http_negotiate && !IsSubFrameRequest(http_negotiate)) |
| 152 return true; | 158 return true; |
| 153 | 159 |
| 154 return false; | 160 return false; |
| 155 } | 161 } |
| 156 | 162 |
| 157 // High level helpers | 163 // High level helpers |
| 158 bool IsCFRequest(IBindCtx* pbc) { | 164 bool IsCFRequest(IBindCtx* pbc) { |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 656 // Explicit release, otherwise ~CComObjectStackEx will complain about | 662 // Explicit release, otherwise ~CComObjectStackEx will complain about |
| 657 // outstanding reference to us, because it runs before ~FakeProtocol | 663 // outstanding reference to us, because it runs before ~FakeProtocol |
| 658 prot.transaction_.Release(); | 664 prot.transaction_.Release(); |
| 659 } | 665 } |
| 660 } | 666 } |
| 661 | 667 |
| 662 void TransactionHooks::RevertHooks() { | 668 void TransactionHooks::RevertHooks() { |
| 663 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); | 669 vtable_patch::UnpatchInterfaceMethods(CTransaction_PatchInfo); |
| 664 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); | 670 vtable_patch::UnpatchInterfaceMethods(CTransaction2_PatchInfo); |
| 665 } | 671 } |
| OLD | NEW |