| OLD | NEW |
| 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_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 void RemoveChild(Window* parent, Id child_id); | 59 void RemoveChild(Window* parent, Id child_id); |
| 60 | 60 |
| 61 void AddTransientWindow(Window* window, Id transient_window_id); | 61 void AddTransientWindow(Window* window, Id transient_window_id); |
| 62 void RemoveTransientWindowFromParent(Window* window); | 62 void RemoveTransientWindowFromParent(Window* window); |
| 63 | 63 |
| 64 void Reorder(Window* window, | 64 void Reorder(Window* window, |
| 65 Id relative_window_id, | 65 Id relative_window_id, |
| 66 mojom::OrderDirection direction); | 66 mojom::OrderDirection direction); |
| 67 | 67 |
| 68 // Returns true if the specified window was created by this connection. | 68 // Returns true if the specified window was created by this connection. |
| 69 bool OwnsWindow(Id id) const; | 69 bool OwnsWindow(Window* window) const; |
| 70 | 70 |
| 71 void SetBounds(Window* window, | 71 void SetBounds(Window* window, |
| 72 const gfx::Rect& old_bounds, | 72 const gfx::Rect& old_bounds, |
| 73 const gfx::Rect& bounds); | 73 const gfx::Rect& bounds); |
| 74 void SetClientArea(Id window_id, | 74 void SetClientArea(Id window_id, |
| 75 const gfx::Insets& client_area, | 75 const gfx::Insets& client_area, |
| 76 const std::vector<gfx::Rect>& additional_client_areas); | 76 const std::vector<gfx::Rect>& additional_client_areas); |
| 77 void SetFocus(Window* window); | 77 void SetFocus(Window* window); |
| 78 void SetCanFocus(Id window_id, bool can_focus); | 78 void SetCanFocus(Id window_id, bool can_focus); |
| 79 void SetPredefinedCursor(Id window_id, mus::mojom::Cursor cursor_id); | 79 void SetPredefinedCursor(Id window_id, mus::mojom::Cursor cursor_id); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 | 109 |
| 110 bool is_embed_root() const { return is_embed_root_; } | 110 bool is_embed_root() const { return is_embed_root_; } |
| 111 | 111 |
| 112 // Called after the window's observers have been notified of destruction (as | 112 // Called after the window's observers have been notified of destruction (as |
| 113 // the last step of ~Window). | 113 // the last step of ~Window). |
| 114 void OnWindowDestroyed(Window* window); | 114 void OnWindowDestroyed(Window* window); |
| 115 | 115 |
| 116 private: | 116 private: |
| 117 friend class WindowTreeClientImplPrivate; | 117 friend class WindowTreeClientImplPrivate; |
| 118 | 118 |
| 119 enum class NewWindowType { |
| 120 CHILD, |
| 121 TOP_LEVEL, |
| 122 }; |
| 123 |
| 119 using IdToWindowMap = std::map<Id, Window*>; | 124 using IdToWindowMap = std::map<Id, Window*>; |
| 120 | 125 |
| 121 using InFlightMap = std::map<uint32_t, scoped_ptr<InFlightChange>>; | 126 using InFlightMap = std::map<uint32_t, scoped_ptr<InFlightChange>>; |
| 122 | 127 |
| 123 // Returns the oldest InFlightChange that matches |change|. | 128 // Returns the oldest InFlightChange that matches |change|. |
| 124 InFlightChange* GetOldestInFlightChangeMatching(const InFlightChange& change); | 129 InFlightChange* GetOldestInFlightChangeMatching(const InFlightChange& change); |
| 125 | 130 |
| 126 // See InFlightChange for details on how InFlightChanges are used. | 131 // See InFlightChange for details on how InFlightChanges are used. |
| 127 uint32_t ScheduleInFlightChange(scoped_ptr<InFlightChange> change); | 132 uint32_t ScheduleInFlightChange(scoped_ptr<InFlightChange> change); |
| 128 | 133 |
| 129 // Returns true if there is an InFlightChange that matches |change|. If there | 134 // Returns true if there is an InFlightChange that matches |change|. If there |
| 130 // is an existing change SetRevertValueFrom() is invoked on it. Returns false | 135 // is an existing change SetRevertValueFrom() is invoked on it. Returns false |
| 131 // if there is no InFlightChange matching |change|. | 136 // if there is no InFlightChange matching |change|. |
| 132 // See InFlightChange for details on how InFlightChanges are used. | 137 // See InFlightChange for details on how InFlightChanges are used. |
| 133 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); | 138 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); |
| 134 | 139 |
| 140 Window* NewWindowImpl(NewWindowType type, |
| 141 const Window::SharedProperties* properties); |
| 142 |
| 135 // OnEmbed() calls into this. Exposed as a separate function for testing. | 143 // OnEmbed() calls into this. Exposed as a separate function for testing. |
| 136 void OnEmbedImpl(mojom::WindowTree* window_tree, | 144 void OnEmbedImpl(mojom::WindowTree* window_tree, |
| 137 ConnectionSpecificId connection_id, | 145 ConnectionSpecificId connection_id, |
| 138 mojom::WindowDataPtr root_data, | 146 mojom::WindowDataPtr root_data, |
| 139 Id focused_window_id, | 147 Id focused_window_id, |
| 140 uint32_t access_policy); | 148 uint32_t access_policy); |
| 141 | 149 |
| 142 // Overridden from WindowTreeConnection: | 150 // Overridden from WindowTreeConnection: |
| 143 void SetDeleteOnNoRoots(bool value) override; | 151 void SetDeleteOnNoRoots(bool value) override; |
| 144 const std::set<Window*>& GetRoots() override; | 152 const std::set<Window*>& GetRoots() override; |
| 145 Window* GetWindowById(Id id) override; | 153 Window* GetWindowById(Id id) override; |
| 146 Window* GetFocusedWindow() override; | 154 Window* GetFocusedWindow() override; |
| 147 Window* NewWindow(const Window::SharedProperties* properties) override; | 155 Window* NewWindow(const Window::SharedProperties* properties) override; |
| 156 Window* NewTopLevelWindow( |
| 157 const Window::SharedProperties* properties) override; |
| 148 bool IsEmbedRoot() override; | 158 bool IsEmbedRoot() override; |
| 149 ConnectionSpecificId GetConnectionId() override; | 159 ConnectionSpecificId GetConnectionId() override; |
| 150 void AddObserver(WindowTreeConnectionObserver* observer) override; | 160 void AddObserver(WindowTreeConnectionObserver* observer) override; |
| 151 void RemoveObserver(WindowTreeConnectionObserver* observer) override; | 161 void RemoveObserver(WindowTreeConnectionObserver* observer) override; |
| 152 | 162 |
| 153 // Overridden from WindowTreeClient: | 163 // Overridden from WindowTreeClient: |
| 154 void OnEmbed(ConnectionSpecificId connection_id, | 164 void OnEmbed(ConnectionSpecificId connection_id, |
| 155 mojom::WindowDataPtr root, | 165 mojom::WindowDataPtr root, |
| 156 mojom::WindowTreePtr tree, | 166 mojom::WindowTreePtr tree, |
| 157 Id focused_window_id, | 167 Id focused_window_id, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 override; | 210 override; |
| 201 | 211 |
| 202 // Overridden from WindowManagerInternal: | 212 // Overridden from WindowManagerInternal: |
| 203 void WmSetBounds(uint32_t change_id, | 213 void WmSetBounds(uint32_t change_id, |
| 204 Id window_id, | 214 Id window_id, |
| 205 mojo::RectPtr transit_bounds) override; | 215 mojo::RectPtr transit_bounds) override; |
| 206 void WmSetProperty(uint32_t change_id, | 216 void WmSetProperty(uint32_t change_id, |
| 207 Id window_id, | 217 Id window_id, |
| 208 const mojo::String& name, | 218 const mojo::String& name, |
| 209 mojo::Array<uint8_t> transit_data) override; | 219 mojo::Array<uint8_t> transit_data) override; |
| 220 void WmCreateTopLevelWindow(uint32_t change_id, |
| 221 mojo::Map<mojo::String, mojo::Array<uint8_t>> |
| 222 transport_properties) override; |
| 210 | 223 |
| 211 // This is set once and only once when we get OnEmbed(). It gives the unique | 224 // This is set once and only once when we get OnEmbed(). It gives the unique |
| 212 // id for this connection. | 225 // id for this connection. |
| 213 ConnectionSpecificId connection_id_; | 226 ConnectionSpecificId connection_id_; |
| 214 | 227 |
| 215 // Id assigned to the next window created. | 228 // Id assigned to the next window created. |
| 216 ConnectionSpecificId next_window_id_; | 229 ConnectionSpecificId next_window_id_; |
| 217 | 230 |
| 218 // Id used for the next change id supplied to the server. | 231 // Id used for the next change id supplied to the server. |
| 219 uint32_t next_change_id_; | 232 uint32_t next_change_id_; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 247 window_manager_internal_; | 260 window_manager_internal_; |
| 248 mojom::WindowManagerInternalClientAssociatedPtr | 261 mojom::WindowManagerInternalClientAssociatedPtr |
| 249 window_manager_internal_client_; | 262 window_manager_internal_client_; |
| 250 | 263 |
| 251 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); | 264 MOJO_DISALLOW_COPY_AND_ASSIGN(WindowTreeClientImpl); |
| 252 }; | 265 }; |
| 253 | 266 |
| 254 } // namespace mus | 267 } // namespace mus |
| 255 | 268 |
| 256 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ | 269 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_WINDOW_TREE_CLIENT_IMPL_H_ |
| OLD | NEW |