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

Side by Side Diff: chrome/browser/prerender/prerender_contents.cc

Issue 13037003: permissionrequest API for guest Download. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PostTask and tests. Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prerender/prerender_contents.h" 5 #include "chrome/browser/prerender/prerender_contents.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 // that requires the browser to perform the transition instead of WebKit. 71 // that requires the browser to perform the transition instead of WebKit.
72 // Examples include prerendering a site that redirects to an app URL, 72 // Examples include prerendering a site that redirects to an app URL,
73 // or if --enable-strict-site-isolation is specified and the prerendered 73 // or if --enable-strict-site-isolation is specified and the prerendered
74 // frame redirects to a different origin. 74 // frame redirects to a different origin.
75 // TODO(cbentzel): Consider supporting this if it is a common case during 75 // TODO(cbentzel): Consider supporting this if it is a common case during
76 // prerenders. 76 // prerenders.
77 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); 77 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
78 return NULL; 78 return NULL;
79 } 79 }
80 80
81 virtual bool CanDownload(RenderViewHost* render_view_host, 81 virtual void CanDownload(
82 int request_id, 82 RenderViewHost* render_view_host,
83 const std::string& request_method) OVERRIDE { 83 int request_id,
84 const std::string& request_method,
85 const base::Callback<void(bool)>& callback) OVERRIDE {
84 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD); 86 prerender_contents_->Destroy(FINAL_STATUS_DOWNLOAD);
85 // Cancel the download. 87 // Cancel the download.
86 return false; 88 callback.Run(false);
87 } 89 }
88 90
89 virtual bool ShouldCreateWebContents( 91 virtual bool ShouldCreateWebContents(
90 WebContents* web_contents, 92 WebContents* web_contents,
91 int route_id, 93 int route_id,
92 WindowContainerType window_container_type, 94 WindowContainerType window_container_type,
93 const string16& frame_name, 95 const string16& frame_name,
94 const GURL& target_url) OVERRIDE { 96 const GURL& target_url) OVERRIDE {
95 // Since we don't want to permit child windows that would have a 97 // Since we don't want to permit child windows that would have a
96 // window.opener property, terminate prerendering. 98 // window.opener property, terminate prerendering.
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 701
700 bool PrerenderContents::IsCrossSiteNavigationPending() const { 702 bool PrerenderContents::IsCrossSiteNavigationPending() const {
701 if (!prerender_contents_) 703 if (!prerender_contents_)
702 return false; 704 return false;
703 return (prerender_contents_->GetSiteInstance() != 705 return (prerender_contents_->GetSiteInstance() !=
704 prerender_contents_->GetPendingSiteInstance()); 706 prerender_contents_->GetPendingSiteInstance());
705 } 707 }
706 708
707 709
708 } // namespace prerender 710 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698