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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 observers_, | 2422 observers_, |
2423 ProvisionalChangeToMainFrameUrl(validated_url, | 2423 ProvisionalChangeToMainFrameUrl(validated_url, |
2424 render_frame_host)); | 2424 render_frame_host)); |
2425 } | 2425 } |
2426 } | 2426 } |
2427 | 2427 |
2428 void WebContentsImpl::DidStartNavigationTransition( | 2428 void WebContentsImpl::DidStartNavigationTransition( |
2429 RenderFrameHostImpl* render_frame_host) { | 2429 RenderFrameHostImpl* render_frame_host) { |
2430 #if defined(OS_ANDROID) | 2430 #if defined(OS_ANDROID) |
2431 int render_frame_id = render_frame_host->GetRoutingID(); | 2431 int render_frame_id = render_frame_host->GetRoutingID(); |
2432 ContentViewCoreImpl::FromWebContents(this)-> | 2432 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( |
2433 DidStartNavigationTransitionForFrame(render_frame_id); | 2433 render_frame_id); |
2434 #endif | 2434 #endif |
2435 } | 2435 } |
2436 | 2436 |
2437 void WebContentsImpl::DidFailProvisionalLoadWithError( | 2437 void WebContentsImpl::DidFailProvisionalLoadWithError( |
2438 RenderFrameHostImpl* render_frame_host, | 2438 RenderFrameHostImpl* render_frame_host, |
2439 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 2439 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
2440 GURL validated_url(params.url); | 2440 GURL validated_url(params.url); |
2441 FOR_EACH_OBSERVER(WebContentsObserver, | 2441 FOR_EACH_OBSERVER(WebContentsObserver, |
2442 observers_, | 2442 observers_, |
2443 DidFailProvisionalLoad(render_frame_host, | 2443 DidFailProvisionalLoad(render_frame_host, |
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3597 } | 3597 } |
3598 | 3598 |
3599 void WebContentsImpl::SwappedOut(RenderFrameHost* rfh) { | 3599 void WebContentsImpl::SwappedOut(RenderFrameHost* rfh) { |
3600 if (delegate_ && rfh->GetRenderViewHost() == GetRenderViewHost()) | 3600 if (delegate_ && rfh->GetRenderViewHost() == GetRenderViewHost()) |
3601 delegate_->SwappedOut(this); | 3601 delegate_->SwappedOut(this); |
3602 } | 3602 } |
3603 | 3603 |
3604 void WebContentsImpl::DidDeferAfterResponseStarted( | 3604 void WebContentsImpl::DidDeferAfterResponseStarted( |
3605 const TransitionLayerData& transition_data) { | 3605 const TransitionLayerData& transition_data) { |
3606 #if defined(OS_ANDROID) | 3606 #if defined(OS_ANDROID) |
3607 ContentViewCoreImpl::FromWebContents(this)->DidDeferAfterResponseStarted( | 3607 GetWebContentsAndroid()->DidDeferAfterResponseStarted(transition_data); |
3608 transition_data); | |
3609 #endif | 3608 #endif |
3610 } | 3609 } |
3611 | 3610 |
3612 bool WebContentsImpl::WillHandleDeferAfterResponseStarted() { | 3611 bool WebContentsImpl::WillHandleDeferAfterResponseStarted() { |
3613 #if defined(OS_ANDROID) | 3612 #if defined(OS_ANDROID) |
3614 return ContentViewCoreImpl::FromWebContents(this)-> | 3613 return GetWebContentsAndroid()->WillHandleDeferAfterResponseStarted(); |
3615 WillHandleDeferAfterResponseStarted(); | |
3616 #else | 3614 #else |
3617 return false; | 3615 return false; |
3618 #endif | 3616 #endif |
3619 } | 3617 } |
3620 | 3618 |
3621 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 3619 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
3622 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 3620 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
3623 delegate_->MoveContents(this, new_bounds); | 3621 delegate_->MoveContents(this, new_bounds); |
3624 } | 3622 } |
3625 | 3623 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4091 // RenderWidgetHostView or a new one should be created here. | 4089 // RenderWidgetHostView or a new one should be created here. |
4092 | 4090 |
4093 return true; | 4091 return true; |
4094 } | 4092 } |
4095 | 4093 |
4096 #if defined(OS_ANDROID) | 4094 #if defined(OS_ANDROID) |
4097 | 4095 |
4098 base::android::ScopedJavaLocalRef<jobject> | 4096 base::android::ScopedJavaLocalRef<jobject> |
4099 WebContentsImpl::GetJavaWebContents() { | 4097 WebContentsImpl::GetJavaWebContents() { |
4100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 4098 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 4099 return GetWebContentsAndroid()->GetJavaObject(); |
| 4100 } |
4101 | 4101 |
| 4102 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { |
4102 WebContentsAndroid* web_contents_android = | 4103 WebContentsAndroid* web_contents_android = |
4103 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 4104 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
4104 if (!web_contents_android) { | 4105 if (!web_contents_android) { |
4105 web_contents_android = new WebContentsAndroid(this); | 4106 web_contents_android = new WebContentsAndroid(this); |
4106 SetUserData(kWebContentsAndroidKey, web_contents_android); | 4107 SetUserData(kWebContentsAndroidKey, web_contents_android); |
4107 } | 4108 } |
4108 return web_contents_android->GetJavaObject(); | 4109 return web_contents_android; |
4109 } | 4110 } |
4110 | 4111 |
4111 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { | 4112 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { |
4112 return CreateRenderViewForRenderManager(GetRenderViewHost(), | 4113 return CreateRenderViewForRenderManager(GetRenderViewHost(), |
4113 MSG_ROUTING_NONE, | 4114 MSG_ROUTING_NONE, |
4114 MSG_ROUTING_NONE, | 4115 MSG_ROUTING_NONE, |
4115 true); | 4116 true); |
4116 } | 4117 } |
4117 | 4118 |
4118 #elif defined(OS_MACOSX) | 4119 #elif defined(OS_MACOSX) |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4245 if (new_size != old_size) | 4246 if (new_size != old_size) |
4246 delegate_->UpdatePreferredSize(this, new_size); | 4247 delegate_->UpdatePreferredSize(this, new_size); |
4247 } | 4248 } |
4248 | 4249 |
4249 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4250 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4250 FrameTreeNode* node = frame_tree_.root(); | 4251 FrameTreeNode* node = frame_tree_.root(); |
4251 node->render_manager()->ResumeResponseDeferredAtStart(); | 4252 node->render_manager()->ResumeResponseDeferredAtStart(); |
4252 } | 4253 } |
4253 | 4254 |
4254 } // namespace content | 4255 } // namespace content |
OLD | NEW |