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 3411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3422 } | 3422 } |
3423 | 3423 |
3424 void WebContentsImpl::UpdateState(RenderViewHost* rvh, | 3424 void WebContentsImpl::UpdateState(RenderViewHost* rvh, |
3425 int32 page_id, | 3425 int32 page_id, |
3426 const PageState& page_state) { | 3426 const PageState& page_state) { |
3427 // Ensure that this state update comes from either the active RVH or one of | 3427 // Ensure that this state update comes from either the active RVH or one of |
3428 // the swapped out RVHs. We don't expect to hear from any other RVHs. | 3428 // the swapped out RVHs. We don't expect to hear from any other RVHs. |
3429 // TODO(nasko): This should go through RenderFrameHost. | 3429 // TODO(nasko): This should go through RenderFrameHost. |
3430 // TODO(creis): We can't update state for cross-process subframes until we | 3430 // TODO(creis): We can't update state for cross-process subframes until we |
3431 // have FrameNavigationEntries. Once we do, this should be a DCHECK. | 3431 // have FrameNavigationEntries. Once we do, this should be a DCHECK. |
| 3432 LOG(ERROR) << "WCI::UpdateState: " << rvh->GetProcess()->GetID() << ":" << |
| 3433 rvh->GetRoutingID() << ":" << rvh->GetSiteInstance()->GetSiteURL() << |
| 3434 ":" << GetRenderManager(); |
| 3435 |
3432 if (rvh != GetRenderViewHost() && | 3436 if (rvh != GetRenderViewHost() && |
3433 !GetRenderManager()->IsRVHOnSwappedOutList( | 3437 !GetRenderManager()->IsRVHOnSwappedOutList( |
3434 static_cast<RenderViewHostImpl*>(rvh))) | 3438 static_cast<RenderViewHostImpl*>(rvh))) |
3435 return; | 3439 return; |
3436 | 3440 |
3437 // We must be prepared to handle state updates for any page, these occur | 3441 // We must be prepared to handle state updates for any page, these occur |
3438 // when the user is scrolling and entering form data, as well as when we're | 3442 // when the user is scrolling and entering form data, as well as when we're |
3439 // leaving a page, in which case our state may have already been moved to | 3443 // leaving a page, in which case our state may have already been moved to |
3440 // the next page. The navigation controller will look up the appropriate | 3444 // the next page. The navigation controller will look up the appropriate |
3441 // NavigationEntry and update it when it is notified via the delegate. | 3445 // NavigationEntry and update it when it is notified via the delegate. |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3897 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { | 3901 WebContentsImpl::GetLastCommittedNavigationEntryForRenderManager() { |
3898 return controller_.GetLastCommittedEntry(); | 3902 return controller_.GetLastCommittedEntry(); |
3899 } | 3903 } |
3900 | 3904 |
3901 bool WebContentsImpl::CreateRenderViewForRenderManager( | 3905 bool WebContentsImpl::CreateRenderViewForRenderManager( |
3902 RenderViewHost* render_view_host, | 3906 RenderViewHost* render_view_host, |
3903 int opener_route_id, | 3907 int opener_route_id, |
3904 int proxy_routing_id, | 3908 int proxy_routing_id, |
3905 bool for_main_frame) { | 3909 bool for_main_frame) { |
3906 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); | 3910 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderViewForRenderManager"); |
| 3911 LOG(ERROR) << "WC::CreateRenderViewForRenderManager: " |
| 3912 << "for_main_frame:" << for_main_frame; |
3907 // Can be NULL during tests. | 3913 // Can be NULL during tests. |
3908 RenderWidgetHostViewBase* rwh_view; | 3914 RenderWidgetHostViewBase* rwh_view; |
3909 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary | 3915 // TODO(kenrb): RenderWidgetHostViewChildFrame special casing is temporary |
3910 // until RenderWidgetHost is attached to RenderFrameHost. We need to special | 3916 // until RenderWidgetHost is attached to RenderFrameHost. We need to special |
3911 // case this because RWH is still a base class of RenderViewHost, and child | 3917 // case this because RWH is still a base class of RenderViewHost, and child |
3912 // frame RWHVs are unique in that they do not have their own WebContents. | 3918 // frame RWHVs are unique in that they do not have their own WebContents. |
3913 if (!for_main_frame) { | 3919 if (!for_main_frame) { |
3914 RenderWidgetHostViewChildFrame* rwh_view_child = | 3920 RenderWidgetHostViewChildFrame* rwh_view_child = |
3915 new RenderWidgetHostViewChildFrame(render_view_host); | 3921 new RenderWidgetHostViewChildFrame(render_view_host); |
3916 rwh_view = rwh_view_child; | 3922 rwh_view = rwh_view_child; |
(...skipping 24 matching lines...) Expand all Loading... |
3941 // linux. See crbug.com/83941. | 3947 // linux. See crbug.com/83941. |
3942 if (rwh_view) { | 3948 if (rwh_view) { |
3943 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 3949 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
3944 render_widget_host->WasResized(); | 3950 render_widget_host->WasResized(); |
3945 } | 3951 } |
3946 #endif | 3952 #endif |
3947 | 3953 |
3948 return true; | 3954 return true; |
3949 } | 3955 } |
3950 | 3956 |
| 3957 bool WebContentsImpl::CreateRenderFrameForRenderManager( |
| 3958 RenderFrameHost* render_frame_host, |
| 3959 int parent_routing_id) { |
| 3960 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderFrameForRenderManager"); |
| 3961 |
| 3962 RenderFrameHostImpl* rfh = |
| 3963 static_cast<RenderFrameHostImpl*>(render_frame_host); |
| 3964 if (!rfh->CreateRenderFrame(parent_routing_id)) |
| 3965 return false; |
| 3966 |
| 3967 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed |
| 3968 // RenderFrameHost will have to be associated with the appropriate |
| 3969 // RenderWidgetHostView or a new one should be created here. |
| 3970 |
| 3971 return true; |
| 3972 } |
| 3973 |
| 3974 |
3951 #if defined(OS_ANDROID) | 3975 #if defined(OS_ANDROID) |
3952 | 3976 |
3953 base::android::ScopedJavaLocalRef<jobject> | 3977 base::android::ScopedJavaLocalRef<jobject> |
3954 WebContentsImpl::GetJavaWebContents() { | 3978 WebContentsImpl::GetJavaWebContents() { |
3955 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3979 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
3956 | 3980 |
3957 WebContentsAndroid* web_contents_android = | 3981 WebContentsAndroid* web_contents_android = |
3958 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 3982 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
3959 if (!web_contents_android) { | 3983 if (!web_contents_android) { |
3960 web_contents_android = new WebContentsAndroid(this); | 3984 web_contents_android = new WebContentsAndroid(this); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4100 if (new_size != old_size) | 4124 if (new_size != old_size) |
4101 delegate_->UpdatePreferredSize(this, new_size); | 4125 delegate_->UpdatePreferredSize(this, new_size); |
4102 } | 4126 } |
4103 | 4127 |
4104 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4128 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4105 FrameTreeNode* node = frame_tree_.root(); | 4129 FrameTreeNode* node = frame_tree_.root(); |
4106 node->render_manager()->ResumeResponseDeferredAtStart(); | 4130 node->render_manager()->ResumeResponseDeferredAtStart(); |
4107 } | 4131 } |
4108 | 4132 |
4109 } // namespace content | 4133 } // namespace content |
OLD | NEW |