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