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

Side by Side Diff: content/renderer/render_view_impl.cc

Issue 9978015: Make browser_handles_top_level_requests synchronous. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ExternalTabContainer::ShouldIgnoreNavigation returns true if is_content_initiated Created 8 years, 8 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 "content/renderer/render_view_impl.h" 5 #include "content/renderer/render_view_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
2318 // TODO(cevans): revisit whether this origin check is still necessary once 2318 // TODO(cevans): revisit whether this origin check is still necessary once
2319 // crbug.com/101395 is fixed. 2319 // crbug.com/101395 is fixed.
2320 if (frame_url.GetOrigin() != url.GetOrigin()) { 2320 if (frame_url.GetOrigin() != url.GetOrigin()) {
2321 OpenURL(frame, url, referrer, default_policy); 2321 OpenURL(frame, url, referrer, default_policy);
2322 return WebKit::WebNavigationPolicyIgnore; 2322 return WebKit::WebNavigationPolicyIgnore;
2323 } 2323 }
2324 } 2324 }
2325 2325
2326 // If the browser is interested, then give it a chance to look at top level 2326 // If the browser is interested, then give it a chance to look at top level
2327 // navigations. 2327 // navigations.
2328 if (is_content_initiated) { 2328 if (renderer_preferences_.browser_handles_top_level_requests) {
2329 bool browser_handles_top_level_requests = 2329 if (IsNonLocalTopLevelNavigation(url, frame, type) ||
2330 renderer_preferences_.browser_handles_top_level_requests &&
2331 IsNonLocalTopLevelNavigation(url, frame, type);
2332 if (browser_handles_top_level_requests ||
2333 renderer_preferences_.browser_handles_all_requests) { 2330 renderer_preferences_.browser_handles_all_requests) {
2334 // Reset these counters as the RenderView could be reused for the next 2331 // Reset these counters as the RenderView could be reused for the next
2335 // navigation. 2332 // navigation.
2336 page_id_ = -1; 2333 page_id_ = -1;
2337 last_page_id_sent_to_browser_ = -1; 2334 last_page_id_sent_to_browser_ = -1;
2338 OpenURL(frame, url, referrer, default_policy); 2335 bool ignore_navigation = false;
2339 return WebKit::WebNavigationPolicyIgnore; // Suppress the load here. 2336 Send(new ViewHostMsg_ShouldIgnoreNavigation(
2337 routing_id_,
2338 url,
2339 referrer,
2340 NavigationPolicyToDisposition(default_policy),
2341 frame->identifier(),
2342 is_content_initiated,
2343 &ignore_navigation));
2344 if (ignore_navigation)
2345 return WebKit::WebNavigationPolicyIgnore;
2340 } 2346 }
2341 } 2347 }
2342 2348
2343 // Detect when we're crossing a permission-based boundary (e.g. into or out of 2349 // Detect when we're crossing a permission-based boundary (e.g. into or out of
2344 // an extension or app origin, leaving a WebUI page, etc). We only care about 2350 // an extension or app origin, leaving a WebUI page, etc). We only care about
2345 // top-level navigations (not iframes). But we sometimes navigate to 2351 // top-level navigations (not iframes). But we sometimes navigate to
2346 // about:blank to clear a tab, and we want to still allow that. 2352 // about:blank to clear a tab, and we want to still allow that.
2347 // 2353 //
2348 // Note: this is known to break POST submissions when crossing process 2354 // Note: this is known to break POST submissions when crossing process
2349 // boundaries until http://crbug.com/101395 is fixed. This is better for 2355 // boundaries until http://crbug.com/101395 is fixed. This is better for
(...skipping 2890 matching lines...) Expand 10 before | Expand all | Expand 10 after
5240 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const { 5246 bool RenderViewImpl::WebWidgetHandlesCompositorScheduling() const {
5241 return !!RenderThreadImpl::current()->compositor_thread(); 5247 return !!RenderThreadImpl::current()->compositor_thread();
5242 } 5248 }
5243 5249
5244 void RenderViewImpl::OnJavaBridgeInit() { 5250 void RenderViewImpl::OnJavaBridgeInit() {
5245 DCHECK(!java_bridge_dispatcher_.get()); 5251 DCHECK(!java_bridge_dispatcher_.get());
5246 #if defined(ENABLE_JAVA_BRIDGE) 5252 #if defined(ENABLE_JAVA_BRIDGE)
5247 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this)); 5253 java_bridge_dispatcher_.reset(new JavaBridgeDispatcher(this));
5248 #endif 5254 #endif
5249 } 5255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698