Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(195)

Side by Side Diff: Source/testing/runner/TestPlugin.h

Issue 61773005: Rename WebKit namespace to blink (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/testing/runner/TestInterfaces.cpp ('k') | Source/testing/runner/TestPlugin.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 21 matching lines...) Expand all
32 #include "public/platform/WebNonCopyable.h" 32 #include "public/platform/WebNonCopyable.h"
33 #include "public/web/WebPlugin.h" 33 #include "public/web/WebPlugin.h"
34 #include "public/web/WebPluginContainer.h" 34 #include "public/web/WebPluginContainer.h"
35 #include <memory> 35 #include <memory>
36 #include <string> 36 #include <string>
37 37
38 namespace WebTestRunner { 38 namespace WebTestRunner {
39 39
40 class WebTestDelegate; 40 class WebTestDelegate;
41 41
42 // A fake implemention of WebKit::WebPlugin for testing purposes. 42 // A fake implemention of blink::WebPlugin for testing purposes.
43 // 43 //
44 // It uses WebGraphicsContext3D to paint a scene consisiting of a primitive 44 // It uses WebGraphicsContext3D to paint a scene consisiting of a primitive
45 // over a background. The primitive and background can be customized using 45 // over a background. The primitive and background can be customized using
46 // the following plugin parameters: 46 // the following plugin parameters:
47 // primitive: none (default), triangle. 47 // primitive: none (default), triangle.
48 // background-color: black (default), red, green, blue. 48 // background-color: black (default), red, green, blue.
49 // primitive-color: black (default), red, green, blue. 49 // primitive-color: black (default), red, green, blue.
50 // opacity: [0.0 - 1.0]. Default is 1.0. 50 // opacity: [0.0 - 1.0]. Default is 1.0.
51 // 51 //
52 // Whether the plugin accepts touch events or not can be customized using the 52 // Whether the plugin accepts touch events or not can be customized using the
53 // 'accepts-touch' plugin parameter (defaults to false). 53 // 'accepts-touch' plugin parameter (defaults to false).
54 class TestPlugin : public WebKit::WebPlugin, public WebKit::WebExternalTextureLa yerClient, public WebKit::WebNonCopyable { 54 class TestPlugin : public blink::WebPlugin, public blink::WebExternalTextureLaye rClient, public blink::WebNonCopyable {
55 public: 55 public:
56 static TestPlugin* create(WebKit::WebFrame*, const WebKit::WebPluginParams&, WebTestDelegate*); 56 static TestPlugin* create(blink::WebFrame*, const blink::WebPluginParams&, W ebTestDelegate*);
57 virtual ~TestPlugin(); 57 virtual ~TestPlugin();
58 58
59 static const WebKit::WebString& mimeType(); 59 static const blink::WebString& mimeType();
60 60
61 // WebPlugin methods: 61 // WebPlugin methods:
62 virtual bool initialize(WebKit::WebPluginContainer*); 62 virtual bool initialize(blink::WebPluginContainer*);
63 virtual void destroy(); 63 virtual void destroy();
64 virtual NPObject* scriptableObject() { return 0; } 64 virtual NPObject* scriptableObject() { return 0; }
65 virtual bool canProcessDrag() const { return m_canProcessDrag; } 65 virtual bool canProcessDrag() const { return m_canProcessDrag; }
66 virtual void paint(WebKit::WebCanvas*, const WebKit::WebRect&) { } 66 virtual void paint(blink::WebCanvas*, const blink::WebRect&) { }
67 virtual void updateGeometry(const WebKit::WebRect& frameRect, const WebKit:: WebRect& clipRect, const WebKit::WebVector<WebKit::WebRect>& cutOutsRects, bool isVisible); 67 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) { } 68 virtual void updateFocus(bool) { }
69 virtual void updateVisibility(bool) { } 69 virtual void updateVisibility(bool) { }
70 virtual bool acceptsInputEvents() { return true; } 70 virtual bool acceptsInputEvents() { return true; }
71 virtual bool handleInputEvent(const WebKit::WebInputEvent&, WebKit::WebCurso rInfo&); 71 virtual bool handleInputEvent(const blink::WebInputEvent&, blink::WebCursorI nfo&);
72 virtual bool handleDragStatusUpdate(WebKit::WebDragStatus, const WebKit::Web DragData&, WebKit::WebDragOperationsMask, const WebKit::WebPoint& position, cons t WebKit::WebPoint& screenPosition); 72 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 WebKit::WebURLResponse&) { } 73 virtual void didReceiveResponse(const blink::WebURLResponse&) { }
74 virtual void didReceiveData(const char* data, int dataLength) { } 74 virtual void didReceiveData(const char* data, int dataLength) { }
75 virtual void didFinishLoading() { } 75 virtual void didFinishLoading() { }
76 virtual void didFailLoading(const WebKit::WebURLError&) { } 76 virtual void didFailLoading(const blink::WebURLError&) { }
77 virtual void didFinishLoadingFrameRequest(const WebKit::WebURL&, void* notif yData) { } 77 virtual void didFinishLoadingFrameRequest(const blink::WebURL&, void* notify Data) { }
78 virtual void didFailLoadingFrameRequest(const WebKit::WebURL&, void* notifyD ata, const WebKit::WebURLError&) { } 78 virtual void didFailLoadingFrameRequest(const blink::WebURL&, void* notifyDa ta, const blink::WebURLError&) { }
79 virtual bool isPlaceholder() { return false; } 79 virtual bool isPlaceholder() { return false; }
80 80
81 // WebExternalTextureLayerClient methods: 81 // WebExternalTextureLayerClient methods:
82 virtual WebKit::WebGraphicsContext3D* context() { return 0; } 82 virtual blink::WebGraphicsContext3D* context() { return 0; }
83 virtual bool prepareMailbox(WebKit::WebExternalTextureMailbox*, WebKit::WebE xternalBitmap*); 83 virtual bool prepareMailbox(blink::WebExternalTextureMailbox*, blink::WebExt ernalBitmap*);
84 virtual void mailboxReleased(const WebKit::WebExternalTextureMailbox&); 84 virtual void mailboxReleased(const blink::WebExternalTextureMailbox&);
85 85
86 private: 86 private:
87 TestPlugin(WebKit::WebFrame*, const WebKit::WebPluginParams&, WebTestDelegat e*); 87 TestPlugin(blink::WebFrame*, const blink::WebPluginParams&, WebTestDelegate* );
88 88
89 enum Primitive { 89 enum Primitive {
90 PrimitiveNone, 90 PrimitiveNone,
91 PrimitiveTriangle 91 PrimitiveTriangle
92 }; 92 };
93 93
94 struct Scene { 94 struct Scene {
95 Primitive primitive; 95 Primitive primitive;
96 unsigned backgroundColor[3]; 96 unsigned backgroundColor[3];
97 unsigned primitiveColor[3]; 97 unsigned primitiveColor[3];
(...skipping 11 matching lines...) Expand all
109 , program(0) 109 , program(0)
110 , colorLocation(-1) 110 , colorLocation(-1)
111 , positionLocation(-1) 111 , positionLocation(-1)
112 { 112 {
113 backgroundColor[0] = backgroundColor[1] = backgroundColor[2] = 0; 113 backgroundColor[0] = backgroundColor[1] = backgroundColor[2] = 0;
114 primitiveColor[0] = primitiveColor[1] = primitiveColor[2] = 0; 114 primitiveColor[0] = primitiveColor[1] = primitiveColor[2] = 0;
115 } 115 }
116 }; 116 };
117 117
118 // Functions for parsing plugin parameters. 118 // Functions for parsing plugin parameters.
119 Primitive parsePrimitive(const WebKit::WebString&); 119 Primitive parsePrimitive(const blink::WebString&);
120 void parseColor(const WebKit::WebString&, unsigned color[3]); 120 void parseColor(const blink::WebString&, unsigned color[3]);
121 float parseOpacity(const WebKit::WebString&); 121 float parseOpacity(const blink::WebString&);
122 bool parseBoolean(const WebKit::WebString&); 122 bool parseBoolean(const blink::WebString&);
123 123
124 // Functions for loading and drawing scene. 124 // Functions for loading and drawing scene.
125 bool initScene(); 125 bool initScene();
126 void drawScene(); 126 void drawScene();
127 void destroyScene(); 127 void destroyScene();
128 bool initProgram(); 128 bool initProgram();
129 bool initPrimitive(); 129 bool initPrimitive();
130 void drawPrimitive(); 130 void drawPrimitive();
131 unsigned loadShader(unsigned type, const std::string& source); 131 unsigned loadShader(unsigned type, const std::string& source);
132 unsigned loadProgram(const std::string& vertexSource, const std::string& fra gmentSource); 132 unsigned loadProgram(const std::string& vertexSource, const std::string& fra gmentSource);
133 133
134 WebKit::WebFrame* m_frame; 134 blink::WebFrame* m_frame;
135 WebTestDelegate* m_delegate; 135 WebTestDelegate* m_delegate;
136 WebKit::WebPluginContainer* m_container; 136 blink::WebPluginContainer* m_container;
137 137
138 WebKit::WebRect m_rect; 138 blink::WebRect m_rect;
139 WebKit::WebGraphicsContext3D* m_context; 139 blink::WebGraphicsContext3D* m_context;
140 unsigned m_colorTexture; 140 unsigned m_colorTexture;
141 WebKit::WebExternalTextureMailbox m_mailbox; 141 blink::WebExternalTextureMailbox m_mailbox;
142 bool m_mailboxChanged; 142 bool m_mailboxChanged;
143 unsigned m_framebuffer; 143 unsigned m_framebuffer;
144 Scene m_scene; 144 Scene m_scene;
145 std::auto_ptr<WebKit::WebExternalTextureLayer> m_layer; 145 std::auto_ptr<blink::WebExternalTextureLayer> m_layer;
146 146
147 WebKit::WebPluginContainer::TouchEventRequestType m_touchEventRequest; 147 blink::WebPluginContainer::TouchEventRequestType m_touchEventRequest;
148 // Requests touch events from the WebPluginContainerImpl multiple times to t ickle webkit.org/b/108381 148 // Requests touch events from the WebPluginContainerImpl multiple times to t ickle webkit.org/b/108381
149 bool m_reRequestTouchEvents; 149 bool m_reRequestTouchEvents;
150 bool m_printEventDetails; 150 bool m_printEventDetails;
151 bool m_printUserGestureStatus; 151 bool m_printUserGestureStatus;
152 bool m_canProcessDrag; 152 bool m_canProcessDrag;
153 }; 153 };
154 154
155 } 155 }
156 156
157 #endif // TestPlugin_h 157 #endif // TestPlugin_h
OLDNEW
« no previous file with comments | « Source/testing/runner/TestInterfaces.cpp ('k') | Source/testing/runner/TestPlugin.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698