summaryrefslogtreecommitdiffstats
path: root/chrome_frame
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 18:49:47 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 18:49:47 +0000
commitecdf634e197d6041d705aa5ea4430938f44f5f91 (patch)
treed02993aa50e538e6b0c10bddc111d8fb557eded9 /chrome_frame
parentff24900ff80ace9c7dea9d08b0a74169a1904f56 (diff)
downloadchromium_src-ecdf634e197d6041d705aa5ea4430938f44f5f91.zip
chromium_src-ecdf634e197d6041d705aa5ea4430938f44f5f91.tar.gz
chromium_src-ecdf634e197d6041d705aa5ea4430938f44f5f91.tar.bz2
Implement OptInUrls using the same mechanism we use in the onhttpequiv notification.
A noteworthy change here is that OptInUrls doesn't rely on cf: anymore. TEST=The OptInUrls registry key should start working properly again. BUG=32660 Review URL: http://codereview.chromium.org/549129 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36874 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame')
-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);
}