| 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 "chrome_frame/bho.h" | 5 #include "chrome_frame/bho.h" |
| 6 | 6 |
| 7 #include <shlguid.h> | 7 #include <shlguid.h> |
| 8 #include <shobjidl.h> | 8 #include <shobjidl.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/registry.h" | 11 #include "base/registry.h" |
| 12 #include "base/scoped_bstr_win.h" | 12 #include "base/scoped_bstr_win.h" |
| 13 #include "base/scoped_comptr_win.h" | 13 #include "base/scoped_comptr_win.h" |
| 14 #include "base/scoped_variant_win.h" | 14 #include "base/scoped_variant_win.h" |
| 15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
| 16 #include "chrome_tab.h" // NOLINT | 16 #include "chrome_tab.h" // NOLINT |
| 17 #include "chrome_frame/http_negotiate.h" |
| 17 #include "chrome_frame/protocol_sink_wrap.h" | 18 #include "chrome_frame/protocol_sink_wrap.h" |
| 18 #include "chrome_frame/utils.h" | 19 #include "chrome_frame/utils.h" |
| 19 #include "chrome_frame/vtable_patch_manager.h" | 20 #include "chrome_frame/vtable_patch_manager.h" |
| 20 | 21 |
| 21 const wchar_t kPatchProtocols[] = L"PatchProtocols"; | 22 const wchar_t kPatchProtocols[] = L"PatchProtocols"; |
| 22 static const int kIBrowserServiceOnHttpEquivIndex = 30; | 23 static const int kIBrowserServiceOnHttpEquivIndex = 30; |
| 23 | 24 |
| 24 PatchHelper g_patch_helper; | 25 PatchHelper g_patch_helper; |
| 25 | 26 |
| 26 BEGIN_VTABLE_PATCHES(IBrowserService) | 27 BEGIN_VTABLE_PATCHES(IBrowserService) |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 << std::endl << "Url: " << url; | 208 << std::endl << "Url: " << url; |
| 208 } | 209 } |
| 209 | 210 |
| 210 return S_OK; | 211 return S_OK; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void PatchHelper::InitializeAndPatchProtocolsIfNeeded() { | 214 void PatchHelper::InitializeAndPatchProtocolsIfNeeded() { |
| 214 if (state_ != UNKNOWN) | 215 if (state_ != UNKNOWN) |
| 215 return; | 216 return; |
| 216 | 217 |
| 218 HttpNegotiatePatch::Initialize(); |
| 219 |
| 217 bool patch_protocol = GetConfigBool(true, kPatchProtocols); | 220 bool patch_protocol = GetConfigBool(true, kPatchProtocols); |
| 218 if (patch_protocol) { | 221 if (patch_protocol) { |
| 219 ProtocolSinkWrap::PatchProtocolHandlers(); | 222 ProtocolSinkWrap::PatchProtocolHandlers(); |
| 220 state_ = PATCH_PROTOCOL; | 223 state_ = PATCH_PROTOCOL; |
| 221 } else { | 224 } else { |
| 222 state_ = PATCH_IBROWSER; | 225 state_ = PATCH_IBROWSER; |
| 223 } | 226 } |
| 224 } | 227 } |
| 225 | 228 |
| 226 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { | 229 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { |
| 227 DCHECK(state_ == PATCH_IBROWSER); | 230 DCHECK(state_ == PATCH_IBROWSER); |
| 228 state_ = PATCH_IBROWSER_OK; | 231 state_ = PATCH_IBROWSER_OK; |
| 229 vtable_patch::PatchInterfaceMethods(browser_service, | 232 vtable_patch::PatchInterfaceMethods(browser_service, |
| 230 IBrowserService_PatchInfo); | 233 IBrowserService_PatchInfo); |
| 231 } | 234 } |
| 232 | 235 |
| 233 void PatchHelper::UnpatchIfNeeded() { | 236 void PatchHelper::UnpatchIfNeeded() { |
| 234 if (state_ == PATCH_PROTOCOL) { | 237 if (state_ == PATCH_PROTOCOL) { |
| 235 ProtocolSinkWrap::UnpatchProtocolHandlers(); | 238 ProtocolSinkWrap::UnpatchProtocolHandlers(); |
| 236 } else if (state_ == PATCH_IBROWSER_OK) { | 239 } else if (state_ == PATCH_IBROWSER_OK) { |
| 237 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); | 240 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); |
| 238 } | 241 } |
| 239 | 242 |
| 243 HttpNegotiatePatch::Uninitialize(); |
| 244 |
| 240 state_ = UNKNOWN; | 245 state_ = UNKNOWN; |
| 241 } | 246 } |
| 242 | 247 |
| OLD | NEW |