| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_MUS_DEMO_H_ | 5 #ifndef SERVICES_UI_DEMO_MUS_DEMO_H_ |
| 6 #define SERVICES_UI_DEMO_MUS_DEMO_H_ | 6 #define SERVICES_UI_DEMO_MUS_DEMO_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 namespace aura_extra { | 31 namespace aura_extra { |
| 32 class ImageWindowDelegate; | 32 class ImageWindowDelegate; |
| 33 } | 33 } |
| 34 | 34 |
| 35 namespace wm { | 35 namespace wm { |
| 36 class WMState; | 36 class WMState; |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace ui { | 39 namespace ui { |
| 40 class ContextFactory; | |
| 41 class Gpu; | |
| 42 | |
| 43 namespace demo { | 40 namespace demo { |
| 44 | 41 |
| 45 // A simple MUS Demo service. This service connects to the service:ui, adds a | 42 // A simple MUS Demo service. This service connects to the service:ui, adds a |
| 46 // new window to the root Window, and draws a spinning square in the center of | 43 // new window to the root Window, and draws a spinning square in the center of |
| 47 // the window. Provides a simple way to demonstrate that the graphic stack works | 44 // the window. Provides a simple way to demonstrate that the graphic stack works |
| 48 // as intended. | 45 // as intended. |
| 49 class MusDemo : public service_manager::Service, | 46 class MusDemo : public service_manager::Service, |
| 50 public aura::WindowTreeClientDelegate, | 47 public aura::WindowTreeClientDelegate, |
| 51 public aura::WindowManagerDelegate { | 48 public aura::WindowManagerDelegate { |
| 52 public: | 49 public: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 const std::vector<gfx::Rect>& additional_client_areas) override; | 97 const std::vector<gfx::Rect>& additional_client_areas) override; |
| 101 bool IsWindowActive(aura::Window* window) override; | 98 bool IsWindowActive(aura::Window* window) override; |
| 102 void OnWmDeactivateWindow(aura::Window* window) override; | 99 void OnWmDeactivateWindow(aura::Window* window) override; |
| 103 | 100 |
| 104 // Draws one frame, incrementing the rotation angle. | 101 // Draws one frame, incrementing the rotation angle. |
| 105 void DrawFrame(); | 102 void DrawFrame(); |
| 106 | 103 |
| 107 aura::Window* root_window_ = nullptr; | 104 aura::Window* root_window_ = nullptr; |
| 108 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | 105 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 109 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | 106 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; |
| 110 std::unique_ptr<ui::Gpu> gpu_; | |
| 111 std::unique_ptr<ui::ContextFactory> context_factory_; | |
| 112 std::unique_ptr<aura::Env> env_; | 107 std::unique_ptr<aura::Env> env_; |
| 113 std::unique_ptr<display::ScreenBase> screen_; | 108 std::unique_ptr<display::ScreenBase> screen_; |
| 114 | 109 |
| 115 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 110 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 116 std::unique_ptr<::wm::WMState> wm_state_; | 111 std::unique_ptr<::wm::WMState> wm_state_; |
| 117 std::unique_ptr<aura::PropertyConverter> property_converter_; | 112 std::unique_ptr<aura::PropertyConverter> property_converter_; |
| 118 | 113 |
| 119 // Window to which we draw the bitmap. | 114 // Window to which we draw the bitmap. |
| 120 std::unique_ptr<aura::Window> bitmap_window_; | 115 std::unique_ptr<aura::Window> bitmap_window_; |
| 121 | 116 |
| 122 // Destroys itself when the window gets destroyed. | 117 // Destroys itself when the window gets destroyed. |
| 123 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; | 118 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; |
| 124 | 119 |
| 125 // Timer for calling DrawFrame(). | 120 // Timer for calling DrawFrame(). |
| 126 base::RepeatingTimer timer_; | 121 base::RepeatingTimer timer_; |
| 127 | 122 |
| 128 // Current rotation angle for drawing. | 123 // Current rotation angle for drawing. |
| 129 double angle_ = 0.0; | 124 double angle_ = 0.0; |
| 130 | 125 |
| 131 // Last time a frame was drawn. | 126 // Last time a frame was drawn. |
| 132 base::TimeTicks last_draw_frame_time_; | 127 base::TimeTicks last_draw_frame_time_; |
| 133 | 128 |
| 134 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 129 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 135 }; | 130 }; |
| 136 | 131 |
| 137 } // namespace demo | 132 } // namespace demo |
| 138 } // namespace aura | 133 } // namespace aura |
| 139 | 134 |
| 140 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 135 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |