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 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2420 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { | 2420 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { |
2421 // Tell the active RenderViewHost to run unload handlers and close, as long | 2421 // Tell the active RenderViewHost to run unload handlers and close, as long |
2422 // as the request came from a RenderViewHost in the same BrowsingInstance. | 2422 // as the request came from a RenderViewHost in the same BrowsingInstance. |
2423 // In most cases, we receive this from a swapped out RenderViewHost. | 2423 // In most cases, we receive this from a swapped out RenderViewHost. |
2424 // It is possible to receive it from one that has just been swapped in, | 2424 // It is possible to receive it from one that has just been swapped in, |
2425 // in which case we might as well deliver the message anyway. | 2425 // in which case we might as well deliver the message anyway. |
2426 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) | 2426 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) |
2427 GetRenderViewHost()->ClosePage(); | 2427 GetRenderViewHost()->ClosePage(); |
2428 } | 2428 } |
2429 | 2429 |
| 2430 bool WebContentsImpl::ShouldIgnoreNavigation( |
| 2431 RenderViewHost* render_view_host, |
| 2432 const GURL& url, |
| 2433 const content::Referrer& referrer, |
| 2434 bool is_content_initiated) { |
| 2435 if (!delegate_) |
| 2436 return false; |
| 2437 |
| 2438 GURL validated_url(url); |
| 2439 RenderViewHostImpl* render_view_host_impl = |
| 2440 static_cast<RenderViewHostImpl*>(render_view_host); |
| 2441 content::RenderProcessHost* render_process_host = |
| 2442 render_view_host->GetProcess(); |
| 2443 render_view_host_impl->FilterURL( |
| 2444 ChildProcessSecurityPolicyImpl::GetInstance(), |
| 2445 render_process_host->GetID(), |
| 2446 false, |
| 2447 &validated_url); |
| 2448 return delegate_->ShouldIgnoreNavigation( |
| 2449 this, validated_url, referrer, is_content_initiated); |
| 2450 } |
| 2451 |
2430 void WebContentsImpl::RunJavaScriptMessage( | 2452 void WebContentsImpl::RunJavaScriptMessage( |
2431 RenderViewHost* rvh, | 2453 RenderViewHost* rvh, |
2432 const string16& message, | 2454 const string16& message, |
2433 const string16& default_prompt, | 2455 const string16& default_prompt, |
2434 const GURL& frame_url, | 2456 const GURL& frame_url, |
2435 ui::JavascriptMessageType javascript_message_type, | 2457 ui::JavascriptMessageType javascript_message_type, |
2436 IPC::Message* reply_msg, | 2458 IPC::Message* reply_msg, |
2437 bool* did_suppress_message) { | 2459 bool* did_suppress_message) { |
2438 // Suppress JavaScript dialogs when requested. Also suppress messages when | 2460 // Suppress JavaScript dialogs when requested. Also suppress messages when |
2439 // showing an interstitial as it's shown over the previous page and we don't | 2461 // 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... |
2738 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2760 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
2739 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2761 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
2740 // Can be NULL during tests. | 2762 // Can be NULL during tests. |
2741 if (rwh_view) | 2763 if (rwh_view) |
2742 rwh_view->SetSize(GetView()->GetContainerSize()); | 2764 rwh_view->SetSize(GetView()->GetContainerSize()); |
2743 } | 2765 } |
2744 | 2766 |
2745 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2767 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
2746 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2768 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
2747 } | 2769 } |
OLD | NEW |