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 | 8 |
9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 if (!browser_service || !CheckForCFNavigation(browser_service, false)) { | 116 if (!browser_service || !CheckForCFNavigation(browser_service, false)) { |
117 // TODO(tommi): Remove? Isn't this done below by calling set_referrer("")? | 117 // TODO(tommi): Remove? Isn't this done below by calling set_referrer("")? |
118 referrer_.clear(); | 118 referrer_.clear(); |
119 } | 119 } |
120 | 120 |
121 VARIANT_BOOL is_top_level = VARIANT_FALSE; | 121 VARIANT_BOOL is_top_level = VARIANT_FALSE; |
122 web_browser2->get_TopLevelContainer(&is_top_level); | 122 web_browser2->get_TopLevelContainer(&is_top_level); |
123 if (is_top_level) { | 123 if (is_top_level) { |
124 set_url(url->bstrVal); | 124 set_url(url->bstrVal); |
125 set_referrer(""); | 125 set_referrer(""); |
126 // The moniker patch checks opt-in URLs in SniffData::DetermineRendererType. | 126 if (IsIBrowserServicePatchEnabled()) { |
127 if (!MonikerPatchEnabled()) { | |
128 ProcessOptInUrls(web_browser2, url->bstrVal); | 127 ProcessOptInUrls(web_browser2, url->bstrVal); |
129 } | 128 } |
130 } | 129 } |
131 return S_OK; | 130 return S_OK; |
132 } | 131 } |
133 | 132 |
134 STDMETHODIMP_(void) Bho::NavigateComplete2(IDispatch* dispatch, VARIANT* url) { | 133 STDMETHODIMP_(void) Bho::NavigateComplete2(IDispatch* dispatch, VARIANT* url) { |
135 DLOG(INFO) << __FUNCTION__; | 134 DLOG(INFO) << __FUNCTION__; |
136 } | 135 } |
137 | 136 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 if (state_ == UNKNOWN) { | 312 if (state_ == UNKNOWN) { |
314 // If we're going to start patching things for reals, we'd better make sure | 313 // If we're going to start patching things for reals, we'd better make sure |
315 // that we stick around for ever more: | 314 // that we stick around for ever more: |
316 if (!IsUnpinnedMode()) | 315 if (!IsUnpinnedMode()) |
317 PinModule(); | 316 PinModule(); |
318 | 317 |
319 HttpNegotiatePatch::Initialize(); | 318 HttpNegotiatePatch::Initialize(); |
320 | 319 |
321 ProtocolPatchMethod patch_method = GetPatchMethod(); | 320 ProtocolPatchMethod patch_method = GetPatchMethod(); |
322 if (patch_method == PATCH_METHOD_INET_PROTOCOL) { | 321 if (patch_method == PATCH_METHOD_INET_PROTOCOL) { |
323 ProtocolSinkWrap::PatchProtocolHandlers(); | 322 g_trans_hooks.InstallHooks(); |
324 state_ = PATCH_PROTOCOL; | 323 state_ = PATCH_PROTOCOL; |
325 } else if (patch_method == PATCH_METHOD_IBROWSER) { | 324 } else if (patch_method == PATCH_METHOD_IBROWSER) { |
326 state_ = PATCH_IBROWSER; | 325 state_ = PATCH_IBROWSER; |
327 } else { | 326 } else { |
328 DCHECK(patch_method == PATCH_METHOD_MONIKER); | 327 DCHECK(patch_method == PATCH_METHOD_MONIKER); |
329 state_ = PATCH_MONIKER; | 328 state_ = PATCH_MONIKER; |
330 MonikerPatch::Initialize(); | 329 MonikerPatch::Initialize(); |
331 } | 330 } |
332 | 331 |
333 ret = true; | 332 ret = true; |
334 } | 333 } |
335 | 334 |
336 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); | 335 _pAtlModule->m_csStaticDataInitAndTypeInfo.Unlock(); |
337 | 336 |
338 return ret; | 337 return ret; |
339 } | 338 } |
340 | 339 |
341 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { | 340 void PatchHelper::PatchBrowserService(IBrowserService* browser_service) { |
342 DCHECK(state_ == PATCH_IBROWSER); | 341 DCHECK(state_ == PATCH_IBROWSER); |
343 if (!IS_PATCHED(IBrowserService)) { | 342 if (!IS_PATCHED(IBrowserService)) { |
344 vtable_patch::PatchInterfaceMethods(browser_service, | 343 vtable_patch::PatchInterfaceMethods(browser_service, |
345 IBrowserService_PatchInfo); | 344 IBrowserService_PatchInfo); |
346 } | 345 } |
347 } | 346 } |
348 | 347 |
349 void PatchHelper::UnpatchIfNeeded() { | 348 void PatchHelper::UnpatchIfNeeded() { |
350 if (state_ == PATCH_PROTOCOL) { | 349 if (state_ == PATCH_PROTOCOL) { |
351 ProtocolSinkWrap::UnpatchProtocolHandlers(); | 350 g_trans_hooks.RevertHooks(); |
352 } else if (state_ == PATCH_IBROWSER) { | 351 } else if (state_ == PATCH_IBROWSER) { |
353 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); | 352 vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo); |
354 MonikerPatch::Uninitialize(); | 353 MonikerPatch::Uninitialize(); |
355 } | 354 } |
356 | 355 |
357 HttpNegotiatePatch::Uninitialize(); | 356 HttpNegotiatePatch::Uninitialize(); |
358 | 357 |
359 state_ = UNKNOWN; | 358 state_ = UNKNOWN; |
360 } | 359 } |
361 | 360 |
OLD | NEW |