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 | 10 |
10 #include "base/bind.h" | 11 #include "base/bind.h" |
11 #include "base/logging.h" | 12 #include "base/logging.h" |
12 #include "base/memory/shared_memory.h" | 13 #include "base/memory/shared_memory.h" |
13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
14 #include "cc/blink/web_layer_impl.h" | 15 #include "cc/blink/web_layer_impl.h" |
15 #include "cc/layers/texture_layer.h" | 16 #include "cc/layers/texture_layer.h" |
16 #include "cc/resources/shared_bitmap_manager.h" | 17 #include "cc/resources/shared_bitmap_manager.h" |
17 #include "components/test_runner/web_test_delegate.h" | 18 #include "components/test_runner/web_test_delegate.h" |
18 #include "third_party/WebKit/public/platform/Platform.h" | 19 #include "third_party/WebKit/public/platform/Platform.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 const blink::WebString& string) { | 126 const blink::WebString& string) { |
126 if (string == blink::WebString::fromUTF8("raw")) | 127 if (string == blink::WebString::fromUTF8("raw")) |
127 return blink::WebPluginContainer::TouchEventRequestTypeRaw; | 128 return blink::WebPluginContainer::TouchEventRequestTypeRaw; |
128 if (string == blink::WebString::fromUTF8("synthetic")) | 129 if (string == blink::WebString::fromUTF8("synthetic")) |
129 return blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse; | 130 return blink::WebPluginContainer::TouchEventRequestTypeSynthesizedMouse; |
130 return blink::WebPluginContainer::TouchEventRequestTypeNone; | 131 return blink::WebPluginContainer::TouchEventRequestTypeNone; |
131 } | 132 } |
132 | 133 |
133 class DeferredDeleteTask : public blink::WebTaskRunner::Task { | 134 class DeferredDeleteTask : public blink::WebTaskRunner::Task { |
134 public: | 135 public: |
135 DeferredDeleteTask(scoped_ptr<TestPlugin> plugin) : plugin_(plugin.Pass()) {} | 136 DeferredDeleteTask(scoped_ptr<TestPlugin> plugin) |
| 137 : plugin_(std::move(plugin)) {} |
136 | 138 |
137 void run() override {} | 139 void run() override {} |
138 | 140 |
139 private: | 141 private: |
140 scoped_ptr<TestPlugin> plugin_; | 142 scoped_ptr<TestPlugin> plugin_; |
141 }; | 143 }; |
142 | 144 |
143 } // namespace | 145 } // namespace |
144 | 146 |
145 TestPlugin::TestPlugin(blink::WebFrame* frame, | 147 TestPlugin::TestPlugin(blink::WebFrame* frame, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } else { | 300 } else { |
299 scoped_ptr<cc::SharedBitmap> bitmap = | 301 scoped_ptr<cc::SharedBitmap> bitmap = |
300 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( | 302 delegate_->GetSharedBitmapManager()->AllocateSharedBitmap( |
301 gfx::Rect(rect_).size()); | 303 gfx::Rect(rect_).size()); |
302 if (!bitmap) { | 304 if (!bitmap) { |
303 texture_mailbox_ = cc::TextureMailbox(); | 305 texture_mailbox_ = cc::TextureMailbox(); |
304 } else { | 306 } else { |
305 DrawSceneSoftware(bitmap->pixels()); | 307 DrawSceneSoftware(bitmap->pixels()); |
306 texture_mailbox_ = cc::TextureMailbox( | 308 texture_mailbox_ = cc::TextureMailbox( |
307 bitmap.get(), gfx::Size(rect_.width, rect_.height)); | 309 bitmap.get(), gfx::Size(rect_.width, rect_.height)); |
308 shared_bitmap_ = bitmap.Pass(); | 310 shared_bitmap_ = std::move(bitmap); |
309 } | 311 } |
310 } | 312 } |
311 | 313 |
312 mailbox_changed_ = true; | 314 mailbox_changed_ = true; |
313 layer_->SetNeedsDisplay(); | 315 layer_->SetNeedsDisplay(); |
314 } | 316 } |
315 | 317 |
316 bool TestPlugin::acceptsInputEvents() { | 318 bool TestPlugin::acceptsInputEvents() { |
317 return true; | 319 return true; |
318 } | 320 } |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 return kPluginPersistsMimeType; | 757 return kPluginPersistsMimeType; |
756 } | 758 } |
757 | 759 |
758 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { | 760 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { |
759 return mime_type == TestPlugin::MimeType() || | 761 return mime_type == TestPlugin::MimeType() || |
760 mime_type == PluginPersistsMimeType() || | 762 mime_type == PluginPersistsMimeType() || |
761 mime_type == CanCreateWithoutRendererMimeType(); | 763 mime_type == CanCreateWithoutRendererMimeType(); |
762 } | 764 } |
763 | 765 |
764 } // namespace test_runner | 766 } // namespace test_runner |
OLD | NEW |