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

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

Issue 2380193003: Block navigations in extensions via ShouldTransferNavigation (not via OpenURL). (Closed)
Patch Set: Created 4 years, 2 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
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <functional> 10 #include <functional>
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 const OpenURLParams& params) override { 95 const OpenURLParams& params) override {
96 // |OpenURLFromTab| is typically called when a frame performs a navigation 96 // |OpenURLFromTab| is typically called when a frame performs a navigation
97 // that requires the browser to perform the transition instead of WebKit. 97 // that requires the browser to perform the transition instead of WebKit.
98 // Examples include client redirects to hosted app URLs. 98 // Examples include client redirects to hosted app URLs.
99 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if 99 // TODO(cbentzel): Consider supporting this for CURRENT_TAB dispositions, if
100 // it is a common case during prerenders. 100 // it is a common case during prerenders.
101 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); 101 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
102 return NULL; 102 return NULL;
103 } 103 }
104 104
105 bool ShouldTransferNavigation() override { 105 bool ShouldTransferNavigation(bool is_main_frame_navigation) override {
106 // Cancel the prerender if the navigation attempts to transfer to a 106 // Cancel the prerender if the navigation attempts to transfer to a
107 // different process. Examples include server redirects to privileged pages 107 // different process. Examples include server redirects to privileged pages
108 // or cross-site subframe navigations in --site-per-process. 108 // or cross-site subframe navigations in --site-per-process.
109 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL); 109 prerender_contents_->Destroy(FINAL_STATUS_OPEN_URL);
110 return false; 110 return false;
111 } 111 }
112 112
113 void CloseContents(content::WebContents* contents) override { 113 void CloseContents(content::WebContents* contents) override {
114 prerender_contents_->Destroy(FINAL_STATUS_CLOSED); 114 prerender_contents_->Destroy(FINAL_STATUS_CLOSED);
115 } 115 }
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
725 void PrerenderContents::AddResourceThrottle( 725 void PrerenderContents::AddResourceThrottle(
726 const base::WeakPtr<PrerenderResourceThrottle>& throttle) { 726 const base::WeakPtr<PrerenderResourceThrottle>& throttle) {
727 resource_throttles_.push_back(throttle); 727 resource_throttles_.push_back(throttle);
728 } 728 }
729 729
730 void PrerenderContents::AddNetworkBytes(int64_t bytes) { 730 void PrerenderContents::AddNetworkBytes(int64_t bytes) {
731 network_bytes_ += bytes; 731 network_bytes_ += bytes;
732 } 732 }
733 733
734 } // namespace prerender 734 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/extensions/process_management_browsertest.cc ('k') | chrome/renderer/chrome_content_renderer_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698