Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: ash/mus/window_manager.h

Issue 2072343002: Changes how window manager obtains WindowTree from mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: include Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/mus/test/wm_test_helper.cc ('k') | ash/mus/window_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 ASH_MUS_WINDOW_MANAGER_H_ 5 #ifndef ASH_MUS_WINDOW_MANAGER_H_
6 #define ASH_MUS_WINDOW_MANAGER_H_ 6 #define ASH_MUS_WINDOW_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <set>
11 12
12 #include "ash/mus/disconnected_app_handler.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/observer_list.h"
14 #include "components/mus/common/types.h" 15 #include "components/mus/common/types.h"
15 #include "components/mus/public/cpp/window_manager_delegate.h" 16 #include "components/mus/public/cpp/window_manager_delegate.h"
16 #include "components/mus/public/cpp/window_observer.h" 17 #include "components/mus/public/cpp/window_observer.h"
17 #include "components/mus/public/cpp/window_tracker.h" 18 #include "components/mus/public/cpp/window_tree_client_delegate.h"
18 #include "components/mus/public/interfaces/window_manager.mojom.h" 19 #include "components/mus/public/interfaces/window_manager.mojom.h"
19 #include "mash/session/public/interfaces/session.mojom.h" 20
20 #include "mojo/public/cpp/bindings/binding.h" 21 namespace display {
22 class Display;
23 class Screen;
24 }
25
26 namespace shell {
27 class Connector;
28 }
21 29
22 namespace ash { 30 namespace ash {
23 namespace mus { 31 namespace mus {
24 32
25 class RootWindowController; 33 class RootWindowController;
34 class RootWindowsObserver;
35 class ShadowController;
36 class WindowManagerApplication;
37 class WmShellMus;
38 class WmLookupMus;
39 class WmTestHelper;
26 40
27 class WindowManager : public ::mus::WindowTracker, 41 // WindowManager serves as the WindowManagerDelegate and
28 public ::mus::WindowManagerDelegate, 42 // WindowTreeClientDelegate for mash. WindowManager creates (and owns)
29 public mash::session::mojom::ScreenlockStateListener { 43 // a RootWindowController per Display. WindowManager takes ownership of
44 // the WindowTreeClient.
45 class WindowManager : public ::mus::WindowManagerDelegate,
46 public ::mus::WindowObserver,
47 public ::mus::WindowTreeClientDelegate {
30 public: 48 public:
31 WindowManager(); 49 WindowManager(WindowManagerApplication* window_manager_app,
50 shell::Connector* connector);
32 ~WindowManager() override; 51 ~WindowManager() override;
33 52
34 void Initialize(RootWindowController* root_controller, 53 void Init(::mus::WindowTreeClient* window_tree_client);
35 mash::session::mojom::Session* session); 54
55 WmShellMus* shell() { return shell_.get(); }
36 56
37 ::mus::WindowManagerClient* window_manager_client() { 57 ::mus::WindowManagerClient* window_manager_client() {
38 return window_manager_client_; 58 return window_manager_client_;
39 } 59 }
40 60
61 shell::Connector* connector() { return connector_; }
62
63 void SetScreenLocked(bool is_locked);
64
41 // Creates a new top level window. 65 // Creates a new top level window.
42 ::mus::Window* NewTopLevelWindow( 66 ::mus::Window* NewTopLevelWindow(
43 std::map<std::string, std::vector<uint8_t>>* properties); 67 std::map<std::string, std::vector<uint8_t>>* properties);
44 68
69 std::set<RootWindowController*> GetRootWindowControllers();
70
71 void AddRootWindowsObserver(RootWindowsObserver* observer);
72 void RemoveRootWindowsObserver(RootWindowsObserver* observer);
73
45 private: 74 private:
46 gfx::Rect CalculateDefaultBounds(::mus::Window* window) const; 75 friend class WmTestHelper;
47 gfx::Rect GetMaximizedWindowBounds() const; 76
77 void AddAccelerators();
78
79 RootWindowController* CreateRootWindowController(
80 ::mus::Window* window,
81 const display::Display& display);
48 82
49 // ::mus::WindowObserver: 83 // ::mus::WindowObserver:
50 void OnTreeChanging(const TreeChangeParams& params) override; 84 void OnWindowDestroying(::mus::Window* window) override;
85 void OnWindowDestroyed(::mus::Window* window) override;
86
87 // WindowTreeClientDelegate:
88 void OnEmbed(::mus::Window* root) override;
89 void OnWindowTreeClientDestroyed(::mus::WindowTreeClient* client) override;
90 void OnEventObserved(const ui::Event& event, ::mus::Window* target) override;
51 91
52 // WindowManagerDelegate: 92 // WindowManagerDelegate:
53 void SetWindowManagerClient(::mus::WindowManagerClient* client) override; 93 void SetWindowManagerClient(::mus::WindowManagerClient* client) override;
54 bool OnWmSetBounds(::mus::Window* window, gfx::Rect* bounds) override; 94 bool OnWmSetBounds(::mus::Window* window, gfx::Rect* bounds) override;
55 bool OnWmSetProperty( 95 bool OnWmSetProperty(
56 ::mus::Window* window, 96 ::mus::Window* window,
57 const std::string& name, 97 const std::string& name,
58 std::unique_ptr<std::vector<uint8_t>>* new_data) override; 98 std::unique_ptr<std::vector<uint8_t>>* new_data) override;
59 ::mus::Window* OnWmCreateTopLevelWindow( 99 ::mus::Window* OnWmCreateTopLevelWindow(
60 std::map<std::string, std::vector<uint8_t>>* properties) override; 100 std::map<std::string, std::vector<uint8_t>>* properties) override;
61 void OnWmClientJankinessChanged( 101 void OnWmClientJankinessChanged(
62 const std::set<::mus::Window*>& client_windows, 102 const std::set<::mus::Window*>& client_windows,
63 bool not_responding) override; 103 bool not_responding) override;
104 void OnWmNewDisplay(::mus::Window* window,
105 const display::Display& display) override;
64 void OnAccelerator(uint32_t id, const ui::Event& event) override; 106 void OnAccelerator(uint32_t id, const ui::Event& event) override;
65 107
66 // session::mojom::ScreenlockStateListener: 108 // TODO(sky): this is unfortunate, remove.
67 void ScreenlockStateChanged(bool locked) override; 109 WindowManagerApplication* window_manager_app_;
68 110
69 RootWindowController* root_controller_; 111 shell::Connector* connector_;
70 ::mus::WindowManagerClient* window_manager_client_;
71 DisconnectedAppHandler disconnected_app_handler_;
72 112
73 mojo::Binding<mash::session::mojom::ScreenlockStateListener> binding_; 113 ::mus::WindowTreeClient* window_tree_client_ = nullptr;
114
115 ::mus::WindowManagerClient* window_manager_client_ = nullptr;
116
117 std::unique_ptr<ShadowController> shadow_controller_;
118
119 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_;
120
121 base::ObserverList<RootWindowsObserver> root_windows_observers_;
122
123 std::unique_ptr<display::Screen> screen_;
124
125 std::unique_ptr<WmShellMus> shell_;
126
127 std::unique_ptr<WmLookupMus> lookup_;
74 128
75 DISALLOW_COPY_AND_ASSIGN(WindowManager); 129 DISALLOW_COPY_AND_ASSIGN(WindowManager);
76 }; 130 };
77 131
78 } // namespace mus 132 } // namespace mus
79 } // namespace ash 133 } // namespace ash
80 134
81 #endif // ASH_MUS_WINDOW_MANAGER_H_ 135 #endif // ASH_MUS_WINDOW_MANAGER_H_
OLDNEW
« no previous file with comments | « ash/mus/test/wm_test_helper.cc ('k') | ash/mus/window_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698