OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "public/platform/WebExternalTextureLayer.h" | 29 #include "public/platform/WebExternalTextureLayer.h" |
30 #include "public/platform/WebExternalTextureLayerClient.h" | 30 #include "public/platform/WebExternalTextureLayerClient.h" |
31 #include "public/platform/WebExternalTextureMailbox.h" | 31 #include "public/platform/WebExternalTextureMailbox.h" |
32 #include "public/platform/WebNonCopyable.h" | 32 #include "public/platform/WebNonCopyable.h" |
33 #include "public/testing/WebScopedPtr.h" | 33 #include "public/testing/WebScopedPtr.h" |
34 #include "public/web/WebPlugin.h" | 34 #include "public/web/WebPlugin.h" |
35 #include "public/web/WebPluginContainer.h" | 35 #include "public/web/WebPluginContainer.h" |
36 #include <string> | 36 #include <string> |
37 | 37 |
| 38 struct _NPP; |
| 39 |
38 namespace WebTestRunner { | 40 namespace WebTestRunner { |
39 | 41 |
40 class WebTestDelegate; | 42 class WebTestDelegate; |
41 | 43 |
42 // A fake implemention of blink::WebPlugin for testing purposes. | 44 // A fake implemention of blink::WebPlugin for testing purposes. |
43 // | 45 // |
44 // It uses WebGraphicsContext3D to paint a scene consisiting of a primitive | 46 // It uses WebGraphicsContext3D to paint a scene consisiting of a primitive |
45 // over a background. The primitive and background can be customized using | 47 // over a background. The primitive and background can be customized using |
46 // the following plugin parameters: | 48 // the following plugin parameters: |
47 // primitive: none (default), triangle. | 49 // primitive: none (default), triangle. |
48 // background-color: black (default), red, green, blue. | 50 // background-color: black (default), red, green, blue. |
49 // primitive-color: black (default), red, green, blue. | 51 // primitive-color: black (default), red, green, blue. |
50 // opacity: [0.0 - 1.0]. Default is 1.0. | 52 // opacity: [0.0 - 1.0]. Default is 1.0. |
51 // | 53 // |
52 // Whether the plugin accepts touch events or not can be customized using the | 54 // Whether the plugin accepts touch events or not can be customized using the |
53 // 'accepts-touch' plugin parameter (defaults to false). | 55 // 'accepts-touch' plugin parameter (defaults to false). |
54 class TestPlugin : public blink::WebPlugin, public blink::WebExternalTextureLaye
rClient, public blink::WebNonCopyable { | 56 class TestPlugin : public blink::WebPlugin, public blink::WebExternalTextureLaye
rClient, public blink::WebNonCopyable { |
55 public: | 57 public: |
56 static TestPlugin* create(blink::WebFrame*, const blink::WebPluginParams&, W
ebTestDelegate*); | 58 static TestPlugin* create(blink::WebFrame*, const blink::WebPluginParams&, W
ebTestDelegate*); |
57 virtual ~TestPlugin(); | 59 virtual ~TestPlugin(); |
58 | 60 |
59 static const blink::WebString& mimeType(); | 61 static const blink::WebString& mimeType(); |
| 62 static const blink::WebString& canCreateWithoutRendererSuffix(); |
| 63 static const blink::WebString& pluginPersistsSuffix(); |
| 64 |
| 65 uint32 instanceId() const { return m_instanceId; } |
| 66 bool isPersistent() const { return m_isPersistent; } |
| 67 bool canCreateWithoutRenderer() const { return m_canCreateWithoutRenderer; } |
60 | 68 |
61 // WebPlugin methods: | 69 // WebPlugin methods: |
62 virtual bool initialize(blink::WebPluginContainer*); | 70 virtual bool initialize(blink::WebPluginContainer*); |
63 virtual void destroy(); | 71 virtual void destroy(); |
64 virtual NPObject* scriptableObject() { return 0; } | 72 virtual NPObject* scriptableObject(); |
| 73 virtual struct _NPP* pluginNPP() { return m_NPP.get(); } |
65 virtual bool canProcessDrag() const { return m_canProcessDrag; } | 74 virtual bool canProcessDrag() const { return m_canProcessDrag; } |
66 virtual void paint(blink::WebCanvas*, const blink::WebRect&) { } | 75 virtual void paint(blink::WebCanvas*, const blink::WebRect&) { } |
67 virtual void updateGeometry(const blink::WebRect& frameRect, const blink::We
bRect& clipRect, const blink::WebVector<blink::WebRect>& cutOutsRects, bool isVi
sible); | 76 virtual void updateGeometry(const blink::WebRect& frameRect, const blink::We
bRect& clipRect, const blink::WebVector<blink::WebRect>& cutOutsRects, bool isVi
sible); |
68 virtual void updateFocus(bool) { } | 77 virtual void updateFocus(bool) { } |
69 virtual void updateVisibility(bool) { } | 78 virtual void updateVisibility(bool) { } |
70 virtual bool acceptsInputEvents() { return true; } | 79 virtual bool acceptsInputEvents() { return true; } |
71 virtual bool handleInputEvent(const blink::WebInputEvent&, blink::WebCursorI
nfo&); | 80 virtual bool handleInputEvent(const blink::WebInputEvent&, blink::WebCursorI
nfo&); |
72 virtual bool handleDragStatusUpdate(blink::WebDragStatus, const blink::WebDr
agData&, blink::WebDragOperationsMask, const blink::WebPoint& position, const bl
ink::WebPoint& screenPosition); | 81 virtual bool handleDragStatusUpdate(blink::WebDragStatus, const blink::WebDr
agData&, blink::WebDragOperationsMask, const blink::WebPoint& position, const bl
ink::WebPoint& screenPosition); |
73 virtual void didReceiveResponse(const blink::WebURLResponse&) { } | 82 virtual void didReceiveResponse(const blink::WebURLResponse&) { } |
74 virtual void didReceiveData(const char* data, int dataLength) { } | 83 virtual void didReceiveData(const char* data, int dataLength) { } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 unsigned m_framebuffer; | 152 unsigned m_framebuffer; |
144 Scene m_scene; | 153 Scene m_scene; |
145 WebScopedPtr<blink::WebExternalTextureLayer> m_layer; | 154 WebScopedPtr<blink::WebExternalTextureLayer> m_layer; |
146 | 155 |
147 blink::WebPluginContainer::TouchEventRequestType m_touchEventRequest; | 156 blink::WebPluginContainer::TouchEventRequestType m_touchEventRequest; |
148 // Requests touch events from the WebPluginContainerImpl multiple times to t
ickle webkit.org/b/108381 | 157 // Requests touch events from the WebPluginContainerImpl multiple times to t
ickle webkit.org/b/108381 |
149 bool m_reRequestTouchEvents; | 158 bool m_reRequestTouchEvents; |
150 bool m_printEventDetails; | 159 bool m_printEventDetails; |
151 bool m_printUserGestureStatus; | 160 bool m_printUserGestureStatus; |
152 bool m_canProcessDrag; | 161 bool m_canProcessDrag; |
| 162 |
| 163 NPObject* m_npObject; |
| 164 WebScopedPtr<_NPP> m_NPP; |
| 165 uint32 m_instanceId; |
| 166 bool m_isPersistent; |
| 167 bool m_canCreateWithoutRenderer; |
153 }; | 168 }; |
154 | 169 |
155 } | 170 } |
156 | 171 |
157 #endif // TestPlugin_h | 172 #endif // TestPlugin_h |
OLD | NEW |