Chromium Code Reviews| 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 |
| 11 namespace aura { | 11 namespace aura { |
| 12 class Window; | 12 class Window; |
| 13 class WindowTreeHostMus; | 13 class WindowTreeHostMus; |
| 14 } // namespace aura | 14 } // namespace aura |
| 15 | 15 |
| 16 namespace aura_extra { | 16 namespace aura_extra { |
| 17 class ImageWindowDelegate; | 17 class ImageWindowDelegate; |
| 18 } // namespace aura_extra | 18 } // namespace aura_extra |
| 19 | 19 |
| 20 namespace ui { | 20 namespace ui { |
| 21 namespace demo { | 21 namespace demo { |
| 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 virtual void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); |
|
fwang
2017/03/07 09:21:25
Not needed.
tonikitoo
2017/03/07 14:00:50
Done.
| |
| 30 bool IsInitialized() const { return !!window_tree_host_; } | 30 bool IsInitialized() const { return !!window_tree_host_; } |
| 31 | 31 |
| 32 const aura::WindowTreeHostMus* WindowTreeHost() const { | 32 const aura::WindowTreeHostMus* WindowTreeHost() const { |
| 33 return window_tree_host_.get(); | 33 return window_tree_host_.get(); |
| 34 } | 34 } |
| 35 | 35 |
| 36 protected: | |
| 37 void InitImpl(aura::WindowTreeHostMus* window_tree_host); | |
|
fwang
2017/03/07 09:21:25
Not needed.
tonikitoo
2017/03/07 14:00:50
Done.
| |
| 38 | |
| 39 // The Window tree host corresponding to this data. | |
| 40 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | |
|
fwang
2017/03/07 09:21:25
This should remain private IIUC chromium style.
tonikitoo
2017/03/07 14:00:49
Done.
| |
| 41 | |
| 36 private: | 42 private: |
| 37 // Draws one frame, incrementing the rotation angle. | 43 // Draws one frame, incrementing the rotation angle. |
| 38 void DrawFrame(); | 44 void DrawFrame(); |
| 39 | 45 |
| 40 // Helper function to retrieve the window to which we draw the bitmap. | 46 // Helper function to retrieve the window to which we draw the bitmap. |
| 41 aura::Window* bitmap_window(); | 47 aura::Window* bitmap_window(); |
| 42 | 48 |
| 43 // The Window tree host corresponding to this data. | |
| 44 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | |
| 45 | |
| 46 // Destroys itself when the window gets destroyed. | 49 // Destroys itself when the window gets destroyed. |
| 47 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; | 50 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; |
| 48 | 51 |
| 49 // Timer for calling DrawFrame(). | 52 // Timer for calling DrawFrame(). |
| 50 base::RepeatingTimer timer_; | 53 base::RepeatingTimer timer_; |
| 51 | 54 |
| 52 // Current rotation angle for drawing. | 55 // Current rotation angle for drawing. |
| 53 double angle_ = 0.0; | 56 double angle_ = 0.0; |
| 54 | 57 |
| 55 // Size in pixels of the square to draw. | 58 // Size in pixels of the square to draw. |
| 56 const int square_size_; | 59 const int square_size_; |
| 57 | 60 |
| 58 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); | 61 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); |
| 59 }; | 62 }; |
| 60 | 63 |
| 61 } // namespace demo | 64 } // namespace demo |
| 62 } // namespace ui | 65 } // namespace ui |
| 63 | 66 |
| 64 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ | 67 #endif // SERVICES_UI_DEMO_WINDOW_TREE_DATA_H_ |
| OLD | NEW |