| 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> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/callback.h" | 14 #include "base/callback.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "services/service_manager/public/cpp/service.h" | 17 #include "services/service_manager/public/cpp/service.h" |
| 18 #include "services/ui/public/interfaces/window_tree_host.mojom.h" |
| 18 #include "ui/aura/mus/window_manager_delegate.h" | 19 #include "ui/aura/mus/window_manager_delegate.h" |
| 19 #include "ui/aura/mus/window_tree_client_delegate.h" | 20 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 20 #include "ui/display/screen_base.h" | 21 #include "ui/display/screen_base.h" |
| 21 | 22 |
| 22 namespace aura { | 23 namespace aura { |
| 23 class Env; | 24 class Env; |
| 24 class PropertyConverter; | 25 class PropertyConverter; |
| 25 | 26 |
| 26 namespace client { | 27 namespace client { |
| 27 class DefaultCaptureClient; | 28 class DefaultCaptureClient; |
| 28 } | 29 } |
| 29 } // namespace aura | 30 } // namespace aura |
| 30 | 31 |
| 31 namespace aura_extra { | |
| 32 class ImageWindowDelegate; | |
| 33 } | |
| 34 | |
| 35 namespace wm { | 32 namespace wm { |
| 36 class WMState; | 33 class WMState; |
| 37 } | 34 } |
| 38 | 35 |
| 39 namespace ui { | 36 namespace ui { |
| 40 namespace demo { | 37 namespace demo { |
| 41 | 38 |
| 42 // A simple MUS Demo service. This service connects to the service:ui, adds a | 39 // A simple MUS Demo service. This service connects to the service:ui, adds a |
| 43 // new window to the root Window, and draws a spinning square in the center of | 40 // new window to the root Window, and draws a spinning square in the center of |
| 44 // the window. Provides a simple way to demonstrate that the graphic stack works | 41 // the window. Provides a simple way to demonstrate that the graphic stack works |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 const gfx::Point& cursor_location, | 88 const gfx::Point& cursor_location, |
| 92 const base::Callback<void(bool)>& on_done) override; | 89 const base::Callback<void(bool)>& on_done) override; |
| 93 void OnWmCancelMoveLoop(aura::Window* window) override; | 90 void OnWmCancelMoveLoop(aura::Window* window) override; |
| 94 void OnWmSetClientArea( | 91 void OnWmSetClientArea( |
| 95 aura::Window* window, | 92 aura::Window* window, |
| 96 const gfx::Insets& insets, | 93 const gfx::Insets& insets, |
| 97 const std::vector<gfx::Rect>& additional_client_areas) override; | 94 const std::vector<gfx::Rect>& additional_client_areas) override; |
| 98 bool IsWindowActive(aura::Window* window) override; | 95 bool IsWindowActive(aura::Window* window) override; |
| 99 void OnWmDeactivateWindow(aura::Window* window) override; | 96 void OnWmDeactivateWindow(aura::Window* window) override; |
| 100 | 97 |
| 101 // Draws one frame, incrementing the rotation angle. | |
| 102 void DrawFrame(); | |
| 103 | |
| 104 aura::Window* root_window_ = nullptr; | |
| 105 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | 98 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 106 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; | |
| 107 std::unique_ptr<aura::Env> env_; | 99 std::unique_ptr<aura::Env> env_; |
| 108 std::unique_ptr<display::ScreenBase> screen_; | 100 std::unique_ptr<display::ScreenBase> screen_; |
| 109 | 101 |
| 110 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 102 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 111 std::unique_ptr<::wm::WMState> wm_state_; | 103 std::unique_ptr<::wm::WMState> wm_state_; |
| 112 std::unique_ptr<aura::PropertyConverter> property_converter_; | 104 std::unique_ptr<aura::PropertyConverter> property_converter_; |
| 113 | 105 |
| 114 // Window to which we draw the bitmap. | 106 class WindowTreeData; |
| 115 std::unique_ptr<aura::Window> bitmap_window_; | 107 std::unique_ptr<WindowTreeData> window_tree_data_; |
| 116 | 108 |
| 117 // Destroys itself when the window gets destroyed. | 109 bool external_window_mode_; |
| 118 aura_extra::ImageWindowDelegate* window_delegate_ = nullptr; | 110 mojom::WindowTreeHostFactoryPtr window_tree_host_factory_; |
| 119 | |
| 120 // Timer for calling DrawFrame(). | |
| 121 base::RepeatingTimer timer_; | |
| 122 | |
| 123 // Current rotation angle for drawing. | |
| 124 double angle_ = 0.0; | |
| 125 | |
| 126 // Last time a frame was drawn. | |
| 127 base::TimeTicks last_draw_frame_time_; | |
| 128 | 111 |
| 129 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 112 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 130 }; | 113 }; |
| 131 | 114 |
| 132 } // namespace demo | 115 } // namespace demo |
| 133 } // namespace aura | 116 } // namespace aura |
| 134 | 117 |
| 135 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 118 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |