| 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 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2379 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 2379 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
| 2380 DidOpenRequestedURL(new_contents, | 2380 DidOpenRequestedURL(new_contents, |
| 2381 url, | 2381 url, |
| 2382 referrer, | 2382 referrer, |
| 2383 disposition, | 2383 disposition, |
| 2384 transition_type, | 2384 transition_type, |
| 2385 source_frame_id)); | 2385 source_frame_id)); |
| 2386 } | 2386 } |
| 2387 } | 2387 } |
| 2388 | 2388 |
| 2389 void WebContentsImpl::RouteCloseEvent(RenderViewHost* rvh) { |
| 2390 // Tell the active RenderViewHost to run unload handlers and close, as long |
| 2391 // as the request came from a RenderViewHost in the same BrowsingInstance. |
| 2392 // In most cases, we receive this from a swapped out RenderViewHost. |
| 2393 // It is possible to receive it from one that has just been swapped in, |
| 2394 // in which case we might as well deliver the message anyway. |
| 2395 if (rvh->GetSiteInstance()->IsRelatedSiteInstance(GetSiteInstance())) |
| 2396 GetRenderViewHost()->ClosePage(); |
| 2397 } |
| 2398 |
| 2389 void WebContentsImpl::RunJavaScriptMessage( | 2399 void WebContentsImpl::RunJavaScriptMessage( |
| 2390 RenderViewHost* rvh, | 2400 RenderViewHost* rvh, |
| 2391 const string16& message, | 2401 const string16& message, |
| 2392 const string16& default_prompt, | 2402 const string16& default_prompt, |
| 2393 const GURL& frame_url, | 2403 const GURL& frame_url, |
| 2394 ui::JavascriptMessageType javascript_message_type, | 2404 ui::JavascriptMessageType javascript_message_type, |
| 2395 IPC::Message* reply_msg, | 2405 IPC::Message* reply_msg, |
| 2396 bool* did_suppress_message) { | 2406 bool* did_suppress_message) { |
| 2397 // Suppress JavaScript dialogs when requested. Also suppress messages when | 2407 // Suppress JavaScript dialogs when requested. Also suppress messages when |
| 2398 // showing an interstitial as it's shown over the previous page and we don't | 2408 // 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... |
| 2697 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { | 2707 void WebContentsImpl::CreateViewAndSetSizeForRVH(RenderViewHost* rvh) { |
| 2698 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); | 2708 RenderWidgetHostView* rwh_view = GetView()->CreateViewForWidget(rvh); |
| 2699 // Can be NULL during tests. | 2709 // Can be NULL during tests. |
| 2700 if (rwh_view) | 2710 if (rwh_view) |
| 2701 rwh_view->SetSize(GetView()->GetContainerSize()); | 2711 rwh_view->SetSize(GetView()->GetContainerSize()); |
| 2702 } | 2712 } |
| 2703 | 2713 |
| 2704 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { | 2714 RenderViewHostImpl* WebContentsImpl::GetRenderViewHostImpl() { |
| 2705 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); | 2715 return static_cast<RenderViewHostImpl*>(GetRenderViewHost()); |
| 2706 } | 2716 } |
| OLD | NEW |