Chromium Code Reviews| 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 26 matching lines...) Expand all Loading... | |
| 37 } | 37 } |
| 38 | 38 |
| 39 namespace ui { | 39 namespace ui { |
| 40 namespace demo { | 40 namespace demo { |
| 41 | 41 |
| 42 // 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 |
| 43 // 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 |
| 44 // 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 |
| 45 // as intended. | 45 // as intended. |
| 46 class MusDemo : public service_manager::Service, | 46 class MusDemo : public service_manager::Service, |
| 47 public aura::WindowTreeClientDelegate, | 47 public aura::WindowTreeClientDelegate { |
|
tonikitoo
2017/02/14 20:00:43
so, the resulting MusDemo class still inherits fro
fwang
2017/02/14 20:47:28
I think OnLostConnection is implemented in MusDemo
| |
| 48 public aura::WindowManagerDelegate { | |
| 49 public: | 48 public: |
| 50 MusDemo(); | 49 MusDemo(); |
| 51 ~MusDemo() override; | 50 ~MusDemo() override; |
| 52 | 51 |
| 53 protected: | 52 protected: |
| 53 virtual void OnStartImpl() = 0; | |
| 54 | |
| 54 class WindowTreeData { | 55 class WindowTreeData { |
| 55 public: | 56 public: |
| 56 explicit WindowTreeData( | 57 explicit WindowTreeData( |
| 57 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | 58 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 58 int square_size); | 59 int square_size); |
| 59 ~WindowTreeData(); | 60 ~WindowTreeData(); |
| 60 | 61 |
| 61 private: | 62 private: |
| 62 // Initializes the window tree host and start drawing frames. | 63 // Initializes the window tree host and start drawing frames. |
| 63 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); | 64 void Init(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host); |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 80 // Current rotation angle for drawing. | 81 // Current rotation angle for drawing. |
| 81 double angle_ = 0.0; | 82 double angle_ = 0.0; |
| 82 | 83 |
| 83 // Size in pixels of the square to draw. | 84 // Size in pixels of the square to draw. |
| 84 const int square_size_; | 85 const int square_size_; |
| 85 | 86 |
| 86 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); | 87 DISALLOW_COPY_AND_ASSIGN(WindowTreeData); |
| 87 }; | 88 }; |
| 88 std::unique_ptr<WindowTreeData> window_tree_data_; | 89 std::unique_ptr<WindowTreeData> window_tree_data_; |
| 89 | 90 |
| 91 std::unique_ptr<display::ScreenBase> screen_; | |
|
kylechar
2017/02/14 18:40:11
These must be in the private section.
| |
| 92 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | |
| 93 | |
| 90 private: | 94 private: |
| 91 // service_manager::Service: | 95 // service_manager::Service: |
| 92 void OnStart() override; | 96 void OnStart() override; |
| 93 bool OnConnect(const service_manager::ServiceInfo& remote_info, | 97 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 94 service_manager::InterfaceRegistry* registry) override; | 98 service_manager::InterfaceRegistry* registry) override; |
| 95 | 99 |
| 96 // aura::WindowTreeClientDelegate: | 100 // aura::WindowTreeClientDelegate: |
| 97 void OnEmbed( | 101 void OnEmbed( |
| 98 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; | 102 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; |
| 99 void OnUnembed(aura::Window* root) override; | 103 void OnUnembed(aura::Window* root) override; |
| 100 void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override; | 104 void OnEmbedRootDestroyed(aura::WindowTreeHostMus* window_tree_host) override; |
| 101 void OnLostConnection(aura::WindowTreeClient* client) override; | 105 void OnLostConnection(aura::WindowTreeClient* client) override; |
| 102 void OnPointerEventObserved(const ui::PointerEvent& event, | 106 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 103 aura::Window* target) override; | 107 aura::Window* target) override; |
| 104 aura::PropertyConverter* GetPropertyConverter() override; | 108 aura::PropertyConverter* GetPropertyConverter() override; |
| 105 | 109 |
| 106 // aura::WindowManagerDelegate: | |
|
kylechar
2017/02/14 18:40:11
Remove the includes that were added just for Windo
| |
| 107 void SetWindowManagerClient(aura::WindowManagerClient* client) override; | |
| 108 bool OnWmSetBounds(aura::Window* window, gfx::Rect* bounds) override; | |
| 109 bool OnWmSetProperty( | |
| 110 aura::Window* window, | |
| 111 const std::string& name, | |
| 112 std::unique_ptr<std::vector<uint8_t>>* new_data) override; | |
| 113 void OnWmSetCanFocus(aura::Window* window, bool can_focus) override; | |
| 114 aura::Window* OnWmCreateTopLevelWindow( | |
| 115 ui::mojom::WindowType window_type, | |
| 116 std::map<std::string, std::vector<uint8_t>>* properties) override; | |
| 117 void OnWmClientJankinessChanged(const std::set<aura::Window*>& client_windows, | |
| 118 bool janky) override; | |
| 119 void OnWmWillCreateDisplay(const display::Display& display) override; | |
| 120 void OnWmNewDisplay(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, | |
| 121 const display::Display& display) override; | |
| 122 void OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) override; | |
| 123 void OnWmDisplayModified(const display::Display& display) override; | |
| 124 ui::mojom::EventResult OnAccelerator(uint32_t id, | |
| 125 const ui::Event& event) override; | |
| 126 void OnWmPerformMoveLoop(aura::Window* window, | |
| 127 ui::mojom::MoveLoopSource source, | |
| 128 const gfx::Point& cursor_location, | |
| 129 const base::Callback<void(bool)>& on_done) override; | |
| 130 void OnWmCancelMoveLoop(aura::Window* window) override; | |
| 131 void OnWmSetClientArea( | |
| 132 aura::Window* window, | |
| 133 const gfx::Insets& insets, | |
| 134 const std::vector<gfx::Rect>& additional_client_areas) override; | |
| 135 bool IsWindowActive(aura::Window* window) override; | |
| 136 void OnWmDeactivateWindow(aura::Window* window) override; | |
| 137 | |
| 138 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; | |
| 139 std::unique_ptr<aura::Env> env_; | 110 std::unique_ptr<aura::Env> env_; |
| 140 std::unique_ptr<display::ScreenBase> screen_; | |
| 141 | 111 |
| 142 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; | 112 std::unique_ptr<aura::client::DefaultCaptureClient> capture_client_; |
| 143 std::unique_ptr<::wm::WMState> wm_state_; | 113 std::unique_ptr<::wm::WMState> wm_state_; |
| 144 std::unique_ptr<aura::PropertyConverter> property_converter_; | 114 std::unique_ptr<aura::PropertyConverter> property_converter_; |
| 145 | 115 |
| 146 DISALLOW_COPY_AND_ASSIGN(MusDemo); | 116 DISALLOW_COPY_AND_ASSIGN(MusDemo); |
| 147 }; | 117 }; |
| 148 | 118 |
| 149 } // namespace demo | 119 } // namespace demo |
| 150 } // namespace aura | 120 } // namespace aura |
| 151 | 121 |
| 152 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ | 122 #endif // SERVICES_UI_DEMO_MUS_DEMO_H_ |
| OLD | NEW |