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 3755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3766 } | 3766 } |
3767 | 3767 |
3768 NavigationEntry* | 3768 NavigationEntry* |
3769 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 3769 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
3770 return controller_.GetLastCommittedEntry(); | 3770 return controller_.GetLastCommittedEntry(); |
3771 } | 3771 } |
3772 | 3772 |
3773 bool WebContentsImpl::CreateRenderViewForRenderManager( | 3773 bool WebContentsImpl::CreateRenderViewForRenderManager( |
3774 RenderViewHost* render_view_host, | 3774 RenderViewHost* render_view_host, |
3775 int opener_route_id, | 3775 int opener_route_id, |
3776 CrossProcessFrameConnector* frame_connector) { | 3776 bool for_main_frame) { |
3777 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); | 3777 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); |
3778 // Can be NULL during tests. | 3778 // Can be NULL during tests. |
3779 RenderWidgetHostViewBase* rwh_view; | 3779 RenderWidgetHostViewBase* rwh_view; |
3780 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary | 3780 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary |
3781 // until RenderWidgetHost is attached to RenderFrameHost. We need to special | 3781 // until RenderWidgetHost is attached to RenderFrameHost. We need to special |
3782 // case this because RWH is still a base class of RenderViewHost, and child | 3782 // case this because RWH is still a base class of RenderViewHost, and child |
3783 // frame RWHVs are unique in that they do not have their own WebContents. | 3783 // frame RWHVs are unique in that they do not have their own WebContents. |
3784 if (frame_connector) { | 3784 if (!for_main_frame) { |
3785 RenderWidgetHostViewChildFrame* rwh_view_child = | 3785 RenderWidgetHostViewChildFrame* rwh_view_child = |
3786 new RenderWidgetHostViewChildFrame(render_view_host); | 3786 new RenderWidgetHostViewChildFrame(render_view_host); |
3787 frame_connector->set_view(rwh_view_child); | |
3788 rwh_view = rwh_view_child; | 3787 rwh_view = rwh_view_child; |
3789 } else { | 3788 } else { |
3790 rwh_view = view_->CreateViewForWidget(render_view_host); | 3789 rwh_view = view_->CreateViewForWidget(render_view_host); |
3791 } | 3790 } |
3792 | 3791 |
3793 // Now that the RenderView has been created, we need to tell it its size. | 3792 // Now that the RenderView has been created, we need to tell it its size. |
3794 if (rwh_view) | 3793 if (rwh_view) |
3795 rwh_view->SetSize(GetSizeForNewRenderView()); | 3794 rwh_view->SetSize(GetSizeForNewRenderView()); |
3796 | 3795 |
3797 // Make sure we use the correct starting page_id in the new RenderView. | 3796 // Make sure we use the correct starting page_id in the new RenderView. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3965 | 3964 |
3966 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { | 3965 void WebContentsImpl::OnPreferredSizeChanged(const gfx::Size& old_size) { |
3967 if (!delegate_) | 3966 if (!delegate_) |
3968 return; | 3967 return; |
3969 const gfx::Size new_size = GetPreferredSize(); | 3968 const gfx::Size new_size = GetPreferredSize(); |
3970 if (new_size != old_size) | 3969 if (new_size != old_size) |
3971 delegate_->UpdatePreferredSize(this, new_size); | 3970 delegate_->UpdatePreferredSize(this, new_size); |
3972 } | 3971 } |
3973 | 3972 |
3974 } // namespace content | 3973 } // namespace content |
OLD | NEW |