| 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 "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.h" | 8 #include "base/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/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 RenderWidgetHostViewGuest::RenderWidgetHostViewGuest( | 22 RenderWidgetHostViewGuest::RenderWidgetHostViewGuest( |
| 23 RenderWidgetHost* widget_host, | 23 RenderWidgetHost* widget_host, |
| 24 BrowserPluginGuest* guest, | 24 BrowserPluginGuest* guest, |
| 25 RenderWidgetHostView* platform_view) | 25 RenderWidgetHostView* platform_view) |
| 26 : host_(RenderWidgetHostImpl::From(widget_host)), | 26 : host_(RenderWidgetHostImpl::From(widget_host)), |
| 27 guest_(guest), | 27 guest_(guest), |
| 28 is_hidden_(false), | 28 is_hidden_(false), |
| 29 platform_view_(static_cast<RenderWidgetHostViewPort*>(platform_view)) { | 29 platform_view_(static_cast<RenderWidgetHostViewPort*>(platform_view)) { |
| 30 host_->SetView(this); | 30 host_->SetView(this); |
| 31 | |
| 32 enable_compositing_ = CommandLine::ForCurrentProcess()->HasSwitch( | |
| 33 switches::kEnableBrowserPluginCompositing); | |
| 34 } | 31 } |
| 35 | 32 |
| 36 RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() { | 33 RenderWidgetHostViewGuest::~RenderWidgetHostViewGuest() { |
| 37 } | 34 } |
| 38 | 35 |
| 39 RenderWidgetHost* RenderWidgetHostViewGuest::GetRenderWidgetHost() const { | 36 RenderWidgetHost* RenderWidgetHostViewGuest::GetRenderWidgetHost() const { |
| 40 return host_; | 37 return host_; |
| 41 } | 38 } |
| 42 | 39 |
| 43 void RenderWidgetHostViewGuest::WasShown() { | 40 void RenderWidgetHostViewGuest::WasShown() { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 DestroyGuestView(); | 93 DestroyGuestView(); |
| 97 } | 94 } |
| 98 | 95 |
| 99 void RenderWidgetHostViewGuest::SetTooltipText(const string16& tooltip_text) { | 96 void RenderWidgetHostViewGuest::SetTooltipText(const string16& tooltip_text) { |
| 100 platform_view_->SetTooltipText(tooltip_text); | 97 platform_view_->SetTooltipText(tooltip_text); |
| 101 } | 98 } |
| 102 | 99 |
| 103 void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped( | 100 void RenderWidgetHostViewGuest::AcceleratedSurfaceBuffersSwapped( |
| 104 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, | 101 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, |
| 105 int gpu_host_id) { | 102 int gpu_host_id) { |
| 106 DCHECK(enable_compositing_); | |
| 107 // If accelerated surface buffers are getting swapped then we're not using | 103 // If accelerated surface buffers are getting swapped then we're not using |
| 108 // the software path. | 104 // the software path. |
| 109 guest_->clear_damage_buffer(); | 105 guest_->clear_damage_buffer(); |
| 110 if (enable_compositing_) { | 106 guest_->SendMessageToEmbedder( |
| 111 guest_->SendMessageToEmbedder( | 107 new BrowserPluginMsg_BuffersSwapped( |
| 112 new BrowserPluginMsg_BuffersSwapped( | 108 guest_->instance_id(), |
| 113 guest_->instance_id(), | 109 params.size, |
| 114 params.size, | 110 params.mailbox_name, |
| 115 params.mailbox_name, | 111 params.route_id, |
| 116 params.route_id, | 112 gpu_host_id)); |
| 117 gpu_host_id)); | |
| 118 } | |
| 119 } | 113 } |
| 120 | 114 |
| 121 void RenderWidgetHostViewGuest::AcceleratedSurfacePostSubBuffer( | 115 void RenderWidgetHostViewGuest::AcceleratedSurfacePostSubBuffer( |
| 122 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, | 116 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, |
| 123 int gpu_host_id) { | 117 int gpu_host_id) { |
| 124 DCHECK(enable_compositing_); | 118 NOTREACHED(); |
| 125 if (enable_compositing_) { | |
| 126 guest_->SendMessageToEmbedder( | |
| 127 new BrowserPluginMsg_BuffersSwapped( | |
| 128 guest_->instance_id(), | |
| 129 params.surface_size, | |
| 130 params.mailbox_name, | |
| 131 params.route_id, | |
| 132 gpu_host_id)); | |
| 133 } | |
| 134 } | 119 } |
| 135 | 120 |
| 136 void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) { | 121 void RenderWidgetHostViewGuest::SetBounds(const gfx::Rect& rect) { |
| 137 platform_view_->SetBounds(rect); | 122 platform_view_->SetBounds(rect); |
| 138 } | 123 } |
| 139 | 124 |
| 140 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { | 125 bool RenderWidgetHostViewGuest::OnMessageReceived(const IPC::Message& msg) { |
| 141 return platform_view_->OnMessageReceived(msg); | 126 return platform_view_->OnMessageReceived(msg); |
| 142 } | 127 } |
| 143 | 128 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 } | 165 } |
| 181 | 166 |
| 182 void RenderWidgetHostViewGuest::Blur() { | 167 void RenderWidgetHostViewGuest::Blur() { |
| 183 } | 168 } |
| 184 | 169 |
| 185 bool RenderWidgetHostViewGuest::HasFocus() const { | 170 bool RenderWidgetHostViewGuest::HasFocus() const { |
| 186 return false; | 171 return false; |
| 187 } | 172 } |
| 188 | 173 |
| 189 bool RenderWidgetHostViewGuest::IsSurfaceAvailableForCopy() const { | 174 bool RenderWidgetHostViewGuest::IsSurfaceAvailableForCopy() const { |
| 190 DCHECK(enable_compositing_); | 175 NOTIMPLEMENTED(); |
| 191 if (enable_compositing_) | 176 return false; |
| 192 return true; | |
| 193 else | |
| 194 return platform_view_->IsSurfaceAvailableForCopy(); | |
| 195 } | 177 } |
| 196 | 178 |
| 197 void RenderWidgetHostViewGuest::UpdateCursor(const WebCursor& cursor) { | 179 void RenderWidgetHostViewGuest::UpdateCursor(const WebCursor& cursor) { |
| 198 platform_view_->UpdateCursor(cursor); | 180 platform_view_->UpdateCursor(cursor); |
| 199 } | 181 } |
| 200 | 182 |
| 201 void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) { | 183 void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) { |
| 202 platform_view_->SetIsLoading(is_loading); | 184 platform_view_->SetIsLoading(is_loading); |
| 203 } | 185 } |
| 204 | 186 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 | 240 |
| 259 void RenderWidgetHostViewGuest::AcceleratedSurfaceSuspend() { | 241 void RenderWidgetHostViewGuest::AcceleratedSurfaceSuspend() { |
| 260 NOTREACHED(); | 242 NOTREACHED(); |
| 261 } | 243 } |
| 262 | 244 |
| 263 void RenderWidgetHostViewGuest::AcceleratedSurfaceRelease() { | 245 void RenderWidgetHostViewGuest::AcceleratedSurfaceRelease() { |
| 264 } | 246 } |
| 265 | 247 |
| 266 bool RenderWidgetHostViewGuest::HasAcceleratedSurface( | 248 bool RenderWidgetHostViewGuest::HasAcceleratedSurface( |
| 267 const gfx::Size& desired_size) { | 249 const gfx::Size& desired_size) { |
| 268 DCHECK(enable_compositing_); | 250 return false; |
| 269 if (enable_compositing_) | |
| 270 return false; | |
| 271 else | |
| 272 return platform_view_->HasAcceleratedSurface(desired_size); | |
| 273 } | 251 } |
| 274 | 252 |
| 275 void RenderWidgetHostViewGuest::SetBackground(const SkBitmap& background) { | 253 void RenderWidgetHostViewGuest::SetBackground(const SkBitmap& background) { |
| 276 platform_view_->SetBackground(background); | 254 platform_view_->SetBackground(background); |
| 277 } | 255 } |
| 278 | 256 |
| 279 #if defined(OS_WIN) && !defined(USE_AURA) | 257 #if defined(OS_WIN) && !defined(USE_AURA) |
| 280 void RenderWidgetHostViewGuest::SetClickthroughRegion(SkRegion* region) { | 258 void RenderWidgetHostViewGuest::SetClickthroughRegion(SkRegion* region) { |
| 281 } | 259 } |
| 282 #endif | 260 #endif |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 void RenderWidgetHostViewGuest::WillWmDestroy() { | 371 void RenderWidgetHostViewGuest::WillWmDestroy() { |
| 394 } | 372 } |
| 395 #endif | 373 #endif |
| 396 | 374 |
| 397 void RenderWidgetHostViewGuest::DestroyGuestView() { | 375 void RenderWidgetHostViewGuest::DestroyGuestView() { |
| 398 host_ = NULL; | 376 host_ = NULL; |
| 399 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 377 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 400 } | 378 } |
| 401 | 379 |
| 402 } // namespace content | 380 } // namespace content |
| OLD | NEW |