OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/base/win/window_impl.h" | 9 #include "ui/base/win/window_impl.h" |
10 #include "ui/gfx/compositor/compositor.h" | 10 #include "ui/gfx/compositor/compositor.h" |
11 | 11 |
12 namespace ui { | 12 namespace ui { |
13 | 13 |
14 class TestCompositorHostWin : public TestCompositorHost, | 14 class TestCompositorHostWin : public TestCompositorHost, |
15 public WindowImpl, | 15 public WindowImpl, |
16 public CompositorDelegate { | 16 public CompositorDelegate { |
17 public: | 17 public: |
18 TestCompositorHostWin(const gfx::Rect& bounds) { | 18 TestCompositorHostWin(const gfx::Rect& bounds) { |
19 Init(NULL, bounds); | 19 Init(NULL, bounds); |
20 compositor_.reset(new ui::Compositor(this, hwnd(), GetSize())); | 20 compositor_.reset(new ui::Compositor(this, hwnd(), GetSize())); |
21 } | 21 } |
22 | 22 |
23 virtual ~TestCompositorHostWin() { | 23 virtual ~TestCompositorHostWin() { |
24 DestroyWindow(hwnd()); | 24 DestroyWindow(hwnd()); |
25 } | 25 } |
26 | 26 |
27 // Overridden from MessageLoop::Dispatcher: | 27 // Overridden from MessageLoop::Dispatcher: |
28 virtual bool Dispatch(const MSG& msg) { | 28 virtual bool Dispatch(const base::NativeEvent& msg) { |
29 TranslateMessage(&msg); | 29 TranslateMessage(&msg); |
30 DispatchMessage(&msg); | 30 DispatchMessage(&msg); |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 // Overridden from TestCompositorHost: | 34 // Overridden from TestCompositorHost: |
35 virtual void Show() OVERRIDE { | 35 virtual void Show() OVERRIDE { |
36 ShowWindow(hwnd(), SW_SHOWNORMAL); | 36 ShowWindow(hwnd(), SW_SHOWNORMAL); |
37 } | 37 } |
38 virtual ui::Compositor* GetCompositor() OVERRIDE { | 38 virtual ui::Compositor* GetCompositor() OVERRIDE { |
(...skipping 26 matching lines...) Expand all Loading... |
65 scoped_ptr<ui::Compositor> compositor_; | 65 scoped_ptr<ui::Compositor> compositor_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); | 67 DISALLOW_COPY_AND_ASSIGN(TestCompositorHostWin); |
68 }; | 68 }; |
69 | 69 |
70 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 70 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
71 return new TestCompositorHostWin(bounds); | 71 return new TestCompositorHostWin(bounds); |
72 } | 72 } |
73 | 73 |
74 } // namespace ui | 74 } // namespace ui |
OLD | NEW |