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 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2428 observers_, | 2428 observers_, |
2429 ProvisionalChangeToMainFrameUrl(validated_url, | 2429 ProvisionalChangeToMainFrameUrl(validated_url, |
2430 render_frame_host)); | 2430 render_frame_host)); |
2431 } | 2431 } |
2432 } | 2432 } |
2433 | 2433 |
2434 void WebContentsImpl::DidStartNavigationTransition( | 2434 void WebContentsImpl::DidStartNavigationTransition( |
2435 RenderFrameHostImpl* render_frame_host) { | 2435 RenderFrameHostImpl* render_frame_host) { |
2436 #if defined(OS_ANDROID) | 2436 #if defined(OS_ANDROID) |
2437 int render_frame_id = render_frame_host->GetRoutingID(); | 2437 int render_frame_id = render_frame_host->GetRoutingID(); |
2438 ContentViewCoreImpl::FromWebContents(this)-> | 2438 GetWebContentsAndroid()->DidStartNavigationTransitionForFrame( |
2439 DidStartNavigationTransitionForFrame(render_frame_id); | 2439 render_frame_id); |
2440 #endif | 2440 #endif |
2441 } | 2441 } |
2442 | 2442 |
2443 void WebContentsImpl::DidFailProvisionalLoadWithError( | 2443 void WebContentsImpl::DidFailProvisionalLoadWithError( |
2444 RenderFrameHostImpl* render_frame_host, | 2444 RenderFrameHostImpl* render_frame_host, |
2445 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { | 2445 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { |
2446 GURL validated_url(params.url); | 2446 GURL validated_url(params.url); |
2447 FOR_EACH_OBSERVER(WebContentsObserver, | 2447 FOR_EACH_OBSERVER(WebContentsObserver, |
2448 observers_, | 2448 observers_, |
2449 DidFailProvisionalLoad(render_frame_host, | 2449 DidFailProvisionalLoad(render_frame_host, |
(...skipping 1147 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 | 4089 |
4092 return true; | 4090 return true; |
4093 } | 4091 } |
4094 | 4092 |
4095 #if defined(OS_ANDROID) | 4093 #if defined(OS_ANDROID) |
4096 | 4094 |
4097 base::android::ScopedJavaLocalRef<jobject> | 4095 base::android::ScopedJavaLocalRef<jobject> |
4098 WebContentsImpl::GetJavaWebContents() { | 4096 WebContentsImpl::GetJavaWebContents() { |
4099 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 4097 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
4100 | 4098 |
| 4099 WebContentsAndroid* web_contents_android = GetWebContentsAndroid(); |
| 4100 return web_contents_android->GetJavaObject(); |
| 4101 } |
| 4102 |
| 4103 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { |
4101 WebContentsAndroid* web_contents_android = | 4104 WebContentsAndroid* web_contents_android = |
4102 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 4105 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
4103 if (!web_contents_android) { | 4106 if (!web_contents_android) { |
4104 web_contents_android = new WebContentsAndroid(this); | 4107 web_contents_android = new WebContentsAndroid(this); |
4105 SetUserData(kWebContentsAndroidKey, web_contents_android); | 4108 SetUserData(kWebContentsAndroidKey, web_contents_android); |
4106 } | 4109 } |
4107 return web_contents_android->GetJavaObject(); | 4110 return web_contents_android; |
4108 } | 4111 } |
4109 | 4112 |
4110 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { | 4113 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { |
4111 return CreateRenderViewForRenderManager(GetRenderViewHost(), | 4114 return CreateRenderViewForRenderManager(GetRenderViewHost(), |
4112 MSG_ROUTING_NONE, | 4115 MSG_ROUTING_NONE, |
4113 MSG_ROUTING_NONE, | 4116 MSG_ROUTING_NONE, |
4114 true); | 4117 true); |
4115 } | 4118 } |
4116 | 4119 |
4117 #elif defined(OS_MACOSX) | 4120 #elif defined(OS_MACOSX) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4240 if (new_size != old_size) | 4243 if (new_size != old_size) |
4241 delegate_->UpdatePreferredSize(this, new_size); | 4244 delegate_->UpdatePreferredSize(this, new_size); |
4242 } | 4245 } |
4243 | 4246 |
4244 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4247 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4245 FrameTreeNode* node = frame_tree_.root(); | 4248 FrameTreeNode* node = frame_tree_.root(); |
4246 node->render_manager()->ResumeResponseDeferredAtStart(); | 4249 node->render_manager()->ResumeResponseDeferredAtStart(); |
4247 } | 4250 } |
4248 | 4251 |
4249 } // namespace content | 4252 } // namespace content |
OLD | NEW |