OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/bind_helpers.h" | 5 #include "base/bind_helpers.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "content/browser/browser_plugin/browser_plugin_guest.h" | 9 #include "content/browser/browser_plugin/browser_plugin_guest.h" |
10 #include "content/browser/frame_host/render_widget_host_view_guest.h" | 10 #include "content/browser/frame_host/render_widget_host_view_guest.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView(); | 128 RenderWidgetHostViewBase* rwhv = GetGuestRenderWidgetHostView(); |
129 gfx::Rect embedder_bounds; | 129 gfx::Rect embedder_bounds; |
130 if (rwhv) | 130 if (rwhv) |
131 embedder_bounds = rwhv->GetViewBounds(); | 131 embedder_bounds = rwhv->GetViewBounds(); |
132 gfx::Rect shifted_rect = guest_->ToGuestRect(embedder_bounds); | 132 gfx::Rect shifted_rect = guest_->ToGuestRect(embedder_bounds); |
133 shifted_rect.set_width(size_.width()); | 133 shifted_rect.set_width(size_.width()); |
134 shifted_rect.set_height(size_.height()); | 134 shifted_rect.set_height(size_.height()); |
135 return shifted_rect; | 135 return shifted_rect; |
136 } | 136 } |
137 | 137 |
138 void RenderWidgetHostViewGuest::RenderProcessGone( | |
139 base::TerminationStatus status, | |
140 int error_code) { | |
141 platform_view_->RenderProcessGone(status, error_code); | |
142 // Destroy the guest view instance only, so we don't end up calling | |
143 // platform_view_->Destroy(). | |
144 DestroyGuestView(); | |
145 } | |
146 | |
147 void RenderWidgetHostViewGuest::Destroy() { | 138 void RenderWidgetHostViewGuest::Destroy() { |
148 // The RenderWidgetHost's destruction led here, so don't call it. | 139 host_->ViewDestroyed(this); |
149 DestroyGuestView(); | 140 host_ = NULL; |
| 141 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
150 | 142 |
151 platform_view_->Destroy(); | 143 platform_view_->Destroy(); |
152 } | 144 } |
153 | 145 |
154 gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const { | 146 gfx::Size RenderWidgetHostViewGuest::GetPhysicalBackingSize() const { |
155 return RenderWidgetHostViewBase::GetPhysicalBackingSize(); | 147 return RenderWidgetHostViewBase::GetPhysicalBackingSize(); |
156 } | 148 } |
157 | 149 |
158 base::string16 RenderWidgetHostViewGuest::GetSelectedText() const { | 150 base::string16 RenderWidgetHostViewGuest::GetSelectedText() const { |
159 return platform_view_->GetSelectedText(); | 151 return platform_view_->GetSelectedText(); |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 void RenderWidgetHostViewGuest::SetParentNativeViewAccessible( | 457 void RenderWidgetHostViewGuest::SetParentNativeViewAccessible( |
466 gfx::NativeViewAccessible accessible_parent) { | 458 gfx::NativeViewAccessible accessible_parent) { |
467 } | 459 } |
468 | 460 |
469 gfx::NativeViewId RenderWidgetHostViewGuest::GetParentForWindowlessPlugin() | 461 gfx::NativeViewId RenderWidgetHostViewGuest::GetParentForWindowlessPlugin() |
470 const { | 462 const { |
471 return NULL; | 463 return NULL; |
472 } | 464 } |
473 #endif | 465 #endif |
474 | 466 |
475 void RenderWidgetHostViewGuest::DestroyGuestView() { | |
476 host_->SetView(NULL); | |
477 host_ = NULL; | |
478 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | |
479 } | |
480 | |
481 bool RenderWidgetHostViewGuest::CanDispatchToConsumer( | 467 bool RenderWidgetHostViewGuest::CanDispatchToConsumer( |
482 ui::GestureConsumer* consumer) { | 468 ui::GestureConsumer* consumer) { |
483 CHECK_EQ(static_cast<RenderWidgetHostViewGuest*>(consumer), this); | 469 CHECK_EQ(static_cast<RenderWidgetHostViewGuest*>(consumer), this); |
484 return true; | 470 return true; |
485 } | 471 } |
486 | 472 |
487 void RenderWidgetHostViewGuest::DispatchGestureEvent( | 473 void RenderWidgetHostViewGuest::DispatchGestureEvent( |
488 ui::GestureEvent* event) { | 474 ui::GestureEvent* event) { |
489 ForwardGestureEventToRenderer(event); | 475 ForwardGestureEventToRenderer(event); |
490 } | 476 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
554 return kN32_SkColorType; | 540 return kN32_SkColorType; |
555 } | 541 } |
556 | 542 |
557 RenderWidgetHostViewBase* | 543 RenderWidgetHostViewBase* |
558 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const { | 544 RenderWidgetHostViewGuest::GetGuestRenderWidgetHostView() const { |
559 return static_cast<RenderWidgetHostViewBase*>( | 545 return static_cast<RenderWidgetHostViewBase*>( |
560 guest_->GetEmbedderRenderWidgetHostView()); | 546 guest_->GetEmbedderRenderWidgetHostView()); |
561 } | 547 } |
562 | 548 |
563 } // namespace content | 549 } // namespace content |
OLD | NEW |