| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/compositor/test/test_compositor_host.h" | 5 #include "ui/compositor/test/test_compositor_host.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "ui/compositor/compositor.h" | 12 #include "ui/compositor/compositor.h" |
| 13 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
| 14 | 14 |
| 15 namespace ui { | 15 namespace ui { |
| 16 | 16 |
| 17 class TestCompositorHostAndroid : public TestCompositorHost { | 17 class TestCompositorHostAndroid : public TestCompositorHost { |
| 18 public: | 18 public: |
| 19 TestCompositorHostAndroid(const gfx::Rect& bounds, | 19 TestCompositorHostAndroid( |
| 20 ui::ContextFactory* context_factory) { | 20 const gfx::Rect& bounds, |
| 21 ui::ContextFactory* context_factory, |
| 22 ui::ContextFactoryPrivate* context_factory_private) { |
| 21 compositor_.reset(new ui::Compositor(context_factory, | 23 compositor_.reset(new ui::Compositor(context_factory, |
| 24 context_factory_private, |
| 22 base::ThreadTaskRunnerHandle::Get())); | 25 base::ThreadTaskRunnerHandle::Get())); |
| 23 // TODO(sievers): Support onscreen here. | 26 // TODO(sievers): Support onscreen here. |
| 24 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); | 27 compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); |
| 25 compositor_->SetScaleAndSize(1.0f, | 28 compositor_->SetScaleAndSize(1.0f, |
| 26 gfx::Size(bounds.width(), bounds.height())); | 29 gfx::Size(bounds.width(), bounds.height())); |
| 27 } | 30 } |
| 28 | 31 |
| 29 // Overridden from TestCompositorHost: | 32 // Overridden from TestCompositorHost: |
| 30 void Show() override { compositor_->SetVisible(true); } | 33 void Show() override { compositor_->SetVisible(true); } |
| 31 ui::Compositor* GetCompositor() override { return compositor_.get(); } | 34 ui::Compositor* GetCompositor() override { return compositor_.get(); } |
| 32 | 35 |
| 33 private: | 36 private: |
| 34 std::unique_ptr<ui::Compositor> compositor_; | 37 std::unique_ptr<ui::Compositor> compositor_; |
| 35 | 38 |
| 36 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostAndroid); | 39 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostAndroid); |
| 37 }; | 40 }; |
| 38 | 41 |
| 39 TestCompositorHost* TestCompositorHost::Create( | 42 TestCompositorHost* TestCompositorHost::Create( |
| 40 const gfx::Rect& bounds, | 43 const gfx::Rect& bounds, |
| 41 ui::ContextFactory* context_factory) { | 44 ui::ContextFactory* context_factory, |
| 42 return new TestCompositorHostAndroid(bounds, context_factory); | 45 ui::ContextFactoryPrivate* context_factory_private) { |
| 46 return new TestCompositorHostAndroid(bounds, context_factory, |
| 47 context_factory_private); |
| 43 } | 48 } |
| 44 | 49 |
| 45 } // namespace ui | 50 } // namespace ui |
| OLD | NEW |