OLD | NEW |
| (Empty) |
1 // Copyright 2015 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_WM_WINDOW_MANAGER_H_ | |
6 #define MASH_WM_WINDOW_MANAGER_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <memory> | |
11 | |
12 #include "base/macros.h" | |
13 #include "components/mus/common/types.h" | |
14 #include "components/mus/public/cpp/window_manager_delegate.h" | |
15 #include "components/mus/public/cpp/window_observer.h" | |
16 #include "components/mus/public/cpp/window_tracker.h" | |
17 #include "components/mus/public/interfaces/window_manager.mojom.h" | |
18 #include "mash/session/public/interfaces/session.mojom.h" | |
19 #include "mash/wm/disconnected_app_handler.h" | |
20 #include "mojo/public/cpp/bindings/binding.h" | |
21 | |
22 namespace mash { | |
23 namespace wm { | |
24 | |
25 class RootWindowController; | |
26 | |
27 class WindowManager : public mus::WindowTracker, | |
28 public mus::WindowManagerDelegate, | |
29 public session::mojom::ScreenlockStateListener { | |
30 public: | |
31 WindowManager(); | |
32 ~WindowManager() override; | |
33 | |
34 void Initialize(RootWindowController* root_controller, | |
35 session::mojom::Session* session); | |
36 | |
37 mus::WindowManagerClient* window_manager_client() { | |
38 return window_manager_client_; | |
39 } | |
40 | |
41 // Creates a new top level window. | |
42 mus::Window* NewTopLevelWindow( | |
43 std::map<std::string, std::vector<uint8_t>>* properties); | |
44 | |
45 private: | |
46 gfx::Rect CalculateDefaultBounds(mus::Window* window) const; | |
47 gfx::Rect GetMaximizedWindowBounds() const; | |
48 | |
49 // mus::WindowObserver: | |
50 void OnTreeChanging(const TreeChangeParams& params) override; | |
51 | |
52 // WindowManagerDelegate: | |
53 void SetWindowManagerClient(mus::WindowManagerClient* client) override; | |
54 bool OnWmSetBounds(mus::Window* window, gfx::Rect* bounds) override; | |
55 bool OnWmSetProperty( | |
56 mus::Window* window, | |
57 const std::string& name, | |
58 std::unique_ptr<std::vector<uint8_t>>* new_data) override; | |
59 mus::Window* OnWmCreateTopLevelWindow( | |
60 std::map<std::string, std::vector<uint8_t>>* properties) override; | |
61 void OnWmClientJankinessChanged(const std::set<mus::Window*>& client_windows, | |
62 bool not_responding) override; | |
63 void OnAccelerator(uint32_t id, const ui::Event& event) override; | |
64 | |
65 // session::mojom::ScreenlockStateListener: | |
66 void ScreenlockStateChanged(bool locked) override; | |
67 | |
68 RootWindowController* root_controller_; | |
69 mus::WindowManagerClient* window_manager_client_; | |
70 DisconnectedAppHandler disconnected_app_handler_; | |
71 | |
72 mojo::Binding<session::mojom::ScreenlockStateListener> binding_; | |
73 | |
74 DISALLOW_COPY_AND_ASSIGN(WindowManager); | |
75 }; | |
76 | |
77 } // namespace wm | |
78 } // namespace mash | |
79 | |
80 #endif // MASH_WM_WINDOW_MANAGER_H_ | |
OLD | NEW |