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 WebContentsAndroid* web_contents_android = GetWebContentsAndroid(); |
2439 DidStartNavigationTransitionForFrame(render_frame_id); | 2439 web_contents_android->DidStartNavigationTransitionForFrame(render_frame_id); |
sky
2014/08/07 16:17:31
I wouldn't bother with the local variable for WebC
AKVT
2014/08/08 15:08:25
Removed Local variable. Thanks
| |
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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 scoped_refptr<net::HttpResponseHeaders>& headers, | 3605 const scoped_refptr<net::HttpResponseHeaders>& headers, |
3606 const GURL& url) { | 3606 const GURL& url) { |
3607 #if defined(OS_ANDROID) | 3607 #if defined(OS_ANDROID) |
3608 ContentViewCoreImpl::FromWebContents(this)->DidDeferAfterResponseStarted( | 3608 WebContentsAndroid* web_contents_android = GetWebContentsAndroid(); |
3609 headers, url); | 3609 web_contents_android->DidDeferAfterResponseStarted(headers, url); |
3610 #endif | 3610 #endif |
3611 } | 3611 } |
3612 | 3612 |
3613 bool WebContentsImpl::WillHandleDeferAfterResponseStarted() { | 3613 bool WebContentsImpl::WillHandleDeferAfterResponseStarted() { |
3614 #if defined(OS_ANDROID) | 3614 #if defined(OS_ANDROID) |
3615 return ContentViewCoreImpl::FromWebContents(this)-> | 3615 WebContentsAndroid* web_contents_android = GetWebContentsAndroid(); |
3616 WillHandleDeferAfterResponseStarted(); | 3616 return web_contents_android->WillHandleDeferAfterResponseStarted(); |
3617 #else | 3617 #else |
3618 return false; | 3618 return false; |
3619 #endif | 3619 #endif |
3620 } | 3620 } |
3621 | 3621 |
3622 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { | 3622 void WebContentsImpl::RequestMove(const gfx::Rect& new_bounds) { |
3623 if (delegate_ && delegate_->IsPopupOrPanel(this)) | 3623 if (delegate_ && delegate_->IsPopupOrPanel(this)) |
3624 delegate_->MoveContents(this, new_bounds); | 3624 delegate_->MoveContents(this, new_bounds); |
3625 } | 3625 } |
3626 | 3626 |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4092 | 4092 |
4093 return true; | 4093 return true; |
4094 } | 4094 } |
4095 | 4095 |
4096 #if defined(OS_ANDROID) | 4096 #if defined(OS_ANDROID) |
4097 | 4097 |
4098 base::android::ScopedJavaLocalRef<jobject> | 4098 base::android::ScopedJavaLocalRef<jobject> |
4099 WebContentsImpl::GetJavaWebContents() { | 4099 WebContentsImpl::GetJavaWebContents() { |
4100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 4100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
4101 | 4101 |
4102 WebContentsAndroid* web_contents_android = GetWebContentsAndroid(); | |
4103 return web_contents_android->GetJavaObject(); | |
4104 } | |
4105 | |
4106 WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() { | |
sky
2014/08/07 16:17:31
Make position match header.
AKVT
2014/08/08 15:08:25
Positioned the declaration immediately after GetJa
| |
4102 WebContentsAndroid* web_contents_android = | 4107 WebContentsAndroid* web_contents_android = |
4103 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 4108 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
4104 if (!web_contents_android) { | 4109 if (!web_contents_android) { |
4105 web_contents_android = new WebContentsAndroid(this); | 4110 web_contents_android = new WebContentsAndroid(this); |
4106 SetUserData(kWebContentsAndroidKey, web_contents_android); | 4111 SetUserData(kWebContentsAndroidKey, web_contents_android); |
4107 } | 4112 } |
4108 return web_contents_android->GetJavaObject(); | 4113 return web_contents_android; |
4109 } | 4114 } |
4110 | 4115 |
4111 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { | 4116 bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() { |
4112 return CreateRenderViewForRenderManager(GetRenderViewHost(), | 4117 return CreateRenderViewForRenderManager(GetRenderViewHost(), |
4113 MSG_ROUTING_NONE, | 4118 MSG_ROUTING_NONE, |
4114 MSG_ROUTING_NONE, | 4119 MSG_ROUTING_NONE, |
4115 true); | 4120 true); |
4116 } | 4121 } |
4117 | 4122 |
4118 #elif defined(OS_MACOSX) | 4123 #elif defined(OS_MACOSX) |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4241 if (new_size != old_size) | 4246 if (new_size != old_size) |
4242 delegate_->UpdatePreferredSize(this, new_size); | 4247 delegate_->UpdatePreferredSize(this, new_size); |
4243 } | 4248 } |
4244 | 4249 |
4245 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4250 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
4246 FrameTreeNode* node = frame_tree_.root(); | 4251 FrameTreeNode* node = frame_tree_.root(); |
4247 node->render_manager()->ResumeResponseDeferredAtStart(); | 4252 node->render_manager()->ResumeResponseDeferredAtStart(); |
4248 } | 4253 } |
4249 | 4254 |
4250 } // namespace content | 4255 } // namespace content |
OLD | NEW |