OLD | NEW |
---|---|
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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 2400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2411 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { | 2411 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { |
2412 // Tell the active RenderViewHost to run unload handlers and close, as long | 2412 // Tell the active RenderViewHost to run unload handlers and close, as long |
2413 // as the request came from a RenderViewHost in the same BrowsingInstance. | 2413 // as the request came from a RenderViewHost in the same BrowsingInstance. |
2414 // In most cases, we receive this from a swapped out RenderViewHost. | 2414 // In most cases, we receive this from a swapped out RenderViewHost. |
2415 // It is possible to receive it from one that has just been swapped in, | 2415 // It is possible to receive it from one that has just been swapped in, |
2416 // in which case we might as well deliver the message anyway. | 2416 // in which case we might as well deliver the message anyway. |
2417 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) | 2417 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) |
2418 GetRenderViewHost()->ClosePage(); | 2418 GetRenderViewHost()->ClosePage(); |
2419 } | 2419 } |
2420 | 2420 |
2421 bool WebContentsImpl::ShouldIgnoreNavigation( | |
2422 RenderViewHost* render_view_host, | |
2423 const GURL& url, | |
2424 const content::Referrer& referrer, | |
2425 bool is_content_initiated) { | |
2426 if (!delegate_) | |
2427 return false; | |
2428 | |
2429 GURL validated_url(url); | |
2430 RenderViewHostImpl* render_view_host_impl = | |
2431 static_cast<RenderViewHostImpl*>(render_view_host); | |
2432 content::RenderProcessHost* render_process_host = | |
2433 render_view_host->GetProcess(); | |
2434 render_view_host_impl->FilterURL( | |
2435 ChildProcessSecurityPolicyImpl::GetInstance(), | |
2436 render_process_host->GetID(), | |
2437 false, | |
2438 &validated_url); | |
2439 return delegate_->ShouldIgnoreNavigation( | |
2440 this, validated_url, referrer, is_content_initiated); | |
joth
2012/05/11 15:34:13
feels like it should be possible to write a test c
mkosiba (inactive)
2012/05/15 14:20:23
Should be possible to inject the throttle into req
| |
2441 } | |
2442 | |
2421 void WebContentsImpl::RunJavaScriptMessage( | 2443 void WebContentsImpl::RunJavaScriptMessage( |
2422 RenderViewHost* rvh, | 2444 RenderViewHost* rvh, |
2423 const string16& message, | 2445 const string16& message, |
2424 const string16& default_prompt, | 2446 const string16& default_prompt, |
2425 const GURL& frame_url, | 2447 const GURL& frame_url, |
2426 ui::JavascriptMessageType javascript_message_type, | 2448 ui::JavascriptMessageType javascript_message_type, |
2427 IPC::Message* reply_msg, | 2449 IPC::Message* reply_msg, |
2428 bool* did_suppress_message) { | 2450 bool* did_suppress_message) { |
2429 // Suppress JavaScript dialogs when requested. Also suppress messages when | 2451 // Suppress JavaScript dialogs when requested. Also suppress messages when |
2430 // showing an interstitial as it's shown over the previous page and we don't | 2452 // showing an interstitial as it's shown over the previous page and we don't |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2729 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2751 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2730 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2752 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2731 // Can be NULL during tests. | 2753 // Can be NULL during tests. |
2732 if (rwh_view) | 2754 if (rwh_view) |
2733 rwh_view->SetSize(GetView()->GetContainerSize()); | 2755 rwh_view->SetSize(GetView()->GetContainerSize()); |
2734 } | 2756 } |
2735 | 2757 |
2736 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2758 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2737 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2759 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2738 } | 2760 } |
OLD | NEW |