Chromium Code Reviews| 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 "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" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/stringprintf.h" | 13 #include "base/stringprintf.h" |
| 14 #include "base/threading/platform_thread.h" | |
| 14 #include "base/win/scoped_bstr.h" | 15 #include "base/win/scoped_bstr.h" |
| 15 #include "chrome_tab.h" // NOLINT | 16 #include "chrome_frame/buggy_bho_handling.h" |
| 16 #include "chrome_frame/crash_reporting/crash_metrics.h" | 17 #include "chrome_frame/crash_reporting/crash_metrics.h" |
| 17 #include "chrome_frame/extra_system_apis.h" | 18 #include "chrome_frame/extra_system_apis.h" |
| 18 #include "chrome_frame/html_utils.h" | 19 #include "chrome_frame/html_utils.h" |
| 19 #include "chrome_frame/http_negotiate.h" | 20 #include "chrome_frame/http_negotiate.h" |
| 20 #include "chrome_frame/metrics_service.h" | 21 #include "chrome_frame/metrics_service.h" |
| 21 #include "chrome_frame/protocol_sink_wrap.h" | 22 #include "chrome_frame/protocol_sink_wrap.h" |
| 22 #include "chrome_frame/ready_mode/ready_mode.h" | 23 #include "chrome_frame/ready_mode/ready_mode.h" |
| 23 #include "chrome_frame/urlmon_moniker.h" | 24 #include "chrome_frame/urlmon_moniker.h" |
| 24 #include "chrome_frame/utils.h" | 25 #include "chrome_frame/utils.h" |
| 25 #include "chrome_frame/vtable_patch_manager.h" | 26 #include "chrome_frame/vtable_patch_manager.h" |
| 27 #include "chrome_tab.h" // NOLINT | |
| 26 | 28 |
| 27 static const int kIBrowserServiceOnHttpEquivIndex = 30; | 29 static const int kIBrowserServiceOnHttpEquivIndex = 30; |
| 28 | 30 |
| 29 PatchHelper g_patch_helper; | 31 PatchHelper g_patch_helper; |
| 30 | 32 |
| 31 BEGIN_VTABLE_PATCHES(IBrowserService) | 33 BEGIN_VTABLE_PATCHES(IBrowserService) |
| 32 VTABLE_PATCH_ENTRY(kIBrowserServiceOnHttpEquivIndex, Bho::OnHttpEquiv) | 34 VTABLE_PATCH_ENTRY(kIBrowserServiceOnHttpEquivIndex, Bho::OnHttpEquiv) |
| 33 END_VTABLE_PATCHES() | 35 END_VTABLE_PATCHES() |
| 34 | 36 |
| 35 _ATL_FUNC_INFO Bho::kBeforeNavigate2Info = { | 37 _ATL_FUNC_INFO Bho::kBeforeNavigate2Info = { |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 if (browser_service) { | 129 if (browser_service) { |
| 128 g_patch_helper.PatchBrowserService(browser_service); | 130 g_patch_helper.PatchBrowserService(browser_service); |
| 129 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed." | 131 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed." |
| 130 << " Site: " << site << " Error: " << hr; | 132 << " Site: " << site << " Error: " << hr; |
| 131 } | 133 } |
| 132 } | 134 } |
| 133 // Save away our BHO instance in TLS which enables it to be referenced by | 135 // Save away our BHO instance in TLS which enables it to be referenced by |
| 134 // our active document/activex instances to query referrer and other | 136 // our active document/activex instances to query referrer and other |
| 135 // information for a URL. | 137 // information for a URL. |
| 136 AddRef(); | 138 AddRef(); |
| 137 RegisterThreadInstance(); | 139 RegisterThreadInstance(web_browser2); |
|
tommi (sloooow) - chröme
2011/02/11 14:49:02
Maybe instead of registering a pointer to IWebBrow
| |
| 138 MetricsService::Start(); | 140 MetricsService::Start(); |
| 139 } else { | 141 } else { |
| 140 UnregisterThreadInstance(); | 142 UnregisterThreadInstance(); |
|
tommi (sloooow) - chröme
2011/02/11 14:49:02
Hmm... there's no matching DispEventUnadvise to th
ananta
2011/02/11 18:55:07
Nice catch. Fixed.
| |
| 143 buggy_bho::BuggyBhoHandler::ClearBuggyObjectsForThread( | |
| 144 base::PlatformThread::CurrentId()); | |
| 141 Release(); | 145 Release(); |
| 142 } | 146 } |
| 143 | 147 |
| 144 return IObjectWithSiteImpl<Bho>::SetSite(site); | 148 return IObjectWithSiteImpl<Bho>::SetSite(site); |
| 145 } | 149 } |
| 146 | 150 |
| 147 STDMETHODIMP Bho::BeforeNavigate2(IDispatch* dispatch, VARIANT* url, | 151 STDMETHODIMP Bho::BeforeNavigate2(IDispatch* dispatch, VARIANT* url, |
| 148 VARIANT* flags, VARIANT* target_frame_name, VARIANT* post_data, | 152 VARIANT* flags, VARIANT* target_frame_name, VARIANT* post_data, |
| 149 VARIANT* headers, VARIANT_BOOL* cancel) { | 153 VARIANT* headers, VARIANT_BOOL* cancel) { |
| 150 if (!url || url->vt != VT_BSTR || url->bstrVal == NULL) { | 154 if (!url || url->vt != VT_BSTR || url->bstrVal == NULL) { |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 380 } | 384 } |
| 381 } | 385 } |
| 382 | 386 |
| 383 void PatchHelper::UnpatchIfNeeded() { | 387 void PatchHelper::UnpatchIfNeeded() { |
| 384 if (state_ == PATCH_PROTOCOL) { | 388 if (state_ == PATCH_PROTOCOL) { |
| 385 g_trans_hooks.RevertHooks(); | 389 g_trans_hooks.RevertHooks(); |
| 386 HttpNegotiatePatch::Uninitialize(); | 390 HttpNegotiatePatch::Uninitialize(); |
| 387 } | 391 } |
| 388 state_ = UNKNOWN; | 392 state_ = UNKNOWN; |
| 389 } | 393 } |
| OLD | NEW |