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

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

Issue 9837074: Make it so that allow_js_access: false can be used with background pages created by window.open. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revised approach based on http://crrev.com/125180. Created 8 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 <utility> 8 #include <utility>
9 9
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 virtual void OnStartDownload(WebContents* source, 147 virtual void OnStartDownload(WebContents* source,
148 DownloadItem* download) OVERRIDE { 148 DownloadItem* download) OVERRIDE {
149 // Prerendered pages should never be able to download files. 149 // Prerendered pages should never be able to download files.
150 NOTREACHED(); 150 NOTREACHED();
151 } 151 }
152 152
153 virtual bool ShouldCreateWebContents( 153 virtual bool ShouldCreateWebContents(
154 WebContents* web_contents, 154 WebContents* web_contents,
155 int route_id, 155 int route_id,
156 WindowContainerType window_container_type, 156 WindowContainerType window_container_type,
157 const string16& frame_name) OVERRIDE { 157 const string16& frame_name,
158 const GURL& target_url) OVERRIDE {
158 // Since we don't want to permit child windows that would have a 159 // Since we don't want to permit child windows that would have a
159 // window.opener property, terminate prerendering. 160 // window.opener property, terminate prerendering.
160 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW); 161 prerender_contents_->Destroy(FINAL_STATUS_CREATE_NEW_WINDOW);
161 // Cancel the popup. 162 // Cancel the popup.
162 return false; 163 return false;
163 } 164 }
164 165
165 virtual bool OnGoToEntryOffset(int offset) OVERRIDE { 166 virtual bool OnGoToEntryOffset(int offset) OVERRIDE {
166 // This isn't allowed because the history merge operation 167 // This isn't allowed because the history merge operation
167 // does not work if there are renderer issued challenges. 168 // does not work if there are renderer issued challenges.
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 bool PrerenderContents::IsCrossSiteNavigationPending() const { 699 bool PrerenderContents::IsCrossSiteNavigationPending() const {
699 if (!prerender_contents_.get() || !prerender_contents_->web_contents()) 700 if (!prerender_contents_.get() || !prerender_contents_->web_contents())
700 return false; 701 return false;
701 const WebContents* web_contents = prerender_contents_->web_contents(); 702 const WebContents* web_contents = prerender_contents_->web_contents();
702 return (web_contents->GetSiteInstance() != 703 return (web_contents->GetSiteInstance() !=
703 web_contents->GetPendingSiteInstance()); 704 web_contents->GetPendingSiteInstance());
704 } 705 }
705 706
706 707
707 } // namespace prerender 708 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698