| 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 CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ | 5 #ifndef CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ |
| 6 #define CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ | 6 #define CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.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/WebLayer.h" | 14 #include "third_party/WebKit/public/platform/WebLayer.h" |
| 15 #include "third_party/WebKit/public/web/WebDocument.h" | 15 #include "third_party/WebKit/public/web/WebDocument.h" |
| 16 #include "third_party/WebKit/public/web/WebElement.h" | 16 #include "third_party/WebKit/public/web/WebElement.h" |
| 17 #include "third_party/WebKit/public/web/WebPlugin.h" | 17 #include "third_party/WebKit/public/web/WebPlugin.h" |
| 18 #include "third_party/WebKit/public/web/WebPluginContainer.h" | 18 #include "third_party/WebKit/public/web/WebPluginContainer.h" |
| 19 #include "third_party/khronos/GLES2/gl2.h" | 19 #include "third_party/khronos/GLES2/gl2.h" |
| 20 | 20 |
| 21 namespace blink { | 21 namespace blink { |
| 22 class WebFrame; | |
| 23 class WebGraphicsContext3DProvider; | 22 class WebGraphicsContext3DProvider; |
| 24 class WebLayer; | 23 class WebLayer; |
| 25 struct WebPluginParams; | 24 struct WebPluginParams; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace cc { | 27 namespace cc { |
| 29 class SharedBitmap; | 28 class SharedBitmap; |
| 30 } | 29 } |
| 31 | 30 |
| 32 namespace gpu { | 31 namespace gpu { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 46 // parameters. | 45 // parameters. |
| 47 // primitive: none (default), triangle. | 46 // primitive: none (default), triangle. |
| 48 // background-color: black (default), red, green, blue. | 47 // background-color: black (default), red, green, blue. |
| 49 // primitive-color: black (default), red, green, blue. | 48 // primitive-color: black (default), red, green, blue. |
| 50 // opacity: [0.0 - 1.0]. Default is 1.0. | 49 // opacity: [0.0 - 1.0]. Default is 1.0. |
| 51 // | 50 // |
| 52 // Whether the plugin accepts touch events or not can be customized using the | 51 // Whether the plugin accepts touch events or not can be customized using the |
| 53 // 'accepts-touch' plugin parameter (defaults to false). | 52 // 'accepts-touch' plugin parameter (defaults to false). |
| 54 class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient { | 53 class TestPlugin : public blink::WebPlugin, public cc::TextureLayerClient { |
| 55 public: | 54 public: |
| 56 static TestPlugin* create(blink::WebFrame* frame, | 55 static TestPlugin* Create(const blink::WebPluginParams& params, |
| 57 const blink::WebPluginParams& params, | |
| 58 WebTestDelegate* delegate); | 56 WebTestDelegate* delegate); |
| 59 ~TestPlugin() override; | 57 ~TestPlugin() override; |
| 60 | 58 |
| 61 static const blink::WebString& MimeType(); | 59 static const blink::WebString& MimeType(); |
| 62 static const blink::WebString& CanCreateWithoutRendererMimeType(); | 60 static const blink::WebString& CanCreateWithoutRendererMimeType(); |
| 63 static const blink::WebString& PluginPersistsMimeType(); | 61 static const blink::WebString& PluginPersistsMimeType(); |
| 64 static bool IsSupportedMimeType(const blink::WebString& mime_type); | 62 static bool IsSupportedMimeType(const blink::WebString& mime_type); |
| 65 | 63 |
| 66 // WebPlugin methods: | 64 // WebPlugin methods: |
| 67 bool Initialize(blink::WebPluginContainer* container) override; | 65 bool Initialize(blink::WebPluginContainer* container) override; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 91 void DidFinishLoading() override {} | 89 void DidFinishLoading() override {} |
| 92 void DidFailLoading(const blink::WebURLError& error) override {} | 90 void DidFailLoading(const blink::WebURLError& error) override {} |
| 93 bool IsPlaceholder() override; | 91 bool IsPlaceholder() override; |
| 94 | 92 |
| 95 // cc::TextureLayerClient methods: | 93 // cc::TextureLayerClient methods: |
| 96 bool PrepareTextureMailbox( | 94 bool PrepareTextureMailbox( |
| 97 cc::TextureMailbox* mailbox, | 95 cc::TextureMailbox* mailbox, |
| 98 std::unique_ptr<cc::SingleReleaseCallback>* release_callback) override; | 96 std::unique_ptr<cc::SingleReleaseCallback>* release_callback) override; |
| 99 | 97 |
| 100 private: | 98 private: |
| 101 TestPlugin(blink::WebFrame* frame, | 99 TestPlugin(const blink::WebPluginParams& params, WebTestDelegate* delegate); |
| 102 const blink::WebPluginParams& params, | |
| 103 WebTestDelegate* delegate); | |
| 104 | 100 |
| 105 enum Primitive { PrimitiveNone, PrimitiveTriangle }; | 101 enum Primitive { PrimitiveNone, PrimitiveTriangle }; |
| 106 | 102 |
| 107 struct Scene { | 103 struct Scene { |
| 108 Primitive primitive; | 104 Primitive primitive; |
| 109 uint8_t background_color[3]; | 105 uint8_t background_color[3]; |
| 110 uint8_t primitive_color[3]; | 106 uint8_t primitive_color[3]; |
| 111 float opacity; | 107 float opacity; |
| 112 | 108 |
| 113 GLuint vbo; | 109 GLuint vbo; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 141 bool InitProgram(); | 137 bool InitProgram(); |
| 142 bool InitPrimitive(); | 138 bool InitPrimitive(); |
| 143 void DrawPrimitive(); | 139 void DrawPrimitive(); |
| 144 GLuint LoadShader(GLenum type, const std::string& source); | 140 GLuint LoadShader(GLenum type, const std::string& source); |
| 145 GLuint LoadProgram(const std::string& vertex_source, | 141 GLuint LoadProgram(const std::string& vertex_source, |
| 146 const std::string& fragment_source); | 142 const std::string& fragment_source); |
| 147 | 143 |
| 148 // Functions for drawing scene in Software. | 144 // Functions for drawing scene in Software. |
| 149 void DrawSceneSoftware(void* memory); | 145 void DrawSceneSoftware(void* memory); |
| 150 | 146 |
| 151 blink::WebFrame* frame_; | |
| 152 WebTestDelegate* delegate_; | 147 WebTestDelegate* delegate_; |
| 153 blink::WebPluginContainer* container_; | 148 blink::WebPluginContainer* container_; |
| 154 | 149 |
| 155 blink::WebRect rect_; | 150 blink::WebRect rect_; |
| 156 std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_; | 151 std::unique_ptr<blink::WebGraphicsContext3DProvider> context_provider_; |
| 157 gpu::gles2::GLES2Interface* gl_; | 152 gpu::gles2::GLES2Interface* gl_; |
| 158 GLuint color_texture_; | 153 GLuint color_texture_; |
| 159 cc::TextureMailbox texture_mailbox_; | 154 cc::TextureMailbox texture_mailbox_; |
| 160 std::unique_ptr<cc::SharedBitmap> shared_bitmap_; | 155 std::unique_ptr<cc::SharedBitmap> shared_bitmap_; |
| 161 bool mailbox_changed_; | 156 bool mailbox_changed_; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 175 | 170 |
| 176 bool is_persistent_; | 171 bool is_persistent_; |
| 177 bool can_create_without_renderer_; | 172 bool can_create_without_renderer_; |
| 178 | 173 |
| 179 DISALLOW_COPY_AND_ASSIGN(TestPlugin); | 174 DISALLOW_COPY_AND_ASSIGN(TestPlugin); |
| 180 }; | 175 }; |
| 181 | 176 |
| 182 } // namespace test_runner | 177 } // namespace test_runner |
| 183 | 178 |
| 184 #endif // CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ | 179 #endif // CONTENT_SHELL_TEST_RUNNER_TEST_PLUGIN_H_ |
| OLD | NEW |