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 #include "ui/gfx/compositor/test/test_compositor_host.h" | 5 #include "ui/gfx/compositor/test/test_compositor_host.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "ui/base/x/x11_util.h" | 10 #include "ui/base/x/x11_util.h" |
11 #include "ui/gfx/compositor/compositor.h" | 11 #include "ui/gfx/compositor/compositor.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 | 13 |
14 #include <X11/Xlib.h> | 14 #include <X11/Xlib.h> |
15 | 15 |
16 #if defined(TOUCH_UI) || defined(USE_AURA) | 16 #if defined(USE_AURA) |
17 #include "base/message_pump_x.h" | 17 #include "base/message_pump_x.h" |
18 #endif | 18 #endif |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 class TestCompositorHostLinux : public TestCompositorHost, | 22 class TestCompositorHostLinux : public TestCompositorHost, |
23 public CompositorDelegate { | 23 public CompositorDelegate { |
24 public: | 24 public: |
25 TestCompositorHostLinux(const gfx::Rect& bounds); | 25 TestCompositorHostLinux(const gfx::Rect& bounds); |
26 virtual ~TestCompositorHostLinux(); | 26 virtual ~TestCompositorHostLinux(); |
27 | 27 |
28 private: | 28 private: |
29 // Overridden from TestCompositorHost: | 29 // Overridden from TestCompositorHost: |
30 virtual void Show() OVERRIDE; | 30 virtual void Show() OVERRIDE; |
31 virtual ui::Compositor* GetCompositor() OVERRIDE; | 31 virtual ui::Compositor* GetCompositor() OVERRIDE; |
32 | 32 |
33 // Overridden from CompositorDelegate: | 33 // Overridden from CompositorDelegate: |
34 virtual void ScheduleDraw() OVERRIDE; | 34 virtual void ScheduleDraw() OVERRIDE; |
35 | 35 |
36 // Overridden from MessagePumpDispatcher: | 36 // Overridden from MessagePumpDispatcher: |
37 #if defined(TOUCH_UI) || defined(USE_AURA) | 37 #if defined(USE_AURA) |
38 virtual base::MessagePumpDispatcher::DispatchStatus | 38 virtual base::MessagePumpDispatcher::DispatchStatus |
39 Dispatch(XEvent* xev) OVERRIDE; | 39 Dispatch(XEvent* xev) OVERRIDE; |
40 #elif defined(TOOLKIT_USES_GTK) | 40 #elif defined(TOOLKIT_USES_GTK) |
41 virtual bool Dispatch(GdkEvent* event) OVERRIDE; | 41 virtual bool Dispatch(GdkEvent* event) OVERRIDE; |
42 #endif | 42 #endif |
43 | 43 |
44 gfx::Rect bounds_; | 44 gfx::Rect bounds_; |
45 | 45 |
46 scoped_refptr<ui::Compositor> compositor_; | 46 scoped_refptr<ui::Compositor> compositor_; |
47 | 47 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 ui::Compositor* TestCompositorHostLinux::GetCompositor() { | 88 ui::Compositor* TestCompositorHostLinux::GetCompositor() { |
89 return compositor_; | 89 return compositor_; |
90 } | 90 } |
91 | 91 |
92 void TestCompositorHostLinux::ScheduleDraw() { | 92 void TestCompositorHostLinux::ScheduleDraw() { |
93 if (compositor_) | 93 if (compositor_) |
94 compositor_->Draw(false); | 94 compositor_->Draw(false); |
95 } | 95 } |
96 | 96 |
97 #if defined(TOUCH_UI) || defined(USE_AURA) | 97 #if defined(USE_AURA) |
98 base::MessagePumpDispatcher::DispatchStatus TestCompositorHostLinux::Dispatch( | 98 base::MessagePumpDispatcher::DispatchStatus TestCompositorHostLinux::Dispatch( |
99 XEvent* xev) { | 99 XEvent* xev) { |
100 return MessagePumpDispatcher::EVENT_IGNORED; | 100 return MessagePumpDispatcher::EVENT_IGNORED; |
101 } | 101 } |
102 #elif defined(TOOLKIT_USES_GTK) | 102 #elif defined(TOOLKIT_USES_GTK) |
103 bool TestCompositorHostLinux::Dispatch(GdkEvent*) { | 103 bool TestCompositorHostLinux::Dispatch(GdkEvent*) { |
104 return false; | 104 return false; |
105 } | 105 } |
106 #endif | 106 #endif |
107 | 107 |
108 // static | 108 // static |
109 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 109 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
110 return new TestCompositorHostLinux(bounds); | 110 return new TestCompositorHostLinux(bounds); |
111 } | 111 } |
112 | 112 |
113 } // namespace ui | 113 } // namespace ui |
OLD | NEW |