| 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 UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 5 #ifndef UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
| 6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 6 #define UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 using IdToWindowMap = std::map<Id, WindowMus*>; | 175 using IdToWindowMap = std::map<Id, WindowMus*>; |
| 176 | 176 |
| 177 // TODO(sky): this assumes change_ids never wrap, which is a bad assumption. | 177 // TODO(sky): this assumes change_ids never wrap, which is a bad assumption. |
| 178 using InFlightMap = std::map<uint32_t, std::unique_ptr<InFlightChange>>; | 178 using InFlightMap = std::map<uint32_t, std::unique_ptr<InFlightChange>>; |
| 179 | 179 |
| 180 void RegisterWindowMus(WindowMus* window); | 180 void RegisterWindowMus(WindowMus* window); |
| 181 | 181 |
| 182 WindowMus* GetWindowByServerId(Id id); | 182 WindowMus* GetWindowByServerId(Id id); |
| 183 | 183 |
| 184 bool IsWindowKnown(aura::Window* window); |
| 185 |
| 184 // Returns the oldest InFlightChange that matches |change|. | 186 // Returns the oldest InFlightChange that matches |change|. |
| 185 InFlightChange* GetOldestInFlightChangeMatching(const InFlightChange& change); | 187 InFlightChange* GetOldestInFlightChangeMatching(const InFlightChange& change); |
| 186 | 188 |
| 187 // See InFlightChange for details on how InFlightChanges are used. | 189 // See InFlightChange for details on how InFlightChanges are used. |
| 188 uint32_t ScheduleInFlightChange(std::unique_ptr<InFlightChange> change); | 190 uint32_t ScheduleInFlightChange(std::unique_ptr<InFlightChange> change); |
| 189 | 191 |
| 190 // Returns true if there is an InFlightChange that matches |change|. If there | 192 // Returns true if there is an InFlightChange that matches |change|. If there |
| 191 // is an existing change SetRevertValueFrom() is invoked on it. Returns false | 193 // is an existing change SetRevertValueFrom() is invoked on it. Returns false |
| 192 // if there is no InFlightChange matching |change|. | 194 // if there is no InFlightChange matching |change|. |
| 193 // See InFlightChange for details on how InFlightChanges are used. | 195 // See InFlightChange for details on how InFlightChanges are used. |
| 194 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); | 196 bool ApplyServerChangeToExistingInFlightChange(const InFlightChange& change); |
| 195 | 197 |
| 196 void BuildWindowTree(const std::vector<ui::mojom::WindowDataPtr>& windows); | 198 void BuildWindowTree(const std::vector<ui::mojom::WindowDataPtr>& windows); |
| 197 | 199 |
| 200 // If the window identified by |window_data| doesn't exist a new window is |
| 201 // created, otherwise the existing window is updated based on |window_data|. |
| 202 void CreateOrUpdateWindowFromWindowData( |
| 203 const ui::mojom::WindowData& window_data); |
| 204 |
| 198 // Creates a WindowPortMus from the server side data. | 205 // Creates a WindowPortMus from the server side data. |
| 199 std::unique_ptr<WindowPortMus> CreateWindowPortMus( | 206 std::unique_ptr<WindowPortMus> CreateWindowPortMus( |
| 200 const ui::mojom::WindowDataPtr& window_data, | 207 const ui::mojom::WindowData& window_data, |
| 201 WindowMusType window_mus_type); | 208 WindowMusType window_mus_type); |
| 202 | 209 |
| 203 // Sets local properties on the associated Window from the server properties. | 210 // Sets local properties on the associated Window from the server properties. |
| 204 void SetLocalPropertiesFromServerProperties( | 211 void SetLocalPropertiesFromServerProperties( |
| 205 WindowMus* window, | 212 WindowMus* window, |
| 206 const ui::mojom::WindowDataPtr& window_data); | 213 const ui::mojom::WindowData& window_data); |
| 207 | 214 |
| 208 // Creates a new WindowTreeHostMus. | 215 // Creates a new WindowTreeHostMus. |
| 209 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost( | 216 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost( |
| 210 WindowMusType window_mus_type, | 217 WindowMusType window_mus_type, |
| 211 const ui::mojom::WindowDataPtr& window_data, | 218 const ui::mojom::WindowData& window_data, |
| 212 int64_t display_id); | 219 int64_t display_id); |
| 213 | 220 |
| 214 WindowMus* NewWindowFromWindowData( | 221 WindowMus* NewWindowFromWindowData(WindowMus* parent, |
| 215 WindowMus* parent, | 222 const ui::mojom::WindowData& window_data); |
| 216 const ui::mojom::WindowDataPtr& window_data); | |
| 217 | 223 |
| 218 // Sets the ui::mojom::WindowTree implementation. | 224 // Sets the ui::mojom::WindowTree implementation. |
| 219 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); | 225 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); |
| 220 | 226 |
| 221 // Called when the connection to the server is established. | 227 // Called when the connection to the server is established. |
| 222 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); | 228 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); |
| 223 | 229 |
| 224 // Called when the ui::mojom::WindowTree connection is lost, deletes this. | 230 // Called when the ui::mojom::WindowTree connection is lost, deletes this. |
| 225 void OnConnectionLost(); | 231 void OnConnectionLost(); |
| 226 | 232 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 std::unique_ptr<DragDropControllerMus> drag_drop_controller_; | 521 std::unique_ptr<DragDropControllerMus> drag_drop_controller_; |
| 516 | 522 |
| 517 base::WeakPtrFactory<WindowTreeClient> weak_factory_; | 523 base::WeakPtrFactory<WindowTreeClient> weak_factory_; |
| 518 | 524 |
| 519 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); | 525 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); |
| 520 }; | 526 }; |
| 521 | 527 |
| 522 } // namespace aura | 528 } // namespace aura |
| 523 | 529 |
| 524 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ | 530 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ |
| OLD | NEW |