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

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

Issue 2644093002: aura: Some change to how the client-lib is set up. (Closed)
Patch Set: . Created 3 years, 11 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
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "ui/aura/mus/window_tree_client.h" 5 #include "ui/aura/mus/window_tree_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/auto_reset.h" 13 #include "base/auto_reset.h"
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "mojo/public/cpp/bindings/map.h" 16 #include "mojo/public/cpp/bindings/map.h"
17 #include "services/service_manager/public/cpp/connector.h" 17 #include "services/service_manager/public/cpp/connector.h"
18 #include "services/ui/common/accelerator_util.h" 18 #include "services/ui/common/accelerator_util.h"
19 #include "services/ui/public/cpp/gpu/gpu.h"
19 #include "services/ui/public/cpp/property_type_converters.h" 20 #include "services/ui/public/cpp/property_type_converters.h"
20 #include "services/ui/public/interfaces/constants.mojom.h" 21 #include "services/ui/public/interfaces/constants.mojom.h"
21 #include "services/ui/public/interfaces/window_manager.mojom.h" 22 #include "services/ui/public/interfaces/window_manager.mojom.h"
22 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h" 23 #include "services/ui/public/interfaces/window_manager_window_tree_factory.mojom .h"
23 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
24 #include "ui/aura/client/drag_drop_client.h" 25 #include "ui/aura/client/drag_drop_client.h"
25 #include "ui/aura/client/transient_window_client.h" 26 #include "ui/aura/client/transient_window_client.h"
27 #include "ui/aura/env.h"
26 #include "ui/aura/mus/capture_synchronizer.h" 28 #include "ui/aura/mus/capture_synchronizer.h"
27 #include "ui/aura/mus/drag_drop_controller_mus.h" 29 #include "ui/aura/mus/drag_drop_controller_mus.h"
28 #include "ui/aura/mus/focus_synchronizer.h" 30 #include "ui/aura/mus/focus_synchronizer.h"
29 #include "ui/aura/mus/in_flight_change.h" 31 #include "ui/aura/mus/in_flight_change.h"
30 #include "ui/aura/mus/input_method_mus.h" 32 #include "ui/aura/mus/input_method_mus.h"
33 #include "ui/aura/mus/mus_context_factory.h"
31 #include "ui/aura/mus/property_converter.h" 34 #include "ui/aura/mus/property_converter.h"
32 #include "ui/aura/mus/property_utils.h" 35 #include "ui/aura/mus/property_utils.h"
33 #include "ui/aura/mus/window_manager_delegate.h" 36 #include "ui/aura/mus/window_manager_delegate.h"
34 #include "ui/aura/mus/window_mus.h" 37 #include "ui/aura/mus/window_mus.h"
35 #include "ui/aura/mus/window_port_mus.h" 38 #include "ui/aura/mus/window_port_mus.h"
36 #include "ui/aura/mus/window_tree_client_delegate.h" 39 #include "ui/aura/mus/window_tree_client_delegate.h"
37 #include "ui/aura/mus/window_tree_client_observer.h" 40 #include "ui/aura/mus/window_tree_client_observer.h"
38 #include "ui/aura/mus/window_tree_host_mus.h" 41 #include "ui/aura/mus/window_tree_host_mus.h"
39 #include "ui/aura/window.h" 42 #include "ui/aura/window.h"
40 #include "ui/aura/window_delegate.h" 43 #include "ui/aura/window_delegate.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 ->GetDisplayNearestWindow(window) 143 ->GetDisplayNearestWindow(window)
141 .device_scale_factor(); 144 .device_scale_factor();
142 } 145 }
143 146
144 } // namespace 147 } // namespace
145 148
146 WindowTreeClient::WindowTreeClient( 149 WindowTreeClient::WindowTreeClient(
147 service_manager::Connector* connector, 150 service_manager::Connector* connector,
148 WindowTreeClientDelegate* delegate, 151 WindowTreeClientDelegate* delegate,
149 WindowManagerDelegate* window_manager_delegate, 152 WindowManagerDelegate* window_manager_delegate,
150 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request) 153 mojo::InterfaceRequest<ui::mojom::WindowTreeClient> request,
154 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner)
151 : connector_(connector), 155 : connector_(connector),
152 client_id_(0), 156 client_id_(0),
153 next_window_id_(1), 157 next_window_id_(1),
154 next_change_id_(1), 158 next_change_id_(1),
155 delegate_(delegate), 159 delegate_(delegate),
156 window_manager_delegate_(window_manager_delegate), 160 window_manager_delegate_(window_manager_delegate),
157 binding_(this), 161 binding_(this),
158 tree_(nullptr), 162 tree_(nullptr),
159 in_destructor_(false), 163 in_destructor_(false),
160 weak_factory_(this) { 164 weak_factory_(this) {
161 // Allow for a null request in tests. 165 // Allow for a null request in tests.
162 if (request.is_pending()) 166 if (request.is_pending())
163 binding_.Bind(std::move(request)); 167 binding_.Bind(std::move(request));
164 client::GetTransientWindowClient()->AddObserver(this); 168 client::GetTransientWindowClient()->AddObserver(this);
165 if (window_manager_delegate) 169 if (window_manager_delegate)
166 window_manager_delegate->SetWindowManagerClient(this); 170 window_manager_delegate->SetWindowManagerClient(this);
171 if (connector) { // |connector| can be null in tests.
172 gpu_ = ui::Gpu::Create(connector, std::move(io_task_runner));
173 compositor_context_factory_ =
174 base::MakeUnique<MusContextFactory>(gpu_.get());
175 Env::GetInstance()->set_context_factory(compositor_context_factory_.get());
176 }
167 } 177 }
168 178
169 WindowTreeClient::~WindowTreeClient() { 179 WindowTreeClient::~WindowTreeClient() {
170 in_destructor_ = true; 180 in_destructor_ = true;
171 181
172 for (WindowTreeClientObserver& observer : observers_) 182 for (WindowTreeClientObserver& observer : observers_)
173 observer.OnWillDestroyClient(this); 183 observer.OnWillDestroyClient(this);
174 184
175 std::vector<Window*> non_owned; 185 std::vector<Window*> non_owned;
176 WindowTracker tracker; 186 WindowTracker tracker;
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>( 1727 return ScheduleInFlightChange(base::MakeUnique<InFlightCaptureChange>(
1718 this, capture_synchronizer_.get(), window)); 1728 this, capture_synchronizer_.get(), window));
1719 } 1729 }
1720 1730
1721 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) { 1731 uint32_t WindowTreeClient::CreateChangeIdForFocus(WindowMus* window) {
1722 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>( 1732 return ScheduleInFlightChange(base::MakeUnique<InFlightFocusChange>(
1723 this, focus_synchronizer_.get(), window)); 1733 this, focus_synchronizer_.get(), window));
1724 } 1734 }
1725 1735
1726 } // namespace aura 1736 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/mus/window_tree_client.h ('k') | ui/views/mus/mus_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698