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

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 feedback (take 5), 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,
kylechar 2017/03/07 18:19:39 What does this do?
tonikitoo 2017/03/07 20:09:36 There is some 'window data' info coming from the s
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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 mojo::ScopedSharedBufferMapping cursor_location_mapping_; 528 mojo::ScopedSharedBufferMapping cursor_location_mapping_;
517 529
518 base::ObserverList<WindowTreeClientObserver> observers_; 530 base::ObserverList<WindowTreeClientObserver> observers_;
519 531
520 std::unique_ptr<mojo::AssociatedBinding<ui::mojom::WindowManager>> 532 std::unique_ptr<mojo::AssociatedBinding<ui::mojom::WindowManager>>
521 window_manager_internal_; 533 window_manager_internal_;
522 ui::mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_; 534 ui::mojom::WindowManagerClientAssociatedPtr window_manager_internal_client_;
523 535
524 bool has_pointer_watcher_ = false; 536 bool has_pointer_watcher_ = false;
525 537
538 bool in_external_window_mode_ = false;
539
526 // The current change id for the client. 540 // The current change id for the client.
527 uint32_t current_move_loop_change_ = 0u; 541 uint32_t current_move_loop_change_ = 0u;
528 542
529 // Callback executed when a move loop initiated by PerformWindowMove() is 543 // Callback executed when a move loop initiated by PerformWindowMove() is
530 // completed. 544 // completed.
531 base::Callback<void(bool)> on_current_move_finished_; 545 base::Callback<void(bool)> on_current_move_finished_;
532 546
533 // The current change id for the window manager. 547 // The current change id for the window manager.
534 uint32_t current_wm_move_loop_change_ = 0u; 548 uint32_t current_wm_move_loop_change_ = 0u;
535 Id current_wm_move_loop_window_id_ = 0u; 549 Id current_wm_move_loop_window_id_ = 0u;
536 550
537 std::unique_ptr<DragDropControllerMus> drag_drop_controller_; 551 std::unique_ptr<DragDropControllerMus> drag_drop_controller_;
538 552
539 base::ObserverList<WindowTreeClientTestObserver> test_observers_; 553 base::ObserverList<WindowTreeClientTestObserver> test_observers_;
540 554
541 std::unique_ptr<ui::Gpu> gpu_; 555 std::unique_ptr<ui::Gpu> gpu_;
542 std::unique_ptr<MusContextFactory> compositor_context_factory_; 556 std::unique_ptr<MusContextFactory> compositor_context_factory_;
543 557
544 // If |compositor_context_factory_| is installed on Env, then this is the 558 // If |compositor_context_factory_| is installed on Env, then this is the
545 // ContextFactory that was set on Env originally. 559 // ContextFactory that was set on Env originally.
546 ui::ContextFactory* initial_context_factory_ = nullptr; 560 ui::ContextFactory* initial_context_factory_ = nullptr;
561
562 ui::mojom::WindowTreeHostFactoryPtr window_tree_host_factory_ptr_;
563
547 base::WeakPtrFactory<WindowTreeClient> weak_factory_; 564 base::WeakPtrFactory<WindowTreeClient> weak_factory_;
548 565
549 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient); 566 DISALLOW_COPY_AND_ASSIGN(WindowTreeClient);
550 }; 567 };
551 568
552 } // namespace aura 569 } // namespace aura
553 570
554 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_ 571 #endif // UI_AURA_MUS_WINDOW_TREE_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698