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

Side by Side Diff: components/mus/ws/window_server.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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_MUS_WS_WINDOW_SERVER_H_ 5 #ifndef COMPONENTS_MUS_WS_WINDOW_SERVER_H_
6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_H_ 6 #define COMPONENTS_MUS_WS_WINDOW_SERVER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <memory> 11 #include <memory>
12 #include <string> 12 #include <string>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "components/mus/public/interfaces/window_manager_factory.mojom.h" 16 #include "components/mus/public/interfaces/window_manager_window_tree_factory.mo jom.h"
17 #include "components/mus/public/interfaces/window_tree.mojom.h" 17 #include "components/mus/public/interfaces/window_tree.mojom.h"
18 #include "components/mus/public/interfaces/window_tree_host.mojom.h" 18 #include "components/mus/public/interfaces/window_tree_host.mojom.h"
19 #include "components/mus/surfaces/surfaces_state.h" 19 #include "components/mus/surfaces/surfaces_state.h"
20 #include "components/mus/ws/display.h" 20 #include "components/mus/ws/display.h"
21 #include "components/mus/ws/display_manager_delegate.h" 21 #include "components/mus/ws/display_manager_delegate.h"
22 #include "components/mus/ws/ids.h" 22 #include "components/mus/ws/ids.h"
23 #include "components/mus/ws/operation.h" 23 #include "components/mus/ws/operation.h"
24 #include "components/mus/ws/server_window_delegate.h" 24 #include "components/mus/ws/server_window_delegate.h"
25 #include "components/mus/ws/server_window_observer.h" 25 #include "components/mus/ws/server_window_observer.h"
26 #include "components/mus/ws/user_id_tracker.h" 26 #include "components/mus/ws/user_id_tracker.h"
27 #include "components/mus/ws/window_manager_factory_registry.h" 27 #include "components/mus/ws/window_manager_window_tree_factory_set.h"
28 #include "mojo/public/cpp/bindings/array.h" 28 #include "mojo/public/cpp/bindings/array.h"
29 #include "mojo/public/cpp/bindings/binding.h" 29 #include "mojo/public/cpp/bindings/binding.h"
30 30
31 namespace mus { 31 namespace mus {
32 namespace ws { 32 namespace ws {
33 33
34 class AccessPolicy; 34 class AccessPolicy;
35 class DisplayManager; 35 class DisplayManager;
36 class ServerWindow; 36 class ServerWindow;
37 class WindowManagerState; 37 class WindowManagerState;
(...skipping 14 matching lines...) Expand all
52 WindowServerDelegate* delegate() { return delegate_; } 52 WindowServerDelegate* delegate() { return delegate_; }
53 53
54 UserIdTracker* user_id_tracker() { return &user_id_tracker_; } 54 UserIdTracker* user_id_tracker() { return &user_id_tracker_; }
55 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; } 55 const UserIdTracker* user_id_tracker() const { return &user_id_tracker_; }
56 56
57 DisplayManager* display_manager() { return display_manager_.get(); } 57 DisplayManager* display_manager() { return display_manager_.get(); }
58 const DisplayManager* display_manager() const { 58 const DisplayManager* display_manager() const {
59 return display_manager_.get(); 59 return display_manager_.get();
60 } 60 }
61 61
62 bool created_one_display() const { return created_one_display_; }
63
62 // Creates a new ServerWindow. The return value is owned by the caller, but 64 // Creates a new ServerWindow. The return value is owned by the caller, but
63 // must be destroyed before WindowServer. 65 // must be destroyed before WindowServer.
64 ServerWindow* CreateServerWindow( 66 ServerWindow* CreateServerWindow(
65 const WindowId& id, 67 const WindowId& id,
66 const std::map<std::string, std::vector<uint8_t>>& properties); 68 const std::map<std::string, std::vector<uint8_t>>& properties);
67 69
68 // Returns the id for the next WindowTree. 70 // Returns the id for the next WindowTree.
69 ClientSpecificId GetAndAdvanceNextClientId(); 71 ClientSpecificId GetAndAdvanceNextClientId();
70 72
71 // See description of WindowTree::Embed() for details. This assumes 73 // See description of WindowTree::Embed() for details. This assumes
72 // |transport_window_id| is valid. 74 // |transport_window_id| is valid.
73 WindowTree* EmbedAtWindow(ServerWindow* root, 75 WindowTree* EmbedAtWindow(ServerWindow* root,
74 const UserId& user_id, 76 const UserId& user_id,
75 mojom::WindowTreeClientPtr client, 77 mojom::WindowTreeClientPtr client,
76 std::unique_ptr<AccessPolicy> access_policy); 78 std::unique_ptr<AccessPolicy> access_policy);
77 79
78 // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to 80 // Adds |tree_impl_ptr| to the set of known trees. Use DestroyTree() to
79 // destroy the tree. 81 // destroy the tree.
80 WindowTree* AddTree(std::unique_ptr<WindowTree> tree_impl_ptr, 82 void AddTree(std::unique_ptr<WindowTree> tree_impl_ptr,
81 std::unique_ptr<WindowTreeBinding> binding, 83 std::unique_ptr<WindowTreeBinding> binding,
82 mojom::WindowTreePtr tree_ptr); 84 mojom::WindowTreePtr tree_ptr);
83 WindowTree* CreateTreeForWindowManager(Display* display, 85 WindowTree* CreateTreeForWindowManager(
84 mojom::WindowManagerFactory* factory, 86 const UserId& user_id,
85 ServerWindow* root, 87 mojom::WindowTreeRequest window_tree_request,
86 const UserId& user_id); 88 mojom::WindowTreeClientPtr window_tree_client);
87 // Invoked when a WindowTree's connection encounters an error. 89 // Invoked when a WindowTree's connection encounters an error.
88 void DestroyTree(WindowTree* tree); 90 void DestroyTree(WindowTree* tree);
89 91
90 // Returns the tree by client id. 92 // Returns the tree by client id.
91 WindowTree* GetTreeWithId(ClientSpecificId client_id); 93 WindowTree* GetTreeWithId(ClientSpecificId client_id);
92 94
93 WindowTree* GetTreeWithClientName(const std::string& client_name); 95 WindowTree* GetTreeWithClientName(const std::string& client_name);
94 96
95 size_t num_trees() const { return tree_map_.size(); } 97 size_t num_trees() const { return tree_map_.size(); }
96 98
(...skipping 21 matching lines...) Expand all
118 // Returns true if OnTreeMessagedClient() was invoked for id. 120 // Returns true if OnTreeMessagedClient() was invoked for id.
119 bool DidTreeMessageClient(ClientSpecificId id) const; 121 bool DidTreeMessageClient(ClientSpecificId id) const;
120 122
121 // Returns the WindowTree that has |id| as a root. 123 // Returns the WindowTree that has |id| as a root.
122 WindowTree* GetTreeWithRoot(const ServerWindow* window) { 124 WindowTree* GetTreeWithRoot(const ServerWindow* window) {
123 return const_cast<WindowTree*>( 125 return const_cast<WindowTree*>(
124 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window)); 126 const_cast<const WindowServer*>(this)->GetTreeWithRoot(window));
125 } 127 }
126 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const; 128 const WindowTree* GetTreeWithRoot(const ServerWindow* window) const;
127 129
128 void OnFirstWindowManagerFactorySet(); 130 void OnFirstWindowManagerWindowTreeFactoryReady();
129 131
130 WindowManagerFactoryRegistry* window_manager_factory_registry() { 132 WindowManagerWindowTreeFactorySet* window_manager_window_tree_factory_set() {
131 return &window_manager_factory_registry_; 133 return &window_manager_window_tree_factory_set_;
132 } 134 }
133 135
134 // Sets focus to |window|. Returns true if |window| already has focus, or 136 // Sets focus to |window|. Returns true if |window| already has focus, or
135 // focus was successfully changed. Returns |false| if |window| is not a valid 137 // focus was successfully changed. Returns |false| if |window| is not a valid
136 // window to receive focus. 138 // window to receive focus.
137 bool SetFocusedWindow(ServerWindow* window); 139 bool SetFocusedWindow(ServerWindow* window);
138 ServerWindow* GetFocusedWindow(); 140 ServerWindow* GetFocusedWindow();
139 141
140 // Returns a change id for the window manager that is associated with 142 // Returns a change id for the window manager that is associated with
141 // |source| and |client_change_id|. When the window manager replies 143 // |source| and |client_change_id|. When the window manager replies
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 305
304 // Maps from window manager change id to the client that initiated the 306 // Maps from window manager change id to the client that initiated the
305 // request. 307 // request.
306 InFlightWindowManagerChangeMap in_flight_wm_change_map_; 308 InFlightWindowManagerChangeMap in_flight_wm_change_map_;
307 309
308 // Next id supplied to the window manager. 310 // Next id supplied to the window manager.
309 uint32_t next_wm_change_id_; 311 uint32_t next_wm_change_id_;
310 312
311 base::Callback<void(ServerWindow*)> window_paint_callback_; 313 base::Callback<void(ServerWindow*)> window_paint_callback_;
312 314
313 WindowManagerFactoryRegistry window_manager_factory_registry_; 315 WindowManagerWindowTreeFactorySet window_manager_window_tree_factory_set_;
316
317 // TODO(sky): remove this, temporary until window manager state made global
318 // and not per display.
319 bool created_one_display_ = false;
314 320
315 DISALLOW_COPY_AND_ASSIGN(WindowServer); 321 DISALLOW_COPY_AND_ASSIGN(WindowServer);
316 }; 322 };
317 323
318 } // namespace ws 324 } // namespace ws
319 } // namespace mus 325 } // namespace mus
320 326
321 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_ 327 #endif // COMPONENTS_MUS_WS_WINDOW_SERVER_H_
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_window_tree_factory_set_observer.h ('k') | components/mus/ws/window_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698