Chromium Code Reviews| 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 "components/test_runner/test_plugin.h" | 5 #include "components/test_runner/test_plugin.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
| 14 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 15 #include "cc/blink/web_layer_impl.h" | 15 #include "cc/blink/web_layer_impl.h" |
| 16 #include "cc/layers/texture_layer.h" | 16 #include "cc/layers/texture_layer.h" |
| 17 #include "cc/resources/shared_bitmap_manager.h" | 17 #include "cc/resources/shared_bitmap_manager.h" |
| 18 #include "components/test_runner/web_test_delegate.h" | 18 #include "components/test_runner/web_test_delegate.h" |
| 19 #include "gpu/command_buffer/client/gles2_interface.h" | 19 #include "gpu/command_buffer/client/gles2_interface.h" |
| 20 #include "third_party/WebKit/public/platform/Platform.h" | 20 #include "third_party/WebKit/public/platform/Platform.h" |
| 21 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" | 21 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" |
| 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" | 22 #include "third_party/WebKit/public/platform/WebGraphicsContext3D.h" |
| 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" | 23 #include "third_party/WebKit/public/platform/WebGraphicsContext3DProvider.h" |
| 24 #include "third_party/WebKit/public/platform/WebTaskRunner.h" | 24 #include "third_party/WebKit/public/platform/WebTaskRunner.h" |
| 25 #include "third_party/WebKit/public/platform/WebThread.h" | 25 #include "third_party/WebKit/public/platform/WebThread.h" |
| 26 #include "third_party/WebKit/public/platform/WebTraceLocation.h" | 26 #include "third_party/WebKit/public/platform/WebTraceLocation.h" |
| 27 #include "third_party/WebKit/public/platform/WebURL.h" | |
| 27 #include "third_party/WebKit/public/web/WebFrame.h" | 28 #include "third_party/WebKit/public/web/WebFrame.h" |
| 28 #include "third_party/WebKit/public/web/WebInputEvent.h" | 29 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 29 #include "third_party/WebKit/public/web/WebKit.h" | 30 #include "third_party/WebKit/public/web/WebKit.h" |
| 30 #include "third_party/WebKit/public/web/WebPluginParams.h" | 31 #include "third_party/WebKit/public/web/WebPluginParams.h" |
| 31 #include "third_party/WebKit/public/web/WebTouchPoint.h" | 32 #include "third_party/WebKit/public/web/WebTouchPoint.h" |
| 32 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" | 33 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h" |
| 33 #include "third_party/skia/include/core/SkBitmap.h" | 34 #include "third_party/skia/include/core/SkBitmap.h" |
| 34 #include "third_party/skia/include/core/SkCanvas.h" | 35 #include "third_party/skia/include/core/SkCanvas.h" |
| 35 #include "third_party/skia/include/core/SkColor.h" | 36 #include "third_party/skia/include/core/SkColor.h" |
| 36 #include "third_party/skia/include/core/SkPaint.h" | 37 #include "third_party/skia/include/core/SkPaint.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 } | 167 } |
| 167 if (can_create_without_renderer_) | 168 if (can_create_without_renderer_) |
| 168 delegate_->PrintMessage( | 169 delegate_->PrintMessage( |
| 169 std::string("TestPlugin: canCreateWithoutRenderer\n")); | 170 std::string("TestPlugin: canCreateWithoutRenderer\n")); |
| 170 } | 171 } |
| 171 | 172 |
| 172 TestPlugin::~TestPlugin() { | 173 TestPlugin::~TestPlugin() { |
| 173 } | 174 } |
| 174 | 175 |
| 175 bool TestPlugin::initialize(blink::WebPluginContainer* container) { | 176 bool TestPlugin::initialize(blink::WebPluginContainer* container) { |
| 176 blink::WebGraphicsContext3D::Attributes attrs; | 177 blink::Platform::ContextAttributes attrs; |
| 178 blink::WebURL url("chrome://TestPlugin::initialize"); | |
|
piman
2016/04/01 00:44:09
nit: How about container->element().document().url
danakj
2016/04/01 00:45:23
I was hoping to never have a null URL anymore. The
| |
| 177 blink::Platform::GraphicsInfo gl_info; | 179 blink::Platform::GraphicsInfo gl_info; |
| 178 context_provider_ = make_scoped_ptr( | 180 context_provider_ = make_scoped_ptr( |
| 179 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( | 181 blink::Platform::current()->createOffscreenGraphicsContext3DProvider( |
| 180 attrs, nullptr, &gl_info)); | 182 attrs, url, nullptr, &gl_info)); |
| 181 context_ = context_provider_ ? context_provider_->context3d() : nullptr; | 183 context_ = context_provider_ ? context_provider_->context3d() : nullptr; |
| 182 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; | 184 gl_ = context_provider_ ? context_provider_->contextGL() : nullptr; |
| 183 | 185 |
| 184 if (!InitScene()) | 186 if (!InitScene()) |
| 185 return false; | 187 return false; |
| 186 | 188 |
| 187 layer_ = cc::TextureLayer::CreateForMailbox(this); | 189 layer_ = cc::TextureLayer::CreateForMailbox(this); |
| 188 web_layer_ = make_scoped_ptr(new cc_blink::WebLayerImpl(layer_)); | 190 web_layer_ = make_scoped_ptr(new cc_blink::WebLayerImpl(layer_)); |
| 189 container_ = container; | 191 container_ = container; |
| 190 container_->setWebLayer(web_layer_.get()); | 192 container_->setWebLayer(web_layer_.get()); |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 724 return kPluginPersistsMimeType; | 726 return kPluginPersistsMimeType; |
| 725 } | 727 } |
| 726 | 728 |
| 727 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 729 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
| 728 return mime_type == TestPlugin::MimeType() || | 730 return mime_type == TestPlugin::MimeType() || |
| 729 mime_type == PluginPersistsMimeType() || | 731 mime_type == PluginPersistsMimeType() || |
| 730 mime_type == CanCreateWithoutRendererMimeType(); | 732 mime_type == CanCreateWithoutRendererMimeType(); |
| 731 } | 733 } |
| 732 | 734 |
| 733 } // namespace test_runner | 735 } // namespace test_runner |
| OLD | NEW |