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

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

Issue 2301353003: Changes ownership of WindowTreeClient (Closed)
Patch Set: fix navigation Created 4 years, 3 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>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // WindowTreeClientDelegate for mash. WindowManager creates (and owns) 46 // WindowTreeClientDelegate for mash. WindowManager creates (and owns)
47 // a RootWindowController per Display. WindowManager takes ownership of 47 // a RootWindowController per Display. WindowManager takes ownership of
48 // the WindowTreeClient. 48 // the WindowTreeClient.
49 class WindowManager : public ui::WindowManagerDelegate, 49 class WindowManager : public ui::WindowManagerDelegate,
50 public ui::WindowObserver, 50 public ui::WindowObserver,
51 public ui::WindowTreeClientDelegate { 51 public ui::WindowTreeClientDelegate {
52 public: 52 public:
53 explicit WindowManager(shell::Connector* connector); 53 explicit WindowManager(shell::Connector* connector);
54 ~WindowManager() override; 54 ~WindowManager() override;
55 55
56 void Init(ui::WindowTreeClient* window_tree_client); 56 void Init(std::unique_ptr<ui::WindowTreeClient> window_tree_client);
57 57
58 WmShellMus* shell() { return shell_.get(); } 58 WmShellMus* shell() { return shell_.get(); }
59 59
60 ui::WindowTreeClient* window_tree_client() { return window_tree_client_; } 60 ui::WindowTreeClient* window_tree_client() {
61 return window_tree_client_.get();
62 }
61 63
62 ui::WindowManagerClient* window_manager_client() { 64 ui::WindowManagerClient* window_manager_client() {
63 return window_manager_client_; 65 return window_manager_client_;
64 } 66 }
65 67
66 shell::Connector* connector() { return connector_; } 68 shell::Connector* connector() { return connector_; }
67 69
68 void SetScreenLocked(bool is_locked); 70 void SetScreenLocked(bool is_locked);
69 71
70 // Creates a new top level window. 72 // Creates a new top level window.
(...skipping 12 matching lines...) Expand all
83 void AddObserver(WindowManagerObserver* observer); 85 void AddObserver(WindowManagerObserver* observer);
84 void RemoveObserver(WindowManagerObserver* observer); 86 void RemoveObserver(WindowManagerObserver* observer);
85 87
86 private: 88 private:
87 friend class WmTestHelper; 89 friend class WmTestHelper;
88 90
89 RootWindowController* CreateRootWindowController( 91 RootWindowController* CreateRootWindowController(
90 ui::Window* window, 92 ui::Window* window,
91 const display::Display& display); 93 const display::Display& display);
92 94
95 void Shutdown();
96
93 // ui::WindowObserver: 97 // ui::WindowObserver:
94 void OnWindowDestroying(ui::Window* window) override; 98 void OnWindowDestroying(ui::Window* window) override;
95 void OnWindowDestroyed(ui::Window* window) override; 99 void OnWindowDestroyed(ui::Window* window) override;
96 100
97 // WindowTreeClientDelegate: 101 // WindowTreeClientDelegate:
98 void OnEmbed(ui::Window* root) override; 102 void OnEmbed(ui::Window* root) override;
99 void OnDidDestroyClient(ui::WindowTreeClient* client) override; 103 void OnEmbedRootDestroyed(ui::Window* root) override;
104 void OnLostConnection(ui::WindowTreeClient* client) override;
100 void OnPointerEventObserved(const ui::PointerEvent& event, 105 void OnPointerEventObserved(const ui::PointerEvent& event,
101 ui::Window* target) override; 106 ui::Window* target) override;
102 107
103 // WindowManagerDelegate: 108 // WindowManagerDelegate:
104 void SetWindowManagerClient(ui::WindowManagerClient* client) override; 109 void SetWindowManagerClient(ui::WindowManagerClient* client) override;
105 bool OnWmSetBounds(ui::Window* window, gfx::Rect* bounds) override; 110 bool OnWmSetBounds(ui::Window* window, gfx::Rect* bounds) override;
106 bool OnWmSetProperty( 111 bool OnWmSetProperty(
107 ui::Window* window, 112 ui::Window* window,
108 const std::string& name, 113 const std::string& name,
109 std::unique_ptr<std::vector<uint8_t>>* new_data) override; 114 std::unique_ptr<std::vector<uint8_t>>* new_data) override;
110 ui::Window* OnWmCreateTopLevelWindow( 115 ui::Window* OnWmCreateTopLevelWindow(
111 std::map<std::string, std::vector<uint8_t>>* properties) override; 116 std::map<std::string, std::vector<uint8_t>>* properties) override;
112 void OnWmClientJankinessChanged(const std::set<ui::Window*>& client_windows, 117 void OnWmClientJankinessChanged(const std::set<ui::Window*>& client_windows,
113 bool not_responding) override; 118 bool not_responding) override;
114 void OnWmNewDisplay(ui::Window* window, 119 void OnWmNewDisplay(ui::Window* window,
115 const display::Display& display) override; 120 const display::Display& display) override;
116 void OnWmPerformMoveLoop(ui::Window* window, 121 void OnWmPerformMoveLoop(ui::Window* window,
117 ui::mojom::MoveLoopSource source, 122 ui::mojom::MoveLoopSource source,
118 const gfx::Point& cursor_location, 123 const gfx::Point& cursor_location,
119 const base::Callback<void(bool)>& on_done) override; 124 const base::Callback<void(bool)>& on_done) override;
120 void OnWmCancelMoveLoop(ui::Window* window) override; 125 void OnWmCancelMoveLoop(ui::Window* window) override;
121 ui::mojom::EventResult OnAccelerator(uint32_t id, 126 ui::mojom::EventResult OnAccelerator(uint32_t id,
122 const ui::Event& event) override; 127 const ui::Event& event) override;
123 128
124 shell::Connector* connector_; 129 shell::Connector* connector_;
125 130
126 ui::WindowTreeClient* window_tree_client_ = nullptr; 131 std::unique_ptr<ui::WindowTreeClient> window_tree_client_;
127 132
128 ui::WindowManagerClient* window_manager_client_ = nullptr; 133 ui::WindowManagerClient* window_manager_client_ = nullptr;
129 134
130 std::unique_ptr<views::PointerWatcherEventRouter> 135 std::unique_ptr<views::PointerWatcherEventRouter>
131 pointer_watcher_event_router_; 136 pointer_watcher_event_router_;
132 137
133 std::unique_ptr<ShadowController> shadow_controller_; 138 std::unique_ptr<ShadowController> shadow_controller_;
134 139
135 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_; 140 std::set<std::unique_ptr<RootWindowController>> root_window_controllers_;
136 141
137 base::ObserverList<WindowManagerObserver> observers_; 142 base::ObserverList<WindowManagerObserver> observers_;
138 143
139 std::unique_ptr<display::Screen> screen_; 144 std::unique_ptr<display::Screen> screen_;
140 145
141 std::unique_ptr<WmShellMus> shell_; 146 std::unique_ptr<WmShellMus> shell_;
142 147
143 std::unique_ptr<WmLookupMus> lookup_; 148 std::unique_ptr<WmLookupMus> lookup_;
144 149
145 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_; 150 std::map<uint16_t, AcceleratorHandler*> accelerator_handlers_;
146 uint16_t next_accelerator_namespace_id_ = 0u; 151 uint16_t next_accelerator_namespace_id_ = 0u;
147 152
148 DISALLOW_COPY_AND_ASSIGN(WindowManager); 153 DISALLOW_COPY_AND_ASSIGN(WindowManager);
149 }; 154 };
150 155
151 } // namespace mus 156 } // namespace mus
152 } // namespace ash 157 } // namespace ash
153 158
154 #endif // ASH_MUS_WINDOW_MANAGER_H_ 159 #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