OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/files/file_path.h" | 9 #include "base/files/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/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "base/win/scoped_bstr.h" | 15 #include "base/win/scoped_bstr.h" |
16 #include "chrome_frame/buggy_bho_handling.h" | 16 #include "chrome_frame/buggy_bho_handling.h" |
17 #include "chrome_frame/crash_reporting/crash_metrics.h" | 17 #include "chrome_frame/crash_reporting/crash_metrics.h" |
18 #include "chrome_frame/extra_system_apis.h" | 18 #include "chrome_frame/extra_system_apis.h" |
19 #include "chrome_frame/html_utils.h" | 19 #include "chrome_frame/html_utils.h" |
20 #include "chrome_frame/http_negotiate.h" | 20 #include "chrome_frame/http_negotiate.h" |
21 #include "chrome_frame/metrics_service.h" | 21 #include "chrome_frame/metrics_service.h" |
22 #include "chrome_frame/protocol_sink_wrap.h" | 22 #include "chrome_frame/protocol_sink_wrap.h" |
23 #include "chrome_frame/ready_mode/ready_mode.h" | 23 #include "chrome_frame/turndown_prompt/turndown_prompt.h" |
24 #include "chrome_frame/urlmon_moniker.h" | 24 #include "chrome_frame/urlmon_moniker.h" |
25 #include "chrome_frame/utils.h" | 25 #include "chrome_frame/utils.h" |
26 #include "chrome_frame/vtable_patch_manager.h" | 26 #include "chrome_frame/vtable_patch_manager.h" |
27 | 27 |
28 static const int kIBrowserServiceOnHttpEquivIndex = 30; | 28 static const int kIBrowserServiceOnHttpEquivIndex = 30; |
29 static const DWORD kMaxHttpConnections = 6; | 29 static const DWORD kMaxHttpConnections = 6; |
30 | 30 |
31 PatchHelper g_patch_helper; | 31 PatchHelper g_patch_helper; |
32 | 32 |
33 BEGIN_VTABLE_PATCHES(IBrowserService) | 33 BEGIN_VTABLE_PATCHES(IBrowserService) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 | 72 |
73 STDMETHODIMP Bho::SetSite(IUnknown* site) { | 73 STDMETHODIMP Bho::SetSite(IUnknown* site) { |
74 HRESULT hr = S_OK; | 74 HRESULT hr = S_OK; |
75 if (site) { | 75 if (site) { |
76 base::TimeTicks start = base::TimeTicks::Now(); | 76 base::TimeTicks start = base::TimeTicks::Now(); |
77 base::win::ScopedComPtr<IWebBrowser2> web_browser2; | 77 base::win::ScopedComPtr<IWebBrowser2> web_browser2; |
78 web_browser2.QueryFrom(site); | 78 web_browser2.QueryFrom(site); |
79 if (web_browser2) { | 79 if (web_browser2) { |
80 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2); | 80 hr = DispEventAdvise(web_browser2, &DIID_DWebBrowserEvents2); |
81 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr; | 81 DCHECK(SUCCEEDED(hr)) << "DispEventAdvise failed. Error: " << hr; |
| 82 |
| 83 turndown_prompt::Configure(web_browser2); |
82 } | 84 } |
83 | 85 |
84 if (g_patch_helper.state() == PatchHelper::PATCH_IBROWSER) { | 86 if (g_patch_helper.state() == PatchHelper::PATCH_IBROWSER) { |
85 base::win::ScopedComPtr<IBrowserService> browser_service; | 87 base::win::ScopedComPtr<IBrowserService> browser_service; |
86 hr = DoQueryService(SID_SShellBrowser, site, browser_service.Receive()); | 88 hr = DoQueryService(SID_SShellBrowser, site, browser_service.Receive()); |
87 DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed." | 89 DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed." |
88 << " Site: " << site << " Error: " << hr; | 90 << " Site: " << site << " Error: " << hr; |
89 if (browser_service) { | 91 if (browser_service) { |
90 g_patch_helper.PatchBrowserService(browser_service); | 92 g_patch_helper.PatchBrowserService(browser_service); |
91 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed." | 93 DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed." |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 } | 356 } |
355 } | 357 } |
356 | 358 |
357 void PatchHelper::UnpatchIfNeeded() { | 359 void PatchHelper::UnpatchIfNeeded() { |
358 if (state_ == PATCH_PROTOCOL) { | 360 if (state_ == PATCH_PROTOCOL) { |
359 g_trans_hooks.RevertHooks(); | 361 g_trans_hooks.RevertHooks(); |
360 HttpNegotiatePatch::Uninitialize(); | 362 HttpNegotiatePatch::Uninitialize(); |
361 } | 363 } |
362 state_ = UNKNOWN; | 364 state_ = UNKNOWN; |
363 } | 365 } |
OLD | NEW |