summaryrefslogtreecommitdiffstats
path: root/chrome_frame/http_negotiate.cc
diff options
context:
space:
mode:
authortommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 19:31:56 +0000
committertommi@chromium.org <tommi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-11 19:31:56 +0000
commitb22ef28f215f7475f1c0401f89e353a8aacf8def (patch)
tree045041d0534fb9aa8b6b009e3a7499809b42e7ed /chrome_frame/http_negotiate.cc
parent2f7aff273b0a1357e79d99e2f31ede1f702d8783 (diff)
downloadchromium_src-b22ef28f215f7475f1c0401f89e353a8aacf8def.zip
chromium_src-b22ef28f215f7475f1c0401f89e353a8aacf8def.tar.gz
chromium_src-b22ef28f215f7475f1c0401f89e353a8aacf8def.tar.bz2
Use the OnHttpEquiv notification to switch to CF when the http-equiv meta tag is detected. This implementation is still behind the registry switch (set PatchProtocols to 0 in the registry). I will switch over to it wholesale in a separate patch.
We use the same mechanism for re-initiating the navigation we use to transfer downloads over to the host, so I moved the common code to utils.cc and added NavigateBrowserToMoniker. When we see a browser instance attempting to load a CF document, we raise a TLS flag that we catch in HttpNegotiatePatch::ReportProgress when the mime type is being reported. This is the same place where we examine http headers and report the mime type. BUG=n/a TEST=Set PatchProtocols (REG_DWORD) to 0 in the CF HKCU config key and make sure we detect and handle the meta tag as well or better than before. Review URL: http://codereview.chromium.org/489004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34366 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/http_negotiate.cc')
-rw-r--r--chrome_frame/http_negotiate.cc58
1 files changed, 36 insertions, 22 deletions
diff --git a/chrome_frame/http_negotiate.cc b/chrome_frame/http_negotiate.cc
index ef996e5..b938cae 100644
--- a/chrome_frame/http_negotiate.cc
+++ b/chrome_frame/http_negotiate.cc
@@ -234,28 +234,38 @@ HRESULT HttpNegotiatePatch::ReportProgress(
if (status_code == BINDSTATUS_MIMETYPEAVAILABLE ||
status_code == BINDSTATUS_VERIFIEDMIMETYPEAVAILABLE ||
status_code == LOCAL_BINDSTATUS_SERVER_MIMETYPEAVAILABLE) {
- bool is_top_level_request = !IsSubFrameRequest(me);
-
- if (is_top_level_request) {
- // Check to see if we need to alter the mime type that gets reported
- // by inspecting the raw header information:
- ScopedComPtr<IWinInetHttpInfo> win_inet_http_info;
- HRESULT hr = win_inet_http_info.QueryFrom(me);
-
- // Try slightly harder if we couldn't QI directly.
- if (!win_inet_http_info || FAILED(hr)) {
- hr = DoQueryService(IID_IWinInetHttpInfo, me,
- win_inet_http_info.Receive());
- }
+ bool render_in_chrome_frame = false;
+
+ // Check if this is a top level browser request that should be
+ // rendered in CF.
+ ScopedComPtr<IBrowserService> browser;
+ DoQueryService(IID_IShellBrowser, me, browser.Receive());
+ if (browser) {
+ render_in_chrome_frame = CheckForCFNavigation(browser, true);
+ }
+
+ if (!render_in_chrome_frame) {
+ bool is_top_level_request = !IsSubFrameRequest(me);
+
+ if (is_top_level_request) {
+ // Check to see if we need to alter the mime type that gets reported
+ // by inspecting the raw header information:
+ ScopedComPtr<IWinInetHttpInfo> win_inet_http_info;
+ HRESULT hr = win_inet_http_info.QueryFrom(me);
- // Note that it has been observed that getting an IWinInetHttpInfo will
- // fail if we are loading a page like about:blank that isn't loaded via
- // wininet.
- if (win_inet_http_info) {
- // We have headers: check to see if the server is requesting CF via
- // the X-UA-Compatible: chrome=1 HTTP header.
- std::string headers(GetRawHttpHeaders(win_inet_http_info));
- if (net::HttpUtil::HasHeader(headers, kUACompatibleHttpHeader)) {
+ // Try slightly harder if we couldn't QI directly.
+ if (!win_inet_http_info || FAILED(hr)) {
+ hr = DoQueryService(IID_IWinInetHttpInfo, me,
+ win_inet_http_info.Receive());
+ }
+
+ // Note that it has been observed that getting an IWinInetHttpInfo will
+ // fail if we are loading a page like about:blank that isn't loaded via
+ // wininet.
+ if (win_inet_http_info) {
+ // We have headers: check to see if the server is requesting CF via
+ // the X-UA-Compatible: chrome=1 HTTP header.
+ std::string headers(GetRawHttpHeaders(win_inet_http_info));
net::HttpUtil::HeadersIterator it(headers.begin(), headers.end(),
"\r\n");
while (it.GetNext()) {
@@ -263,7 +273,7 @@ HRESULT HttpNegotiatePatch::ReportProgress(
kUACompatibleHttpHeader)) {
std::string ua_value(StringToLowerASCII(it.values()));
if (ua_value.find("chrome=1") != std::string::npos) {
- status_text = kChromeMimeType;
+ render_in_chrome_frame = true;
break;
}
}
@@ -271,6 +281,10 @@ HRESULT HttpNegotiatePatch::ReportProgress(
}
}
}
+
+ if (render_in_chrome_frame) {
+ status_text = kChromeMimeType;
+ }
}
return original(me, status_code, status_text);