| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 3749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3760 | 3760 |
| 3761 NavigationEntry* | 3761 NavigationEntry* |
| 3762 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 3762 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
| 3763 return controller_.GetLastCommittedEntry(); | 3763 return controller_.GetLastCommittedEntry(); |
| 3764 } | 3764 } |
| 3765 | 3765 |
| 3766 bool WebContentsImpl::CreateRenderViewForRenderManager( | 3766 bool WebContentsImpl::CreateRenderViewForRenderManager( |
| 3767 RenderViewHost* render_view_host, | 3767 RenderViewHost* render_view_host, |
| 3768 int opener_route_id, | 3768 int opener_route_id, |
| 3769 int proxy_routing_id, | 3769 int proxy_routing_id, |
| 3770 CrossProcessFrameConnector* frame_connector) { | 3770 bool for_main_frame) { |
| 3771 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); | 3771 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); |
| 3772 // Can be NULL during tests. | 3772 // Can be NULL during tests. |
| 3773 RenderWidgetHostViewBase* rwh_view; | 3773 RenderWidgetHostViewBase* rwh_view; |
| 3774 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary | 3774 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary |
| 3775 // until RenderWidgetHost is attached to RenderFrameHost. We need to special | 3775 // until RenderWidgetHost is attached to RenderFrameHost. We need to special |
| 3776 // case this because RWH is still a base class of RenderViewHost, and child | 3776 // case this because RWH is still a base class of RenderViewHost, and child |
| 3777 // frame RWHVs are unique in that they do not have their own WebContents. | 3777 // frame RWHVs are unique in that they do not have their own WebContents. |
| 3778 if (frame_connector) { | 3778 if (!for_main_frame) { |
| 3779 RenderWidgetHostViewChildFrame* rwh_view_child = | 3779 RenderWidgetHostViewChildFrame* rwh_view_child = |
| 3780 new RenderWidgetHostViewChildFrame(render_view_host); | 3780 new RenderWidgetHostViewChildFrame(render_view_host); |
| 3781 frame_connector->set_view(rwh_view_child); | |
| 3782 rwh_view = rwh_view_child; | 3781 rwh_view = rwh_view_child; |
| 3783 } else { | 3782 } else { |
| 3784 rwh_view = view_->CreateViewForWidget(render_view_host); | 3783 rwh_view = view_->CreateViewForWidget(render_view_host); |
| 3785 } | 3784 } |
| 3786 | 3785 |
| 3787 // Now that the RenderView has been created, we need to tell it its size. | 3786 // Now that the RenderView has been created, we need to tell it its size. |
| 3788 if (rwh_view) | 3787 if (rwh_view) |
| 3789 rwh_view->SetSize(GetSizeForNewRenderView()); | 3788 rwh_view->SetSize(GetSizeForNewRenderView()); |
| 3790 | 3789 |
| 3791 // Make sure we use the correct starting page_id in the new RenderView. | 3790 // Make sure we use the correct starting page_id in the new RenderView. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3826 web_contents_android = new WebContentsAndroid(this); | 3825 web_contents_android = new WebContentsAndroid(this); |
| 3827 SetUserData(kWebContentsAndroidKey, web_contents_android); | 3826 SetUserData(kWebContentsAndroidKey, web_contents_android); |
| 3828 } | 3827 } |
| 3829 return web_contents_android->GetJavaObject(); | 3828 return web_contents_android->GetJavaObject(); |
| 3830 } | 3829 } |
| 3831 | 3830 |
| 3832 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { | 3831 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { |
| 3833 return CreateRenderViewForRenderManager(GetRenderViewHost(), | 3832 return CreateRenderViewForRenderManager(GetRenderViewHost(), |
| 3834 MSG_ROUTING_NONE, | 3833 MSG_ROUTING_NONE, |
| 3835 MSG_ROUTING_NONE, | 3834 MSG_ROUTING_NONE, |
| 3836 NULL); | 3835 true); |
| 3837 } | 3836 } |
| 3838 | 3837 |
| 3839 #elif defined(OS_MACOSX) | 3838 #elif defined(OS_MACOSX) |
| 3840 | 3839 |
| 3841 void WebContentsImpl::SetAllowOverlappingViews(bool overlapping) { | 3840 void WebContentsImpl::SetAllowOverlappingViews(bool overlapping) { |
| 3842 view_->SetAllowOverlappingViews(overlapping); | 3841 view_->SetAllowOverlappingViews(overlapping); |
| 3843 } | 3842 } |
| 3844 | 3843 |
| 3845 bool WebContentsImpl::GetAllowOverlappingViews() { | 3844 bool WebContentsImpl::GetAllowOverlappingViews() { |
| 3846 return view_->GetAllowOverlappingViews(); | 3845 return view_->GetAllowOverlappingViews(); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3961 | 3960 |
| 3962 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3961 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
| 3963 if (!delegate_) | 3962 if (!delegate_) |
| 3964 return; | 3963 return; |
| 3965 const gfx::Size new_size = GetPreferredSize(); | 3964 const gfx::Size new_size = GetPreferredSize(); |
| 3966 if (new_size != old_size) | 3965 if (new_size != old_size) |
| 3967 delegate_->UpdatePreferredSize(this, new_size); | 3966 delegate_->UpdatePreferredSize(this, new_size); |
| 3968 } | 3967 } |
| 3969 | 3968 |
| 3970 } // namespace content | 3969 } // namespace content |
| OLD | NEW |