OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MASH_SIMPLE_WM_SIMPLE_WM_H_ |
| 6 #define MASH_SIMPLE_WM_SIMPLE_WM_H_ |
| 7 |
| 8 #include <memory> |
| 9 #include <utility> |
| 10 |
| 11 #include "base/memory/ptr_util.h" |
| 12 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "mojo/public/cpp/bindings/binding.h" |
| 14 #include "services/service_manager/public/cpp/connector.h" |
| 15 #include "services/service_manager/public/cpp/service.h" |
| 16 #include "services/service_manager/public/cpp/service_context.h" |
| 17 #include "services/ui/public/cpp/gpu/gpu_service.h" |
| 18 #include "ui/aura/env.h" |
| 19 #include "ui/aura/mus/mus_context_factory.h" |
| 20 #include "ui/aura/mus/property_converter.h" |
| 21 #include "ui/aura/mus/property_utils.h" |
| 22 #include "ui/aura/mus/window_manager_delegate.h" |
| 23 #include "ui/aura/mus/window_tree_client.h" |
| 24 #include "ui/aura/mus/window_tree_client_delegate.h" |
| 25 #include "ui/aura/mus/window_tree_host_mus.h" |
| 26 #include "ui/aura/test/test_focus_client.h" |
| 27 #include "ui/aura/window.h" |
| 28 #include "ui/display/display.h" |
| 29 #include "ui/wm/core/capture_controller.h" |
| 30 #include "ui/wm/core/wm_state.h" |
| 31 |
| 32 namespace display { |
| 33 class ScreenBase; |
| 34 } |
| 35 |
| 36 namespace views { |
| 37 class AuraInit; |
| 38 } |
| 39 |
| 40 namespace simple_wm { |
| 41 |
| 42 class SimpleWM : public service_manager::Service, |
| 43 public aura::WindowTreeClientDelegate, |
| 44 public aura::WindowManagerDelegate { |
| 45 public: |
| 46 SimpleWM(); |
| 47 ~SimpleWM() override; |
| 48 |
| 49 private: |
| 50 class FrameView; |
| 51 |
| 52 // service_manager::Service: |
| 53 void OnStart() override; |
| 54 bool OnConnect(const service_manager::ServiceInfo& remote_info, |
| 55 service_manager::InterfaceRegistry* registry) override; |
| 56 |
| 57 // aura::WindowTreeClientDelegate: |
| 58 void OnEmbed( |
| 59 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) override; |
| 60 void OnLostConnection(aura::WindowTreeClient* client) override; |
| 61 void OnEmbedRootDestroyed(aura::Window* root) override; |
| 62 void OnPointerEventObserved(const ui::PointerEvent& event, |
| 63 aura::Window* target) override; |
| 64 aura::client::CaptureClient* GetCaptureClient() override; |
| 65 aura::PropertyConverter* GetPropertyConverter() override; |
| 66 |
| 67 // aura::WindowManagerDelegate: |
| 68 void SetWindowManagerClient(aura::WindowManagerClient* client) override; |
| 69 bool OnWmSetBounds(aura::Window* window, gfx::Rect* bounds) override; |
| 70 bool OnWmSetProperty( |
| 71 aura::Window* window, |
| 72 const std::string& name, |
| 73 std::unique_ptr<std::vector<uint8_t>>* new_data) override; |
| 74 aura::Window* OnWmCreateTopLevelWindow( |
| 75 ui::mojom::WindowType window_type, |
| 76 std::map<std::string, std::vector<uint8_t>>* properties) override; |
| 77 void OnWmClientJankinessChanged(const std::set<aura::Window*>& client_windows, |
| 78 bool janky) override; |
| 79 void OnWmWillCreateDisplay(const display::Display& display) override; |
| 80 void OnWmNewDisplay(std::unique_ptr<aura::WindowTreeHostMus> window_tree_host, |
| 81 const display::Display& display) override; |
| 82 void OnWmDisplayRemoved(aura::WindowTreeHostMus* window_tree_host) override; |
| 83 void OnWmDisplayModified(const display::Display& display) override; |
| 84 void OnWmPerformMoveLoop(aura::Window* window, |
| 85 ui::mojom::MoveLoopSource source, |
| 86 const gfx::Point& cursor_location, |
| 87 const base::Callback<void(bool)>& on_done) override; |
| 88 void OnWmCancelMoveLoop(aura::Window* window) override; |
| 89 void OnWmSetClientArea( |
| 90 aura::Window* window, |
| 91 const gfx::Insets& insets, |
| 92 const std::vector<gfx::Rect>& additional_client_areas) override; |
| 93 |
| 94 FrameView* GetFrameViewForClientWindow(aura::Window* client_window); |
| 95 |
| 96 std::unique_ptr<views::AuraInit> aura_init_; |
| 97 ::wm::WMState wm_state_; |
| 98 std::unique_ptr<display::ScreenBase> screen_; |
| 99 aura::PropertyConverter property_converter_; |
| 100 aura::test::TestFocusClient focus_client_; |
| 101 std::unique_ptr<aura::WindowTreeHostMus> window_tree_host_; |
| 102 aura::Window* root_ = nullptr; |
| 103 aura::WindowManagerClient* window_manager_client_ = nullptr; |
| 104 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; |
| 105 std::unique_ptr<ui::GpuService> gpu_service_; |
| 106 std::unique_ptr<aura::MusContextFactory> compositor_context_factory_; |
| 107 std::map<aura::Window*, FrameView*> client_window_to_frame_view_; |
| 108 |
| 109 bool started_ = false; |
| 110 |
| 111 DISALLOW_COPY_AND_ASSIGN(SimpleWM); |
| 112 }; |
| 113 |
| 114 } // namespace simple_wm |
| 115 |
| 116 #endif // MASH_SIMPLE_WM_SIMPLE_WM_H_ |
OLD | NEW |