Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: content/browser/renderer_host/render_view_host_impl.cc

Issue 1411203010: Separate RenderViewHost from RenderWidgetHost, part 4: delegate (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: done Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/renderer_host/render_view_host_impl.h" 5 #include "content/browser/renderer_host/render_view_host_impl.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 /////////////////////////////////////////////////////////////////////////////// 183 ///////////////////////////////////////////////////////////////////////////////
184 // RenderViewHostImpl, public: 184 // RenderViewHostImpl, public:
185 185
186 // static 186 // static
187 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id, 187 RenderViewHostImpl* RenderViewHostImpl::FromID(int render_process_id,
188 int render_view_id) { 188 int render_view_id) {
189 RenderWidgetHost* widget = 189 RenderWidgetHost* widget =
190 RenderWidgetHost::FromID(render_process_id, render_view_id); 190 RenderWidgetHost::FromID(render_process_id, render_view_id);
191 if (!widget || !widget->IsRenderView()) 191 if (!widget)
192 return NULL; 192 return nullptr;
193 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(widget)); 193 return From(widget);
194 } 194 }
195 195
196 // static 196 // static
197 RenderViewHostImpl* RenderViewHostImpl::From(RenderWidgetHost* rwh) { 197 RenderViewHostImpl* RenderViewHostImpl::From(RenderWidgetHost* rwh) {
198 DCHECK(rwh->IsRenderView()); 198 DCHECK(rwh);
199 return static_cast<RenderViewHostImpl*>(RenderWidgetHostImpl::From(rwh)); 199 RenderWidgetHostOwnerDelegate* owner_delegate =
200 RenderWidgetHostImpl::From(rwh)->owner_delegate();
201 if (!owner_delegate)
ncarter (slow) 2015/10/26 18:35:02 Seems a little dirty for this code to assume it's
Avi (use Gerrit) 2015/10/26 19:41:28 Yes, this is the weakest part of the scheme.
202 return nullptr;
203 return static_cast<RenderViewHostImpl*>(owner_delegate);
200 } 204 }
201 205
202 RenderViewHostImpl::RenderViewHostImpl( 206 RenderViewHostImpl::RenderViewHostImpl(
203 SiteInstance* instance, 207 SiteInstance* instance,
204 RenderViewHostDelegate* delegate, 208 RenderViewHostDelegate* delegate,
205 RenderWidgetHostDelegate* widget_delegate, 209 RenderWidgetHostDelegate* widget_delegate,
206 int32 routing_id, 210 int32 routing_id,
207 int32 main_frame_routing_id, 211 int32 main_frame_routing_id,
208 bool swapped_out, 212 bool swapped_out,
209 bool hidden, 213 bool hidden,
(...skipping 17 matching lines...) Expand all
227 sudden_termination_allowed_(false), 231 sudden_termination_allowed_(false),
228 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), 232 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING),
229 virtual_keyboard_requested_(false), 233 virtual_keyboard_requested_(false),
230 is_focused_element_editable_(false), 234 is_focused_element_editable_(false),
231 updating_web_preferences_(false), 235 updating_web_preferences_(false),
232 render_view_ready_on_process_launch_(false), 236 render_view_ready_on_process_launch_(false),
233 weak_factory_(this) { 237 weak_factory_(this) {
234 DCHECK(instance_.get()); 238 DCHECK(instance_.get());
235 CHECK(delegate_); // http://crbug.com/82827 239 CHECK(delegate_); // http://crbug.com/82827
236 240
241 GetWidget()->set_owner_delegate(this);
242
237 GetProcess()->AddObserver(this); 243 GetProcess()->AddObserver(this);
238 GetProcess()->EnableSendQueue(); 244 GetProcess()->EnableSendQueue();
239 245
240 if (ResourceDispatcherHostImpl::Get()) { 246 if (ResourceDispatcherHostImpl::Get()) {
241 bool has_active_audio = false; 247 bool has_active_audio = false;
242 if (has_initialized_audio_host) { 248 if (has_initialized_audio_host) {
243 scoped_refptr<AudioRendererHost> arh = 249 scoped_refptr<AudioRendererHost> arh =
244 static_cast<RenderProcessHostImpl*>(GetProcess()) 250 static_cast<RenderProcessHostImpl*>(GetProcess())
245 ->audio_renderer_host(); 251 ->audio_renderer_host();
246 if (arh.get()) 252 if (arh.get())
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 BrowserThread::PostTask( 1003 BrowserThread::PostTask(
998 BrowserThread::IO, FROM_HERE, 1004 BrowserThread::IO, FROM_HERE,
999 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostWasShown, 1005 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostWasShown,
1000 base::Unretained(ResourceDispatcherHostImpl::Get()), 1006 base::Unretained(ResourceDispatcherHostImpl::Get()),
1001 GetProcess()->GetID(), GetRoutingID())); 1007 GetProcess()->GetID(), GetRoutingID()));
1002 } 1008 }
1003 1009
1004 RenderWidgetHostImpl::WasShown(latency_info); 1010 RenderWidgetHostImpl::WasShown(latency_info);
1005 } 1011 }
1006 1012
1007 bool RenderViewHostImpl::IsRenderView() const {
1008 return true;
1009 }
1010
1011 void RenderViewHostImpl::CreateNewWindow( 1013 void RenderViewHostImpl::CreateNewWindow(
1012 int route_id, 1014 int route_id,
1013 int main_frame_route_id, 1015 int main_frame_route_id,
1014 const ViewHostMsg_CreateWindow_Params& params, 1016 const ViewHostMsg_CreateWindow_Params& params,
1015 SessionStorageNamespace* session_storage_namespace) { 1017 SessionStorageNamespace* session_storage_namespace) {
1016 ViewHostMsg_CreateWindow_Params validated_params(params); 1018 ViewHostMsg_CreateWindow_Params validated_params(params);
1017 GetProcess()->FilterURL(false, &validated_params.target_url); 1019 GetProcess()->FilterURL(false, &validated_params.target_url);
1018 GetProcess()->FilterURL(false, &validated_params.opener_url); 1020 GetProcess()->FilterURL(false, &validated_params.opener_url);
1019 GetProcess()->FilterURL(true, &validated_params.opener_security_origin); 1021 GetProcess()->FilterURL(true, &validated_params.opener_security_origin);
1020 1022
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 } else { 1461 } else {
1460 render_view_ready_on_process_launch_ = true; 1462 render_view_ready_on_process_launch_ = true;
1461 } 1463 }
1462 } 1464 }
1463 1465
1464 void RenderViewHostImpl::RenderViewReady() { 1466 void RenderViewHostImpl::RenderViewReady() {
1465 delegate_->RenderViewReady(this); 1467 delegate_->RenderViewReady(this);
1466 } 1468 }
1467 1469
1468 } // namespace content 1470 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698