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