Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(553)

Unified Diff: chrome/browser/prerender/prerender_contents.cc

Issue 10636034: Cancel prerender when a site tries to register a protocol handler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Change strings Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_final_status.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_contents.cc
===================================================================
--- chrome/browser/prerender/prerender_contents.cc (revision 143870)
+++ chrome/browser/prerender/prerender_contents.cc (working copy)
@@ -123,20 +123,20 @@
prerender_contents_(prerender_contents) {
}
- virtual WebContents* OpenURLFromTab(WebContents* source,
+ // content::WebContentsDelegate implementation:
+ virtual WebContents* OpenURLFromTab(WebContents* 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.
+ // TODO(cbentzel): Consider supporting this if it is a common case during
+ // prerenders.
prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
return NULL;
}
- // content::WebContentsDelegate implementation:
virtual bool ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
content::NavigationType navigation_type) OVERRIDE {
@@ -182,13 +182,28 @@
}
virtual void JSOutOfMemory(WebContents* tab) OVERRIDE {
mmenke 2012/06/25 19:53:39 We should be consistent about whether we call dest
dominich 2012/06/25 19:59:27 I like this better.
- prerender_contents_->OnJSOutOfMemory();
+ prerender_contents_->Destroy(FINAL_STATUS_JS_OUT_OF_MEMORY);
}
virtual bool ShouldSuppressDialogs() OVERRIDE {
- return prerender_contents_->ShouldSuppressDialogs();
+ // Always suppress JavaScript messages if they're triggered by a page being
+ // prerendered.
+ // We still want to show the user the message when they navigate to this
+ // page, so cancel this prerender.
+ prerender_contents_->Destroy(FINAL_STATUS_JAVASCRIPT_ALERT);
+ return true;
}
+ virtual void RegisterProtocolHandler(WebContents* web_contents,
+ const std::string& protocol,
+ const GURL& url,
+ const string16& title,
+ bool user_gesture) OVERRIDE {
+ // TODO(mmenke): Consider supporting this if it is a common case during
+ // prerenders.
+ prerender_contents_->Destroy(FINAL_STATUS_REGISTER_PROTOCOL_HANDLER);
+ }
+
// Commits the History of Pages to the given TabContents.
void CommitHistory(TabContents* tab) {
for (size_t i = 0; i < add_page_vector_.size(); ++i)
@@ -567,10 +582,6 @@
return false;
}
-void PrerenderContents::OnJSOutOfMemory() {
- Destroy(FINAL_STATUS_JS_OUT_OF_MEMORY);
-}
-
void PrerenderContents::RenderViewGone(base::TerminationStatus status) {
Destroy(FINAL_STATUS_RENDERER_CRASHED);
}
@@ -606,15 +617,6 @@
has_finished_loading_ = true;
}
-bool PrerenderContents::ShouldSuppressDialogs() {
- // Always suppress JavaScript messages if they're triggered by a page being
- // prerendered.
- // We still want to show the user the message when they navigate to this
- // page, so cancel this prerender.
- Destroy(FINAL_STATUS_JAVASCRIPT_ALERT);
- return true;
-}
-
void PrerenderContents::Destroy(FinalStatus final_status) {
if (prerendering_has_been_cancelled_)
return;
« no previous file with comments | « chrome/browser/prerender/prerender_contents.h ('k') | chrome/browser/prerender/prerender_final_status.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698