Commit 0905b016 authored by cbentzel@chromium.org's avatar cbentzel@chromium.org

Prerenders that send a ViewHostMsg_OpenURL are canceled with FINAL_STATUS_OPEN_URL.

This message is sent when a navigation is initiated from a renderer but requires browser intervention, typically because a new render process will be created. Examples of where this happens are redirects from a "normal page" to a hosted app domain, or transitions from one origin to another when --enable-strict-site-isolation is specified.

BUG=105972
TEST=Install YouTube app. Start Chrome with --prerender=enabled. Go to prerender-test.appspot.com, and prerender youtube.com. Click on it and www.youtube.com should appear. Check chrome://net-internals#prerender and make sure that the youtube prerender was canceled with OpenURL as the final status.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113011 0039d316-1c4b-4281-b951-d872f2087c98
parent e45f526c
...@@ -88,6 +88,19 @@ class PrerenderContents::TabContentsDelegateImpl ...@@ -88,6 +88,19 @@ class PrerenderContents::TabContentsDelegateImpl
prerender_contents_(prerender_contents) { prerender_contents_(prerender_contents) {
} }
virtual TabContents* OpenURLFromTab(TabContents* source,
const OpenURLParams& params) OVERRIDE {
// |OpenURLFromTab| is typically called when a frame performs a navigation
// that requires the browser to perform the transition instead of WebKit.
// Examples include prerendering a site that redirects to an app URL,
// or if --enable-strict-site-isolation is specified and the prerendered
// frame redirects to a different origin.
// TODO(cbentzel): Consider supporting this is if it is a common case
// during prerenders.
prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
return NULL;
}
// TabContentsDelegate implementation: // TabContentsDelegate implementation:
virtual bool ShouldAddNavigationToHistory( virtual bool ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args, const history::HistoryAddPageArgs& add_page_args,
......
...@@ -51,6 +51,7 @@ const char* kFinalStatusNames[] = { ...@@ -51,6 +51,7 @@ const char* kFinalStatusNames[] = {
"No Use Group", "No Use Group",
"Match Complete Dummy", "Match Complete Dummy",
"Duplicate", "Duplicate",
"OpenURL",
"Max", "Max",
}; };
COMPILE_ASSERT(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1, COMPILE_ASSERT(arraysize(kFinalStatusNames) == FINAL_STATUS_MAX + 1,
......
...@@ -52,6 +52,7 @@ enum FinalStatus { ...@@ -52,6 +52,7 @@ enum FinalStatus {
FINAL_STATUS_NO_USE_GROUP = 37, FINAL_STATUS_NO_USE_GROUP = 37,
FINAL_STATUS_MATCH_COMPLETE_DUMMY = 38, FINAL_STATUS_MATCH_COMPLETE_DUMMY = 38,
FINAL_STATUS_DUPLICATE = 39, FINAL_STATUS_DUPLICATE = 39,
FINAL_STATUS_OPEN_URL = 40,
FINAL_STATUS_MAX, FINAL_STATUS_MAX,
}; };
......
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