summaryrefslogtreecommitdiffstats
path: root/chrome_frame/utils.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 00:02:34 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-01-22 00:02:34 +0000
commit7e3544bd5859cad57261bc4827686f266a8d3961 (patch)
treee3859f5a3692cf096ba92f02636b46ccd24e2f08 /chrome_frame/utils.cc
parent52574021ab8190a5b93bdf1344dada2b420f4b1c (diff)
downloadchromium_src-7e3544bd5859cad57261bc4827686f266a8d3961.zip
chromium_src-7e3544bd5859cad57261bc4827686f266a8d3961.tar.gz
chromium_src-7e3544bd5859cad57261bc4827686f266a8d3961.tar.bz2
If we navigate to a URL which has an anchor in IE, which eventually ends up in ChromeFrame,
the actual URL queried from the moniker passed in to our implementation of IPersistStream::Load does not have the anchor. It looks like there are some private interfaces exposed by MSHTML and invoked by IEFrame to pass this information over. Our fix is to save away the url received in our Bho BeforeNavigate2 notification and use this URL if available before querying the moniker for the URL. This needs to be done in IPersistStream::Load and in the OnHttpEquiv patch when we initiate a navigation to the actual URL using the moniker. Fixes bug http://code.google.com/p/chromium/issues/detail?id=27270 Bug=27270 Test=Covered by unit test. Review URL: http://codereview.chromium.org/542096 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36814 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.cc')
-rw-r--r--chrome_frame/utils.cc26
1 files changed, 23 insertions, 3 deletions
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index 67b1217..3ef49df 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -636,7 +636,8 @@ bool IsOptInUrl(const wchar_t* url) {
}
HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
- const wchar_t* headers, IBindCtx* bind_ctx) {
+ const wchar_t* headers, IBindCtx* bind_ctx,
+ const wchar_t* fragment) {
DCHECK(browser);
DCHECK(moniker);
DCHECK(bind_ctx);
@@ -695,7 +696,7 @@ HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
hr = browser_priv2->NavigateWithBindCtx2(uri_obj, NULL, NULL, NULL,
headers_var.AsInput(), bind_ctx,
- NULL);
+ const_cast<wchar_t*>(fragment));
DLOG_IF(WARNING, FAILED(hr))
<< StringPrintf(L"NavigateWithBindCtx2 0x%08X", hr);
}
@@ -709,7 +710,8 @@ HRESULT NavigateBrowserToMoniker(IUnknown* browser, IMoniker* moniker,
ScopedVariant var_url(url);
hr = browser_priv->NavigateWithBindCtx(var_url.AsInput(), NULL, NULL,
NULL, headers_var.AsInput(),
- bind_ctx, NULL);
+ bind_ctx,
+ const_cast<wchar_t*>(fragment));
DLOG_IF(WARNING, FAILED(hr))
<< StringPrintf(L"NavigateWithBindCtx 0x%08X", hr);
} else {
@@ -830,3 +832,21 @@ bool IsHeadlessMode() {
return headless;
}
+std::wstring GetActualUrlFromMoniker(IMoniker* moniker,
+ IBindCtx* bind_context,
+ const std::wstring& bho_url) {
+ CComHeapPtr<WCHAR> display_name;
+ moniker->GetDisplayName(bind_context, NULL, &display_name);
+ std::wstring moniker_url = display_name;
+
+ GURL parsed_url(WideToUTF8(bho_url));
+ if (!parsed_url.has_ref())
+ return moniker_url;
+
+ if (StartsWith(bho_url, moniker_url, false) &&
+ bho_url[moniker_url.length()] == L'#')
+ return bho_url;
+
+ return moniker_url;
+}
+