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 #include "content/shell/test_runner/test_plugin.h" | 5 #include "content/shell/test_runner/test_plugin.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" | 23 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" |
24 #include "third_party/WebKit/public/platform/WebGestureEvent.h" | 24 #include "third_party/WebKit/public/platform/WebGestureEvent.h" |
25 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" | 25 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" |
26 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 26 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
27 #include "third_party/WebKit/public/platform/WebMouseEvent.h" | 27 #include "third_party/WebKit/public/platform/WebMouseEvent.h" |
28 #include "third_party/WebKit/public/platform/WebThread.h" | 28 #include "third_party/WebKit/public/platform/WebThread.h" |
29 #include "third_party/WebKit/public/platform/WebTouchEvent.h" | 29 #include "third_party/WebKit/public/platform/WebTouchEvent.h" |
30 #include "third_party/WebKit/public/platform/WebTouchPoint.h" | 30 #include "third_party/WebKit/public/platform/WebTouchPoint.h" |
31 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 31 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
32 #include "third_party/WebKit/public/platform/WebURL.h" | 32 #include "third_party/WebKit/public/platform/WebURL.h" |
33 #include "third_party/WebKit/public/web/WebFrame.h" | |
34 #include "third_party/WebKit/public/web/WebKit.h" | 33 #include "third_party/WebKit/public/web/WebKit.h" |
35 #include "third_party/WebKit/public/web/WebPluginParams.h" | 34 #include "third_party/WebKit/public/web/WebPluginParams.h" |
36 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 35 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
37 #include "third_party/skia/include/core/SkBitmap.h" | 36 #include "third_party/skia/include/core/SkBitmap.h" |
38 #include "third_party/skia/include/core/SkCanvas.h" | 37 #include "third_party/skia/include/core/SkCanvas.h" |
39 #include "third_party/skia/include/core/SkColor.h" | 38 #include "third_party/skia/include/core/SkColor.h" |
40 #include "third_party/skia/include/core/SkPaint.h" | 39 #include "third_party/skia/include/core/SkPaint.h" |
41 #include "third_party/skia/include/core/SkPath.h" | 40 #include "third_party/skia/include/core/SkPath.h" |
42 | 41 |
43 namespace test_runner { | 42 namespace test_runner { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 const blink::WebString& string) { | 102 const blink::WebString& string) { |
104 if (string == blink::WebString::FromUTF8("raw")) | 103 if (string == blink::WebString::FromUTF8("raw")) |
105 return blink::WebPluginContainer::kTouchEventRequestTypeRaw; | 104 return blink::WebPluginContainer::kTouchEventRequestTypeRaw; |
106 if (string == blink::WebString::FromUTF8("synthetic")) | 105 if (string == blink::WebString::FromUTF8("synthetic")) |
107 return blink::WebPluginContainer::kTouchEventRequestTypeSynthesizedMouse; | 106 return blink::WebPluginContainer::kTouchEventRequestTypeSynthesizedMouse; |
108 return blink::WebPluginContainer::kTouchEventRequestTypeNone; | 107 return blink::WebPluginContainer::kTouchEventRequestTypeNone; |
109 } | 108 } |
110 | 109 |
111 } // namespace | 110 } // namespace |
112 | 111 |
113 TestPlugin::TestPlugin(blink::WebFrame* frame, | 112 TestPlugin::TestPlugin(const blink::WebPluginParams& params, |
114 const blink::WebPluginParams& params, | |
115 WebTestDelegate* delegate) | 113 WebTestDelegate* delegate) |
116 : frame_(frame), | 114 : delegate_(delegate), |
117 delegate_(delegate), | |
118 container_(nullptr), | 115 container_(nullptr), |
119 gl_(nullptr), | 116 gl_(nullptr), |
120 color_texture_(0), | 117 color_texture_(0), |
121 mailbox_changed_(false), | 118 mailbox_changed_(false), |
122 framebuffer_(0), | 119 framebuffer_(0), |
123 touch_event_request_( | 120 touch_event_request_( |
124 blink::WebPluginContainer::kTouchEventRequestTypeNone), | 121 blink::WebPluginContainer::kTouchEventRequestTypeNone), |
125 re_request_touch_events_(false), | 122 re_request_touch_events_(false), |
126 print_event_details_(false), | 123 print_event_details_(false), |
127 print_user_gesture_status_(false), | 124 print_user_gesture_status_(false), |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 if (container_) | 202 if (container_) |
206 container_->SetWebLayer(0); | 203 container_->SetWebLayer(0); |
207 web_layer_.reset(); | 204 web_layer_.reset(); |
208 layer_ = NULL; | 205 layer_ = NULL; |
209 DestroyScene(); | 206 DestroyScene(); |
210 | 207 |
211 gl_ = nullptr; | 208 gl_ = nullptr; |
212 context_provider_.reset(); | 209 context_provider_.reset(); |
213 | 210 |
214 container_ = nullptr; | 211 container_ = nullptr; |
215 frame_ = nullptr; | |
216 | 212 |
217 blink::Platform::Current() | 213 blink::Platform::Current() |
218 ->MainThread() | 214 ->MainThread() |
219 ->GetSingleThreadTaskRunner() | 215 ->GetSingleThreadTaskRunner() |
220 ->DeleteSoon(FROM_HERE, this); | 216 ->DeleteSoon(FROM_HERE, this); |
221 } | 217 } |
222 | 218 |
223 blink::WebPluginContainer* TestPlugin::Container() const { | 219 blink::WebPluginContainer* TestPlugin::Container() const { |
224 return container_; | 220 return container_; |
225 } | 221 } |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 drag_status_name = "DragDrop"; | 576 drag_status_name = "DragDrop"; |
581 break; | 577 break; |
582 case blink::kWebDragStatusUnknown: | 578 case blink::kWebDragStatusUnknown: |
583 NOTREACHED(); | 579 NOTREACHED(); |
584 } | 580 } |
585 delegate_->PrintMessage(std::string("Plugin received event: ") + | 581 delegate_->PrintMessage(std::string("Plugin received event: ") + |
586 drag_status_name + "\n"); | 582 drag_status_name + "\n"); |
587 return false; | 583 return false; |
588 } | 584 } |
589 | 585 |
590 TestPlugin* TestPlugin::create(blink::WebFrame* frame, | 586 TestPlugin* TestPlugin::Create(const blink::WebPluginParams& params, |
591 const blink::WebPluginParams& params, | |
592 WebTestDelegate* delegate) { | 587 WebTestDelegate* delegate) { |
593 return new TestPlugin(frame, params, delegate); | 588 return new TestPlugin(params, delegate); |
594 } | 589 } |
595 | 590 |
596 const blink::WebString& TestPlugin::MimeType() { | 591 const blink::WebString& TestPlugin::MimeType() { |
597 const CR_DEFINE_STATIC_LOCAL(blink::WebString, kMimeType, | 592 const CR_DEFINE_STATIC_LOCAL(blink::WebString, kMimeType, |
598 ("application/x-webkit-test-webplugin")); | 593 ("application/x-webkit-test-webplugin")); |
599 return kMimeType; | 594 return kMimeType; |
600 } | 595 } |
601 | 596 |
602 const blink::WebString& TestPlugin::CanCreateWithoutRendererMimeType() { | 597 const blink::WebString& TestPlugin::CanCreateWithoutRendererMimeType() { |
603 const CR_DEFINE_STATIC_LOCAL( | 598 const CR_DEFINE_STATIC_LOCAL( |
604 blink::WebString, kCanCreateWithoutRendererMimeType, | 599 blink::WebString, kCanCreateWithoutRendererMimeType, |
605 ("application/x-webkit-test-webplugin-can-create-without-renderer")); | 600 ("application/x-webkit-test-webplugin-can-create-without-renderer")); |
606 return kCanCreateWithoutRendererMimeType; | 601 return kCanCreateWithoutRendererMimeType; |
607 } | 602 } |
608 | 603 |
609 const blink::WebString& TestPlugin::PluginPersistsMimeType() { | 604 const blink::WebString& TestPlugin::PluginPersistsMimeType() { |
610 const CR_DEFINE_STATIC_LOCAL( | 605 const CR_DEFINE_STATIC_LOCAL( |
611 blink::WebString, kPluginPersistsMimeType, | 606 blink::WebString, kPluginPersistsMimeType, |
612 ("application/x-webkit-test-webplugin-persistent")); | 607 ("application/x-webkit-test-webplugin-persistent")); |
613 return kPluginPersistsMimeType; | 608 return kPluginPersistsMimeType; |
614 } | 609 } |
615 | 610 |
616 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 611 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
617 return mime_type == TestPlugin::MimeType() || | 612 return mime_type == TestPlugin::MimeType() || |
618 mime_type == PluginPersistsMimeType() || | 613 mime_type == PluginPersistsMimeType() || |
619 mime_type == CanCreateWithoutRendererMimeType(); | 614 mime_type == CanCreateWithoutRendererMimeType(); |
620 } | 615 } |
621 | 616 |
622 } // namespace test_runner | 617 } // namespace test_runner |
OLD | NEW |