OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ | 5 #ifndef SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ |
6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ | 6 #define SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ |
7 | 7 |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class WindowTreeData { | 23 class WindowTreeData { |
24 public: | 24 public: |
25 explicit WindowTreeData(int square_size); | 25 explicit WindowTreeData(int square_size); |
26 ~WindowTreeData(); | 26 ~WindowTreeData(); |
27 | 27 |
28 // Initializes the window tree host and start drawing frames. | 28 // Initializes the window tree host and start drawing frames. |
29 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); | 29 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); |
30 bool IsInitialized() const { return !!window_tree_host_; } | 30 bool IsInitialized() const { return !!window_tree_host_; } |
31 | 31 |
| 32 const aura::WindowTreeHostMus* WindowTreeHost() const { |
| 33 return window_tree_host_.get(); |
| 34 } |
| 35 |
32 private: | 36 private: |
33 // Draws one frame, incrementing the rotation angle. | 37 // Draws one frame, incrementing the rotation angle. |
34 void DrawFrame(); | 38 void DrawFrame(); |
35 | 39 |
36 // Helper function to retrieve the window to which we draw the bitmap. | 40 // Helper function to retrieve the window to which we draw the bitmap. |
37 aura::Window* bitmap_window(); | 41 aura::Window* bitmap_window(); |
38 | 42 |
39 // The Window tree host corresponding to this data. | 43 // The Window tree host corresponding to this data. |
40 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | 44 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; |
41 | 45 |
42 // Destroys itself when the window gets destroyed. | 46 // Destroys itself when the window gets destroyed. |
43 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; | 47 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; |
44 | 48 |
45 // Timer for calling DrawFrame(). | 49 // Timer for calling DrawFrame(). |
46 base::RepeatingTimer timer_; | 50 base::RepeatingTimer timer_; |
47 | 51 |
48 // Current rotation angle for drawing. | 52 // Current rotation angle for drawing. |
49 double angle_ = 0.0; | 53 double angle_ = 0.0; |
50 | 54 |
51 // Size in pixels of the square to draw. | 55 // Size in pixels of the square to draw. |
52 const int square_size_; | 56 const int square_size_; |
53 | 57 |
54 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); | 58 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); |
55 }; | 59 }; |
56 | 60 |
57 } // namespace demo | 61 } // namespace demo |
58 } // namespace ui | 62 } // namespace ui |
59 | 63 |
60 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ | 64 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ |
OLD | NEW |