| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 5 #ifndef COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
| 6 #define COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 6 #define COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "cc/layers/texture_layer.h" | 12 #include "cc/layers/texture_layer.h" |
| 13 #include "cc/layers/texture_layer_client.h" | 13 #include "cc/layers/texture_layer_client.h" |
| 14 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" | 14 #include "third_party/WebKit/public/platform/WebExternalTextureLayer.h" |
| 15 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" | 15 #include "third_party/WebKit/public/platform/WebExternalTextureLayerClient.h" |
| 16 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" | 16 #include "third_party/WebKit/public/platform/WebExternalTextureMailbox.h" |
| 17 #include "third_party/WebKit/public/platform/WebLayer.h" | 17 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 18 #include "third_party/WebKit/public/web/WebPlugin.h" | 18 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 19 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 19 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 20 #include "third_party/khronos/GLES2/gl2.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| 22 class WebFrame; | 23 class WebFrame; |
| 23 class WebGraphicsContext3D; | 24 class WebGraphicsContext3D; |
| 24 class WebGraphicsContext3DProvider; | 25 class WebGraphicsContext3DProvider; |
| 25 class WebLayer; | 26 class WebLayer; |
| 26 struct WebPluginParams; | 27 struct WebPluginParams; |
| 27 } | 28 } |
| 28 | 29 |
| 29 namespace cc { | 30 namespace cc { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 private: | 104 private: |
| 104 TestPlugin(blink::WebFrame* frame, | 105 TestPlugin(blink::WebFrame* frame, |
| 105 const blink::WebPluginParams& params, | 106 const blink::WebPluginParams& params, |
| 106 WebTestDelegate* delegate); | 107 WebTestDelegate* delegate); |
| 107 | 108 |
| 108 enum Primitive { PrimitiveNone, PrimitiveTriangle }; | 109 enum Primitive { PrimitiveNone, PrimitiveTriangle }; |
| 109 | 110 |
| 110 struct Scene { | 111 struct Scene { |
| 111 Primitive primitive; | 112 Primitive primitive; |
| 112 unsigned background_color[3]; | 113 uint8_t background_color[3]; |
| 113 unsigned primitive_color[3]; | 114 uint8_t primitive_color[3]; |
| 114 float opacity; | 115 float opacity; |
| 115 | 116 |
| 116 unsigned vbo; | 117 GLuint vbo; |
| 117 unsigned program; | 118 GLuint program; |
| 118 int color_location; | 119 int color_location; |
| 119 int position_location; | 120 int position_location; |
| 120 | 121 |
| 121 Scene() | 122 Scene() |
| 122 : primitive(PrimitiveNone), | 123 : primitive(PrimitiveNone), |
| 123 opacity(1.0f) // Fully opaque. | 124 opacity(1.0f) // Fully opaque. |
| 124 , | 125 , |
| 125 vbo(0), | 126 vbo(0), |
| 126 program(0), | 127 program(0), |
| 127 color_location(-1), | 128 color_location(-1), |
| 128 position_location(-1) { | 129 position_location(-1) { |
| 129 background_color[0] = background_color[1] = background_color[2] = 0; | 130 background_color[0] = background_color[1] = background_color[2] = 0; |
| 130 primitive_color[0] = primitive_color[1] = primitive_color[2] = 0; | 131 primitive_color[0] = primitive_color[1] = primitive_color[2] = 0; |
| 131 } | 132 } |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 // Functions for parsing plugin parameters. | 135 // Functions for parsing plugin parameters. |
| 135 Primitive ParsePrimitive(const blink::WebString& string); | 136 Primitive ParsePrimitive(const blink::WebString& string); |
| 136 void ParseColor(const blink::WebString& string, unsigned color[3]); | 137 void ParseColor(const blink::WebString& string, uint8_t color[3]); |
| 137 float ParseOpacity(const blink::WebString& string); | 138 float ParseOpacity(const blink::WebString& string); |
| 138 bool ParseBoolean(const blink::WebString& string); | 139 bool ParseBoolean(const blink::WebString& string); |
| 139 | 140 |
| 140 // Functions for loading and drawing scene in GL. | 141 // Functions for loading and drawing scene in GL. |
| 141 bool InitScene(); | 142 bool InitScene(); |
| 142 void DrawSceneGL(); | 143 void DrawSceneGL(); |
| 143 void DestroyScene(); | 144 void DestroyScene(); |
| 144 bool InitProgram(); | 145 bool InitProgram(); |
| 145 bool InitPrimitive(); | 146 bool InitPrimitive(); |
| 146 void DrawPrimitive(); | 147 void DrawPrimitive(); |
| 147 unsigned LoadShader(unsigned type, const std::string& source); | 148 GLuint LoadShader(GLenum type, const std::string& source); |
| 148 unsigned LoadProgram(const std::string& vertex_source, | 149 GLuint LoadProgram(const std::string& vertex_source, |
| 149 const std::string& fragment_source); | 150 const std::string& fragment_source); |
| 150 | 151 |
| 151 // Functions for drawing scene in Software. | 152 // Functions for drawing scene in Software. |
| 152 void DrawSceneSoftware(void* memory); | 153 void DrawSceneSoftware(void* memory); |
| 153 | 154 |
| 154 blink::WebFrame* frame_; | 155 blink::WebFrame* frame_; |
| 155 WebTestDelegate* delegate_; | 156 WebTestDelegate* delegate_; |
| 156 blink::WebPluginContainer* container_; | 157 blink::WebPluginContainer* container_; |
| 157 | 158 |
| 158 blink::WebRect rect_; | 159 blink::WebRect rect_; |
| 159 scoped_ptr<blink::WebGraphicsContext3DProvider> context_provider_; | 160 scoped_ptr<blink::WebGraphicsContext3DProvider> context_provider_; |
| 160 blink::WebGraphicsContext3D* context_; | 161 blink::WebGraphicsContext3D* context_; |
| 161 gpu::gles2::GLES2Interface* gl_; | 162 gpu::gles2::GLES2Interface* gl_; |
| 162 unsigned color_texture_; | 163 GLuint color_texture_; |
| 163 cc::TextureMailbox texture_mailbox_; | 164 cc::TextureMailbox texture_mailbox_; |
| 164 scoped_ptr<cc::SharedBitmap> shared_bitmap_; | 165 scoped_ptr<cc::SharedBitmap> shared_bitmap_; |
| 165 bool mailbox_changed_; | 166 bool mailbox_changed_; |
| 166 unsigned framebuffer_; | 167 GLuint framebuffer_; |
| 167 Scene scene_; | 168 Scene scene_; |
| 168 scoped_refptr<cc::TextureLayer> layer_; | 169 scoped_refptr<cc::TextureLayer> layer_; |
| 169 scoped_ptr<blink::WebLayer> web_layer_; | 170 scoped_ptr<blink::WebLayer> web_layer_; |
| 170 | 171 |
| 171 blink::WebPluginContainer::TouchEventRequestType touch_event_request_; | 172 blink::WebPluginContainer::TouchEventRequestType touch_event_request_; |
| 172 // Requests touch events from the WebPluginContainerImpl multiple times to | 173 // Requests touch events from the WebPluginContainerImpl multiple times to |
| 173 // tickle webkit.org/b/108381 | 174 // tickle webkit.org/b/108381 |
| 174 bool re_request_touch_events_; | 175 bool re_request_touch_events_; |
| 175 bool print_event_details_; | 176 bool print_event_details_; |
| 176 bool print_user_gesture_status_; | 177 bool print_user_gesture_status_; |
| 177 bool can_process_drag_; | 178 bool can_process_drag_; |
| 178 bool supports_keyboard_focus_; | 179 bool supports_keyboard_focus_; |
| 179 | 180 |
| 180 bool is_persistent_; | 181 bool is_persistent_; |
| 181 bool can_create_without_renderer_; | 182 bool can_create_without_renderer_; |
| 182 | 183 |
| 183 DISALLOW_COPY_AND_ASSIGN(TestPlugin); | 184 DISALLOW_COPY_AND_ASSIGN(TestPlugin); |
| 184 }; | 185 }; |
| 185 | 186 |
| 186 } // namespace test_runner | 187 } // namespace test_runner |
| 187 | 188 |
| 188 #endif // COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ | 189 #endif // COMPONENTS_TEST_RUNNER_TEST_PLUGIN_H_ |
| OLD | NEW |