OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ | 5 #ifndef UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ |
6 #define UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ | 6 #define UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "ui/gfx/compositor/compositor.h" | 12 #include "ui/gfx/compositor/compositor.h" |
13 | 13 |
14 namespace ui { | 14 namespace ui { |
15 | 15 |
16 class TestCompositorDelegate; | 16 class TestCompositorDelegate; |
17 | 17 |
18 // Trivial Compositor implementation that creates Textures of type TestTexture. | 18 // Trivial Compositor implementation that creates Textures of type TestTexture. |
19 class TestCompositor : public ui::Compositor { | 19 class TestCompositor : public ui::Compositor { |
20 public: | 20 public: |
21 TestCompositor(); | 21 explicit TestCompositor(CompositorDelegate* owner); |
22 virtual ~TestCompositor(); | 22 virtual ~TestCompositor(); |
23 | 23 |
24 // ui::Compositor: | 24 // ui::Compositor: |
25 virtual ui::Texture* CreateTexture() OVERRIDE; | 25 virtual ui::Texture* CreateTexture() OVERRIDE; |
26 virtual void OnNotifyStart(bool clear) OVERRIDE; | 26 virtual void OnNotifyStart(bool clear) OVERRIDE; |
27 virtual void OnNotifyEnd() OVERRIDE; | 27 virtual void OnNotifyEnd() OVERRIDE; |
28 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; | 28 virtual void Blur(const gfx::Rect& bounds) OVERRIDE; |
29 virtual void DrawTree() OVERRIDE; | 29 virtual void DrawTree() OVERRIDE; |
30 | 30 |
| 31 // A simple factory that creates a test compositor with a given delegate |
| 32 static ui::Compositor* Create(ui::CompositorDelegate* owner); |
| 33 |
31 protected: | 34 protected: |
32 virtual void OnWidgetSizeChanged() OVERRIDE; | 35 virtual void OnWidgetSizeChanged() OVERRIDE; |
33 | 36 |
34 private: | 37 private: |
35 scoped_ptr<TestCompositorDelegate> owned_delegate_; | 38 scoped_ptr<TestCompositorDelegate> owned_delegate_; |
36 | 39 |
37 DISALLOW_COPY_AND_ASSIGN(TestCompositor); | 40 DISALLOW_COPY_AND_ASSIGN(TestCompositor); |
38 }; | 41 }; |
39 | 42 |
40 } // namespace ui | 43 } // namespace ui |
41 | 44 |
42 #endif // UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ | 45 #endif // UI_GFX_COMPOSITOR_TEST_COMPOSITOR_H_ |
OLD | NEW |