summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome_frame/bho.cc26
-rw-r--r--chrome_frame/bho.h2
-rw-r--r--chrome_frame/utils.cc3
3 files changed, 11 insertions, 20 deletions
diff --git a/chrome_frame/bho.cc b/chrome_frame/bho.cc
index 896ca65..8e6704e 100644
--- a/chrome_frame/bho.cc
+++ b/chrome_frame/bho.cc
@@ -64,7 +64,7 @@ STDMETHODIMP Bho::SetSite(IUnknown* site) {
ScopedComPtr<IBrowserService> browser_service;
hr = DoQueryService(SID_SShellBrowser, site, browser_service.Receive());
DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed."
- << " Site: " << site << " Error: " << hr;
+ << " Site: " << site << " Error: " << hr;
if (browser_service) {
g_patch_helper.PatchBrowserService(browser_service);
DCHECK(SUCCEEDED(hr)) << "vtable_patch::PatchInterfaceMethods failed."
@@ -110,21 +110,12 @@ STDMETHODIMP Bho::BeforeNavigate2(IDispatch* dispatch, VARIANT* url,
false);
if (!is_chrome_protocol && IsOptInUrl(current_url.c_str())) {
- DLOG(INFO) << "Canceling navigation and switching to cf";
- // Cancel original navigation
- *cancel = VARIANT_TRUE;
-
- // Issue new request with 'cf:'
- current_url.insert(0, kChromeProtocolPrefix);
- ScopedVariant new_url(current_url.c_str());
- HRESULT hr = web_browser2->Navigate2(new_url.AsInput(), flags,
- target_frame_name, post_data,
- headers);
- DCHECK(SUCCEEDED(hr)) << "web_browser2->Navigate2 failed. Error: " << hr
- << std::endl << "Url: " << current_url
- << std::endl << "flags: " << flags
- << std::endl << "post data: " << post_data
- << std::endl << "headers: " << headers;
+ DLOG(INFO) << "Opt-in URL. Switching to cf.";
+ ScopedComPtr<IBrowserService> browser_service;
+ DoQueryService(SID_SShellBrowser, web_browser2,
+ browser_service.Receive());
+ DCHECK(browser_service) << "DoQueryService - SID_SShellBrowser failed.";
+ MarkBrowserOnThreadForCFNavigation(browser_service);
}
}
}
@@ -379,7 +370,6 @@ bool PatchHelper::InitializeAndPatchProtocolsIfNeeded() {
void PatchHelper::PatchBrowserService(IBrowserService* browser_service) {
DCHECK(state_ == PATCH_IBROWSER);
- state_ = PATCH_IBROWSER_OK;
vtable_patch::PatchInterfaceMethods(browser_service,
IBrowserService_PatchInfo);
}
@@ -387,7 +377,7 @@ void PatchHelper::PatchBrowserService(IBrowserService* browser_service) {
void PatchHelper::UnpatchIfNeeded() {
if (state_ == PATCH_PROTOCOL) {
ProtocolSinkWrap::UnpatchProtocolHandlers();
- } else if (state_ == PATCH_IBROWSER_OK) {
+ } else if (state_ == PATCH_IBROWSER) {
vtable_patch::UnpatchInterfaceMethods(IBrowserService_PatchInfo);
}
diff --git a/chrome_frame/bho.h b/chrome_frame/bho.h
index fdae5bf..e25ebdf 100644
--- a/chrome_frame/bho.h
+++ b/chrome_frame/bho.h
@@ -22,7 +22,7 @@
class PatchHelper {
public:
- enum State { UNKNOWN, PATCH_IBROWSER, PATCH_IBROWSER_OK, PATCH_PROTOCOL };
+ enum State { UNKNOWN, PATCH_IBROWSER, PATCH_PROTOCOL };
PatchHelper() : state_(UNKNOWN) {
}
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 3ef49df..e0b407b 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -728,7 +728,8 @@ HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
void MarkBrowserOnThreadForCFNavigation(IBrowserService* browser) {
DCHECK(browser != NULL);
- DCHECK(g_tls_browser_for_cf_navigation.Pointer()->Get() == NULL);
+ DCHECK(g_tls_browser_for_cf_navigation.Pointer()->Get() == NULL ||
+ g_tls_browser_for_cf_navigation.Pointer()->Get() == browser);
g_tls_browser_for_cf_navigation.Pointer()->Set(browser);
}