Commit 845f6bf4 authored by ananta@chromium.org's avatar ananta@chromium.org

Enable the ChromeFrame IHttpNegotiate patch for all IE versions. Ensure that Chrome's UA

is sent out from IE in case Chrome is the default renderer for IE.

Fixes bug http://code.google.com/p/chromium/issues/detail?id=70138

BUG=70138
TEST=As described in the bug at this point. Unit tests for this will follow.


Review URL: http://codereview.chromium.org/6279006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71887 0039d316-1c4b-4281-b951-d872f2087c98
parent 0942444a
......@@ -362,12 +362,7 @@ bool PatchHelper::InitializeAndPatchProtocolsIfNeeded() {
if (state_ == UNKNOWN) {
g_trans_hooks.InstallHooks();
// IE9 sends the short user agent by default. To enable websites to
// identify and send content specific to chrome frame we need the
// negotiate patch which adds the user agent to outgoing requests.
if (GetIEVersion() == IE_9) {
HttpNegotiatePatch::Initialize();
}
HttpNegotiatePatch::Initialize();
state_ = PATCH_PROTOCOL;
ret = true;
}
......
......@@ -231,10 +231,19 @@ HRESULT HttpNegotiatePatch::BeginningTransaction(
return hr;
}
if (modify_user_agent_) {
std::string updated(AppendCFUserAgentString(headers, *additional_headers));
std::string updated_headers;
if (IsGcfDefaultRenderer() &&
RendererTypeForUrl(url) == RENDERER_TYPE_CHROME_DEFAULT_RENDERER) {
// Replace the user-agent header with Chrome's.
updated_headers = ReplaceOrAddUserAgent(*additional_headers,
http_utils::GetChromeUserAgent());
} else {
updated_headers = AppendCFUserAgentString(headers, *additional_headers);
}
*additional_headers = reinterpret_cast<wchar_t*>(::CoTaskMemRealloc(
*additional_headers, (updated.length() + 1) * sizeof(wchar_t)));
lstrcpyW(*additional_headers, ASCIIToWide(updated).c_str());
*additional_headers,
(updated_headers.length() + 1) * sizeof(wchar_t)));
lstrcpyW(*additional_headers, ASCIIToWide(updated_headers).c_str());
}
return S_OK;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment