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

Side by Side Diff: ui/aura/mus/window_tree_client.h

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: addressed sky/fwang/kylechar feedback (take 6), simpler mus_demo changes / passing unittests Created 3 years, 9 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 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>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/atomicops.h" 16 #include "base/atomicops.h"
17 #include "base/compiler_specific.h" 17 #include "base/compiler_specific.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/observer_list.h" 20 #include "base/observer_list.h"
21 #include "mojo/public/cpp/bindings/associated_binding.h" 21 #include "mojo/public/cpp/bindings/associated_binding.h"
22 #include "mojo/public/cpp/bindings/strong_binding.h" 22 #include "mojo/public/cpp/bindings/strong_binding.h"
23 #include "services/ui/public/interfaces/window_tree.mojom.h" 23 #include "services/ui/public/interfaces/window_tree.mojom.h"
24 #include "services/ui/public/interfaces/window_tree_host.mojom.h"
24 #include "ui/aura/aura_export.h" 25 #include "ui/aura/aura_export.h"
25 #include "ui/aura/client/transient_window_client_observer.h" 26 #include "ui/aura/client/transient_window_client_observer.h"
26 #include "ui/aura/mus/capture_synchronizer_delegate.h" 27 #include "ui/aura/mus/capture_synchronizer_delegate.h"
27 #include "ui/aura/mus/drag_drop_controller_host.h" 28 #include "ui/aura/mus/drag_drop_controller_host.h"
28 #include "ui/aura/mus/focus_synchronizer_delegate.h" 29 #include "ui/aura/mus/focus_synchronizer_delegate.h"
29 #include "ui/aura/mus/mus_types.h" 30 #include "ui/aura/mus/mus_types.h"
30 #include "ui/aura/mus/window_manager_delegate.h" 31 #include "ui/aura/mus/window_manager_delegate.h"
31 #include "ui/aura/mus/window_tree_host_mus_delegate.h" 32 #include "ui/aura/mus/window_tree_host_mus_delegate.h"
32 33
33 namespace display { 34 namespace display {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 service_manager::Connector* connector, 91 service_manager::Connector* connector,
91 WindowTreeClientDelegate* delegate, 92 WindowTreeClientDelegate* delegate,
92 WindowManagerDelegate* window_manager_delegate = nullptr, 93 WindowManagerDelegate* window_manager_delegate = nullptr,
93 ui::mojom::WindowTreeClientRequest request = nullptr, 94 ui::mojom::WindowTreeClientRequest request = nullptr,
94 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr); 95 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr);
95 ~WindowTreeClient() override; 96 ~WindowTreeClient() override;
96 97
97 // Establishes the connection by way of the WindowTreeFactory. 98 // Establishes the connection by way of the WindowTreeFactory.
98 void ConnectViaWindowTreeFactory(); 99 void ConnectViaWindowTreeFactory();
99 100
101 // Establishes the connection by way of the WindowTreeFactoryHost.
102 void ConnectViaWindowTreeHostFactory();
103
100 // Establishes the connection by way of WindowManagerWindowTreeFactory. 104 // Establishes the connection by way of WindowManagerWindowTreeFactory.
101 void ConnectAsWindowManager(); 105 void ConnectAsWindowManager();
102 106
107 // Triggers the creation of a mojom::WindowTreeHost (aka ws::Display)
108 // instance on the server side.
109 // Ends up calling back to client side, aura::WindowTreeClient::OnEmbed.
110 void CreateHost(ui::mojom::WindowTreeHostRequest host, uint32_t client_id);
111
103 service_manager::Connector* connector() { return connector_; } 112 service_manager::Connector* connector() { return connector_; }
104 ui::Gpu* gpu() { return gpu_.get(); } 113 ui::Gpu* gpu() { return gpu_.get(); }
105 CaptureSynchronizer* capture_synchronizer() { 114 CaptureSynchronizer* capture_synchronizer() {
106 return capture_synchronizer_.get(); 115 return capture_synchronizer_.get();
107 } 116 }
108 117
109 bool connected() const { return tree_ != nullptr; } 118 bool connected() const { return tree_ != nullptr; }
110 ClientSpecificId client_id() const { return client_id_; } 119 ClientSpecificId client_id() const { return client_id_; }
111 120
112 void SetCanFocus(Window* window, bool can_focus); 121 void SetCanFocus(Window* window, bool can_focus);
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void SetLocalPropertiesFromServerProperties( 221 void SetLocalPropertiesFromServerProperties(
213 WindowMus* window, 222 WindowMus* window,
214 const ui::mojom::WindowData& window_data); 223 const ui::mojom::WindowData& window_data);
215 224
216 // Creates a new WindowTreeHostMus. 225 // Creates a new WindowTreeHostMus.
217 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost( 226 std::unique_ptr<WindowTreeHostMus> CreateWindowTreeHost(
218 WindowMusType window_mus_type, 227 WindowMusType window_mus_type,
219 const ui::mojom::WindowData& window_data, 228 const ui::mojom::WindowData& window_data,
220 int64_t display_id); 229 int64_t display_id);
221 230
231 void ConfigureWindowDataFromServer(WindowTreeHostMus* window_tree_host,
232 const ui::mojom::WindowData& window_data);
233
222 WindowMus* NewWindowFromWindowData(WindowMus* parent, 234 WindowMus* NewWindowFromWindowData(WindowMus* parent,
223 const ui::mojom::WindowData& window_data); 235 const ui::mojom::WindowData& window_data);
224 236
225 // Sets the ui::mojom::WindowTree implementation. 237 // Sets the ui::mojom::WindowTree implementation.
226 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr); 238 void SetWindowTree(ui::mojom::WindowTreePtr window_tree_ptr);
227 239
228 // Called when the connection to the server is established. 240 // Called when the connection to the server is established.
229 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree); 241 void WindowTreeConnectionEstablished(ui::mojom::WindowTree* window_tree);
230 242
231 // Called when the ui::mojom::WindowTree connection is lost, deletes this. 243 // Called when the ui::mojom::WindowTree connection is lost, deletes this.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 mojo::ScopedSharedBufferMapping cursor_location_mapping_; 533 mojo::ScopedSharedBufferMapping cursor_location_mapping_;
522 534
523 base::ObserverList<WindowTreeClientObserver> observers_; 535 base::ObserverList<WindowTreeClientObserver> observers_;
524 536
525 std::unique_ptr<mojo::AssociatedBinding<ui::mojom::WindowManager>> 537 std::unique_ptr<mojo::AssociatedBinding<ui::mojom::WindowManager>>
526 window_manager_internal_; 538 window_manager_internal_;
527 ui::mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 539 ui::mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
528 540
529 bool has_pointer_watcher_ = false; 541 bool has_pointer_watcher_ = false;
530 542
543 bool in_external_window_mode_ = false;
544
531 // The current change id for the client. 545 // The current change id for the client.
532 uint32_t current_move_loop_change_ = 0u; 546 uint32_t current_move_loop_change_ = 0u;
533 547
534 // Callback executed when a move loop initiated by PerformWindowMove() is 548 // Callback executed when a move loop initiated by PerformWindowMove() is
535 // completed. 549 // completed.
536 base::Callback<void(bool)> on_current_move_finished_; 550 base::Callback<void(bool)> on_current_move_finished_;
537 551
538 // The current change id for the window manager. 552 // The current change id for the window manager.
539 uint32_t current_wm_move_loop_change_ = 0u; 553 uint32_t current_wm_move_loop_change_ = 0u;
540 Id current_wm_move_loop_window_id_ = 0u; 554 Id current_wm_move_loop_window_id_ = 0u;
541 555
542 std::unique_ptr<DragDropControllerMus> drag_drop_controller_; 556 std::unique_ptr<DragDropControllerMus> drag_drop_controller_;
543 557
544 base::ObserverList<WindowTreeClientTestObserver> test_observers_; 558 base::ObserverList<WindowTreeClientTestObserver> test_observers_;
545 559
546 std::unique_ptr<ui::Gpu> gpu_; 560 std::unique_ptr<ui::Gpu> gpu_;
547 std::unique_ptr<MusContextFactory> compositor_context_factory_; 561 std::unique_ptr<MusContextFactory> compositor_context_factory_;
548 562
549 // If |compositor_context_factory_| is installed on Env, then this is the 563 // If |compositor_context_factory_| is installed on Env, then this is the
550 // ContextFactory that was set on Env originally. 564 // ContextFactory that was set on Env originally.
551 ui::ContextFactory* initial_context_factory_ = nullptr; 565 ui::ContextFactory* initial_context_factory_ = nullptr;
566
567 ui::mojom::WindowTreeHostFactoryPtr window_tree_host_factory_ptr_;
568
552 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 569 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
553 570
554 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 571 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
555 }; 572 };
556 573
557 } // namespace aura 574 } // namespace aura
558 575
559 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ 576 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698