Chromium Code Reviews| 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 3829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3840 // TODO(nasko): Investigate how to remove the GetActiveEntry usage here, | 3840 // TODO(nasko): Investigate how to remove the GetActiveEntry usage here, |
| 3841 // as it is deprecated and can be out of sync with GetRenderViewHost(). | 3841 // as it is deprecated and can be out of sync with GetRenderViewHost(). |
| 3842 GURL url = controller_.GetActiveEntry() | 3842 GURL url = controller_.GetActiveEntry() |
| 3843 ? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL(); | 3843 ? controller_.GetActiveEntry()->GetURL() : GURL::EmptyGURL(); |
| 3844 | 3844 |
| 3845 return GetRenderManager()->current_host()->GetWebkitPrefs(url); | 3845 return GetRenderManager()->current_host()->GetWebkitPrefs(url); |
| 3846 } | 3846 } |
| 3847 | 3847 |
| 3848 int WebContentsImpl::CreateSwappedOutRenderView( | 3848 int WebContentsImpl::CreateSwappedOutRenderView( |
| 3849 SiteInstance* instance) { | 3849 SiteInstance* instance) { |
| 3850 return GetRenderManager()->CreateRenderFrame(instance, MSG_ROUTING_NONE, | 3850 return GetRenderManager()->CreateRenderFrame( |
| 3851 true, true); | 3851 instance, MSG_ROUTING_NONE, true, true, true); |
| 3852 } | 3852 } |
| 3853 | 3853 |
| 3854 void WebContentsImpl::OnUserGesture() { | 3854 void WebContentsImpl::OnUserGesture() { |
| 3855 // Notify observers. | 3855 // Notify observers. |
| 3856 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); | 3856 FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidGetUserGesture()); |
| 3857 | 3857 |
| 3858 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 3858 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
| 3859 if (rdh) // NULL in unittests. | 3859 if (rdh) // NULL in unittests. |
| 3860 rdh->OnUserGesture(this); | 3860 rdh->OnUserGesture(this); |
| 3861 } | 3861 } |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4011 instance) | 4011 instance) |
| 4012 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); | 4012 return GetRenderManager()->pending_render_view_host()->GetRoutingID(); |
| 4013 | 4013 |
| 4014 RenderViewHostImpl* rvh = GetRenderManager()->GetSwappedOutRenderViewHost( | 4014 RenderViewHostImpl* rvh = GetRenderManager()->GetSwappedOutRenderViewHost( |
| 4015 instance); | 4015 instance); |
| 4016 if (rvh) | 4016 if (rvh) |
| 4017 return rvh->GetRoutingID(); | 4017 return rvh->GetRoutingID(); |
| 4018 | 4018 |
| 4019 // Create a swapped out RenderView in the given SiteInstance if none exists, | 4019 // Create a swapped out RenderView in the given SiteInstance if none exists, |
| 4020 // setting its opener to the given route_id. Return the new view's route_id. | 4020 // setting its opener to the given route_id. Return the new view's route_id. |
| 4021 return GetRenderManager()->CreateRenderFrame(instance, opener_route_id, | 4021 return GetRenderManager()->CreateRenderFrame( |
| 4022 true, true); | 4022 instance, opener_route_id, true, true, true); |
| 4023 } | 4023 } |
| 4024 | 4024 |
| 4025 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { | 4025 NavigationControllerImpl& WebContentsImpl::GetControllerForRenderManager() { |
| 4026 return GetController(); | 4026 return GetController(); |
| 4027 } | 4027 } |
| 4028 | 4028 |
| 4029 WebUIImpl* WebContentsImpl::CreateWebUIForRenderManager(const GURL& url) { | 4029 WebUIImpl* WebContentsImpl::CreateWebUIForRenderManager(const GURL& url) { |
| 4030 return static_cast<WebUIImpl*>(CreateWebUI(url)); | 4030 return static_cast<WebUIImpl*>(CreateWebUI(url)); |
| 4031 } | 4031 } |
| 4032 | 4032 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4078 // linux. See crbug.com/83941. | 4078 // linux. See crbug.com/83941. |
| 4079 if (rwh_view) { | 4079 if (rwh_view) { |
| 4080 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) | 4080 if (RenderWidgetHost* render_widget_host = rwh_view->GetRenderWidgetHost()) |
| 4081 render_widget_host->WasResized(); | 4081 render_widget_host->WasResized(); |
| 4082 } | 4082 } |
| 4083 #endif | 4083 #endif |
| 4084 | 4084 |
| 4085 return true; | 4085 return true; |
| 4086 } | 4086 } |
| 4087 | 4087 |
| 4088 bool WebContentsImpl::CreateRenderFrameForRenderManager( | |
| 4089 RenderFrameHost* render_frame_host, | |
| 4090 int parent_routing_id) { | |
| 4091 TRACE_EVENT0("browser", "WebContentsImpl::CreateRenderFrameForRenderManager"); | |
| 4092 | |
| 4093 RenderFrameHostImpl* rfh = | |
| 4094 static_cast<RenderFrameHostImpl*>(render_frame_host); | |
| 4095 if (!rfh->CreateRenderFrame(parent_routing_id)) | |
| 4096 return false; | |
| 4097 | |
| 4098 // TODO(nasko): When RenderWidgetHost is owned by RenderFrameHost, the passed | |
| 4099 // RenderFrameHost will have to be associated with the appropriate | |
| 4100 // RenderWidgetHostView or a new one should be created here. | |
|
Charlie Reis
2014/07/24 22:36:30
Is this the reason we need this method to be in We
nasko
2014/07/25 07:13:21
The reason it is here is to deal with widgets and
Charlie Reis
2014/07/28 19:24:28
Acknowledged.
| |
| 4101 | |
| 4102 return true; | |
| 4103 } | |
| 4104 | |
| 4088 #if defined(OS_ANDROID) | 4105 #if defined(OS_ANDROID) |
| 4089 | 4106 |
| 4090 base::android::ScopedJavaLocalRef<jobject> | 4107 base::android::ScopedJavaLocalRef<jobject> |
| 4091 WebContentsImpl::GetJavaWebContents() { | 4108 WebContentsImpl::GetJavaWebContents() { |
| 4092 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 4109 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 4093 | 4110 |
| 4094 WebContentsAndroid* web_contents_android = | 4111 WebContentsAndroid* web_contents_android = |
| 4095 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); | 4112 static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey)); |
| 4096 if (!web_contents_android) { | 4113 if (!web_contents_android) { |
| 4097 web_contents_android = new WebContentsAndroid(this); | 4114 web_contents_android = new WebContentsAndroid(this); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4233 if (new_size != old_size) | 4250 if (new_size != old_size) |
| 4234 delegate_->UpdatePreferredSize(this, new_size); | 4251 delegate_->UpdatePreferredSize(this, new_size); |
| 4235 } | 4252 } |
| 4236 | 4253 |
| 4237 void WebContentsImpl::ResumeResponseDeferredAtStart() { | 4254 void WebContentsImpl::ResumeResponseDeferredAtStart() { |
| 4238 FrameTreeNode* node = frame_tree_.root(); | 4255 FrameTreeNode* node = frame_tree_.root(); |
| 4239 node->render_manager()->ResumeResponseDeferredAtStart(); | 4256 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4240 } | 4257 } |
| 4241 | 4258 |
| 4242 } // namespace content | 4259 } // namespace content |
| OLD | NEW |