| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" | 38 #include "third_party/WebKit/WebKit/chromium/public/WebRect.h" |
| 39 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" | 39 #include "third_party/WebKit/WebKit/chromium/public/WebString.h" |
| 40 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" | 40 #include "third_party/WebKit/WebKit/chromium/public/WebURLRequest.h" |
| 41 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" | 41 #include "third_party/WebKit/WebKit/chromium/public/WebView.h" |
| 42 #include "webkit/plugins/ppapi/common.h" | 42 #include "webkit/plugins/ppapi/common.h" |
| 43 #include "webkit/plugins/ppapi/event_conversion.h" | 43 #include "webkit/plugins/ppapi/event_conversion.h" |
| 44 #include "webkit/plugins/ppapi/fullscreen_container.h" | 44 #include "webkit/plugins/ppapi/fullscreen_container.h" |
| 45 #include "webkit/plugins/ppapi/plugin_delegate.h" | 45 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 46 #include "webkit/plugins/ppapi/plugin_module.h" | 46 #include "webkit/plugins/ppapi/plugin_module.h" |
| 47 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" | 47 #include "webkit/plugins/ppapi/ppb_buffer_impl.h" |
| 48 #include "webkit/plugins/ppapi/ppb_context_3d_impl.h" |
| 48 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" | 49 #include "webkit/plugins/ppapi/ppb_graphics_2d_impl.h" |
| 49 #include "webkit/plugins/ppapi/ppb_graphics_3d_impl.h" | |
| 50 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" | 50 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" |
| 51 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" | 51 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" |
| 52 #include "webkit/plugins/ppapi/ppp_pdf.h" | 52 #include "webkit/plugins/ppapi/ppp_pdf.h" |
| 53 #include "webkit/plugins/ppapi/string.h" | 53 #include "webkit/plugins/ppapi/string.h" |
| 54 #include "webkit/plugins/ppapi/var.h" | 54 #include "webkit/plugins/ppapi/var.h" |
| 55 | 55 |
| 56 #if defined(OS_MACOSX) | 56 #if defined(OS_MACOSX) |
| 57 #include "base/mac_util.h" | 57 #include "base/mac_util.h" |
| 58 #include "base/mac/scoped_cftyperef.h" | 58 #include "base/mac/scoped_cftyperef.h" |
| 59 #endif | 59 #endif |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 bound_graphics_3d()->BindToInstance(NULL); | 434 bound_graphics_3d()->BindToInstance(NULL); |
| 435 } | 435 } |
| 436 InvalidateRect(gfx::Rect()); | 436 InvalidateRect(gfx::Rect()); |
| 437 } | 437 } |
| 438 bound_graphics_ = NULL; | 438 bound_graphics_ = NULL; |
| 439 return true; | 439 return true; |
| 440 } | 440 } |
| 441 | 441 |
| 442 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d = | 442 scoped_refptr<PPB_Graphics2D_Impl> graphics_2d = |
| 443 Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id); | 443 Resource::GetAs<PPB_Graphics2D_Impl>(graphics_id); |
| 444 scoped_refptr<PPB_Graphics3D_Impl> graphics_3d = | 444 scoped_refptr<PPB_Context3D_Impl> graphics_3d = |
| 445 Resource::GetAs<PPB_Graphics3D_Impl>(graphics_id); | 445 Resource::GetAs<PPB_Context3D_Impl>(graphics_id); |
| 446 | 446 |
| 447 if (graphics_2d) { | 447 if (graphics_2d) { |
| 448 if (!graphics_2d->BindToInstance(this)) | 448 if (!graphics_2d->BindToInstance(this)) |
| 449 return false; // Can't bind to more than one instance. | 449 return false; // Can't bind to more than one instance. |
| 450 | 450 |
| 451 // See http://crbug.com/49403: this can be further optimized by keeping the | 451 // See http://crbug.com/49403: this can be further optimized by keeping the |
| 452 // old device around and painting from it. | 452 // old device around and painting from it. |
| 453 if (bound_graphics_2d()) { | 453 if (bound_graphics_2d()) { |
| 454 // Start the new image with the content of the old image until the plugin | 454 // Start the new image with the content of the old image until the plugin |
| 455 // repaints. | 455 // repaints. |
| (...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1167 } | 1167 } |
| 1168 #endif // defined(OS_MACOSX) | 1168 #endif // defined(OS_MACOSX) |
| 1169 | 1169 |
| 1170 PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const { | 1170 PPB_Graphics2D_Impl* PluginInstance::bound_graphics_2d() const { |
| 1171 if (bound_graphics_.get() == NULL) | 1171 if (bound_graphics_.get() == NULL) |
| 1172 return NULL; | 1172 return NULL; |
| 1173 | 1173 |
| 1174 return bound_graphics_->Cast<PPB_Graphics2D_Impl>(); | 1174 return bound_graphics_->Cast<PPB_Graphics2D_Impl>(); |
| 1175 } | 1175 } |
| 1176 | 1176 |
| 1177 PPB_Graphics3D_Impl* PluginInstance::bound_graphics_3d() const { | 1177 PPB_Context3D_Impl* PluginInstance::bound_graphics_3d() const { |
| 1178 if (bound_graphics_.get() == NULL) | 1178 if (bound_graphics_.get() == NULL) |
| 1179 return NULL; | 1179 return NULL; |
| 1180 | 1180 |
| 1181 return bound_graphics_->Cast<PPB_Graphics3D_Impl>(); | 1181 return bound_graphics_->Cast<PPB_Context3D_Impl>(); |
| 1182 } | 1182 } |
| 1183 | 1183 |
| 1184 } // namespace ppapi | 1184 } // namespace ppapi |
| 1185 } // namespace webkit | 1185 } // namespace webkit |
| 1186 | 1186 |
| OLD | NEW |