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/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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 is_waiting_for_close_ack_(false), | 220 is_waiting_for_close_ack_(false), |
221 sudden_termination_allowed_(false), | 221 sudden_termination_allowed_(false), |
222 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), | 222 render_view_termination_status_(base::TERMINATION_STATUS_STILL_RUNNING), |
223 virtual_keyboard_requested_(false), | 223 virtual_keyboard_requested_(false), |
224 is_focused_element_editable_(false), | 224 is_focused_element_editable_(false), |
225 updating_web_preferences_(false), | 225 updating_web_preferences_(false), |
226 weak_factory_(this) { | 226 weak_factory_(this) { |
227 DCHECK(instance_.get()); | 227 DCHECK(instance_.get()); |
228 CHECK(delegate_); // http://crbug.com/82827 | 228 CHECK(delegate_); // http://crbug.com/82827 |
229 | 229 |
| 230 GetProcess()->AddObserver(this); |
230 GetProcess()->EnableSendQueue(); | 231 GetProcess()->EnableSendQueue(); |
231 | 232 |
232 if (ResourceDispatcherHostImpl::Get()) { | 233 if (ResourceDispatcherHostImpl::Get()) { |
233 bool has_active_audio = false; | 234 bool has_active_audio = false; |
234 if (has_initialized_audio_host) { | 235 if (has_initialized_audio_host) { |
235 scoped_refptr<AudioRendererHost> arh = | 236 scoped_refptr<AudioRendererHost> arh = |
236 static_cast<RenderProcessHostImpl*>(GetProcess()) | 237 static_cast<RenderProcessHostImpl*>(GetProcess()) |
237 ->audio_renderer_host(); | 238 ->audio_renderer_host(); |
238 if (arh.get()) | 239 if (arh.get()) |
239 has_active_audio = | 240 has_active_audio = |
(...skipping 14 matching lines...) Expand all Loading... |
254 RenderViewHostImpl::~RenderViewHostImpl() { | 255 RenderViewHostImpl::~RenderViewHostImpl() { |
255 if (ResourceDispatcherHostImpl::Get()) { | 256 if (ResourceDispatcherHostImpl::Get()) { |
256 BrowserThread::PostTask( | 257 BrowserThread::PostTask( |
257 BrowserThread::IO, FROM_HERE, | 258 BrowserThread::IO, FROM_HERE, |
258 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, | 259 base::Bind(&ResourceDispatcherHostImpl::OnRenderViewHostDeleted, |
259 base::Unretained(ResourceDispatcherHostImpl::Get()), | 260 base::Unretained(ResourceDispatcherHostImpl::Get()), |
260 GetProcess()->GetID(), GetRoutingID())); | 261 GetProcess()->GetID(), GetRoutingID())); |
261 } | 262 } |
262 | 263 |
263 delegate_->RenderViewDeleted(this); | 264 delegate_->RenderViewDeleted(this); |
| 265 GetProcess()->RemoveObserver(this); |
264 } | 266 } |
265 | 267 |
266 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { | 268 RenderViewHostDelegate* RenderViewHostImpl::GetDelegate() const { |
267 return delegate_; | 269 return delegate_; |
268 } | 270 } |
269 | 271 |
270 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { | 272 SiteInstanceImpl* RenderViewHostImpl::GetSiteInstance() const { |
271 return instance_.get(); | 273 return instance_.get(); |
272 } | 274 } |
273 | 275 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 float y) { | 575 float y) { |
574 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), | 576 Send(new InputMsg_ActivateNearestFindResult(GetRoutingID(), |
575 request_id, x, y)); | 577 request_id, x, y)); |
576 } | 578 } |
577 | 579 |
578 void RenderViewHostImpl::RequestFindMatchRects(int current_version) { | 580 void RenderViewHostImpl::RequestFindMatchRects(int current_version) { |
579 Send(new ViewMsg_FindMatchRects(GetRoutingID(), current_version)); | 581 Send(new ViewMsg_FindMatchRects(GetRoutingID(), current_version)); |
580 } | 582 } |
581 #endif | 583 #endif |
582 | 584 |
| 585 void RenderViewHostImpl::RenderProcessExited(RenderProcessHost* host, |
| 586 base::TerminationStatus status, |
| 587 int exit_code) { |
| 588 if (!renderer_initialized()) |
| 589 return; |
| 590 |
| 591 RenderWidgetHostImpl::RendererExited(status, exit_code); |
| 592 delegate_->RenderViewTerminated( |
| 593 this, static_cast<base::TerminationStatus>(status), exit_code); |
| 594 } |
| 595 |
583 void RenderViewHostImpl::DragTargetDragEnter( | 596 void RenderViewHostImpl::DragTargetDragEnter( |
584 const DropData& drop_data, | 597 const DropData& drop_data, |
585 const gfx::Point& client_pt, | 598 const gfx::Point& client_pt, |
586 const gfx::Point& screen_pt, | 599 const gfx::Point& screen_pt, |
587 WebDragOperationsMask operations_allowed, | 600 WebDragOperationsMask operations_allowed, |
588 int key_modifiers) { | 601 int key_modifiers) { |
589 const int renderer_id = GetProcess()->GetID(); | 602 const int renderer_id = GetProcess()->GetID(); |
590 ChildProcessSecurityPolicyImpl* policy = | 603 ChildProcessSecurityPolicyImpl* policy = |
591 ChildProcessSecurityPolicyImpl::GetInstance(); | 604 ChildProcessSecurityPolicyImpl::GetInstance(); |
592 | 605 |
(...skipping 826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1419 if (!policy->CanReadFile(GetProcess()->GetID(), file)) | 1432 if (!policy->CanReadFile(GetProcess()->GetID(), file)) |
1420 policy->GrantReadFile(GetProcess()->GetID(), file); | 1433 policy->GrantReadFile(GetProcess()->GetID(), file); |
1421 } | 1434 } |
1422 } | 1435 } |
1423 | 1436 |
1424 void RenderViewHostImpl::SelectWordAroundCaret() { | 1437 void RenderViewHostImpl::SelectWordAroundCaret() { |
1425 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); | 1438 Send(new ViewMsg_SelectWordAroundCaret(GetRoutingID())); |
1426 } | 1439 } |
1427 | 1440 |
1428 } // namespace content | 1441 } // namespace content |
OLD | NEW |