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

Side by Side Diff: components/mus/connection_manager.cc

Issue 1351013002: Revert of Mandoline UI Process: Update namespaces and file names (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « components/mus/connection_manager.h ('k') | components/mus/connection_manager_delegate.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 "components/mus/connection_manager.h" 5 #include "components/mus/connection_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/quads/shared_quad_state.h" 10 #include "cc/quads/shared_quad_state.h"
11 #include "components/mus/client_connection.h" 11 #include "components/mus/client_connection.h"
12 #include "components/mus/connection_manager_delegate.h" 12 #include "components/mus/connection_manager_delegate.h"
13 #include "components/mus/server_view.h" 13 #include "components/mus/server_view.h"
14 #include "components/mus/view_coordinate_conversions.h" 14 #include "components/mus/view_coordinate_conversions.h"
15 #include "components/mus/view_tree_host_connection.h" 15 #include "components/mus/view_tree_host_connection.h"
16 #include "components/mus/view_tree_impl.h" 16 #include "components/mus/view_tree_impl.h"
17 #include "mojo/application/public/cpp/application_connection.h" 17 #include "mojo/application/public/cpp/application_connection.h"
18 #include "mojo/converters/geometry/geometry_type_converters.h" 18 #include "mojo/converters/geometry/geometry_type_converters.h"
19 #include "mojo/converters/input_events/input_events_type_converters.h" 19 #include "mojo/converters/input_events/input_events_type_converters.h"
20 #include "mojo/converters/surfaces/surfaces_type_converters.h" 20 #include "mojo/converters/surfaces/surfaces_type_converters.h"
21 #include "ui/gfx/geometry/size_conversions.h" 21 #include "ui/gfx/geometry/size_conversions.h"
22 22
23 namespace mus { 23 using mojo::ConnectionSpecificId;
24
25 namespace view_manager {
24 26
25 ConnectionManager::ScopedChange::ScopedChange( 27 ConnectionManager::ScopedChange::ScopedChange(
26 ViewTreeImpl* connection, 28 ViewTreeImpl* connection,
27 ConnectionManager* connection_manager, 29 ConnectionManager* connection_manager,
28 bool is_delete_view) 30 bool is_delete_view)
29 : connection_manager_(connection_manager), 31 : connection_manager_(connection_manager),
30 connection_id_(connection->id()), 32 connection_id_(connection->id()),
31 is_delete_view_(is_delete_view) { 33 is_delete_view_(is_delete_view) {
32 connection_manager_->PrepareForChange(this); 34 connection_manager_->PrepareForChange(this);
33 } 35 }
34 36
35 ConnectionManager::ScopedChange::~ScopedChange() { 37 ConnectionManager::ScopedChange::~ScopedChange() {
36 connection_manager_->FinishChange(); 38 connection_manager_->FinishChange();
37 } 39 }
38 40
39 ConnectionManager::ConnectionManager( 41 ConnectionManager::ConnectionManager(
40 ConnectionManagerDelegate* delegate, 42 ConnectionManagerDelegate* delegate,
41 const scoped_refptr<SurfacesState>& surfaces_state) 43 const scoped_refptr<surfaces::SurfacesState>& surfaces_state)
42 : delegate_(delegate), 44 : delegate_(delegate),
43 surfaces_state_(surfaces_state), 45 surfaces_state_(surfaces_state),
44 next_connection_id_(1), 46 next_connection_id_(1),
45 next_host_id_(0), 47 next_host_id_(0),
46 current_change_(nullptr), 48 current_change_(nullptr),
47 in_destructor_(false) {} 49 in_destructor_(false) {}
48 50
49 ConnectionManager::~ConnectionManager() { 51 ConnectionManager::~ConnectionManager() {
50 in_destructor_ = true; 52 in_destructor_ = true;
51 53
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // observer pattern to do this. Each ViewTreeImpl should track its 122 // observer pattern to do this. Each ViewTreeImpl should track its
121 // parent's lifetime. 123 // parent's lifetime.
122 host_connection_map_.erase(it); 124 host_connection_map_.erase(it);
123 OnConnectionError(service_connection_it->second); 125 OnConnectionError(service_connection_it->second);
124 126
125 // If we have no more roots left, let the app know so it can terminate. 127 // If we have no more roots left, let the app know so it can terminate.
126 if (!host_connection_map_.size()) 128 if (!host_connection_map_.size())
127 delegate_->OnNoMoreRootConnections(); 129 delegate_->OnNoMoreRootConnections();
128 } 130 }
129 131
130 void ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, 132 void ConnectionManager::EmbedAtView(mojo::ConnectionSpecificId creator_id,
131 const ViewId& view_id, 133 const ViewId& view_id,
132 uint32_t policy_bitmask, 134 uint32_t policy_bitmask,
133 mojo::URLRequestPtr request) { 135 mojo::URLRequestPtr request) {
134 mojo::ViewTreePtr service_ptr; 136 mojo::ViewTreePtr service_ptr;
135 ClientConnection* client_connection = 137 ClientConnection* client_connection =
136 delegate_->CreateClientConnectionForEmbedAtView( 138 delegate_->CreateClientConnectionForEmbedAtView(
137 this, GetProxy(&service_ptr), creator_id, request.Pass(), view_id, 139 this, GetProxy(&service_ptr), creator_id, request.Pass(), view_id,
138 policy_bitmask); 140 policy_bitmask);
139 AddConnection(client_connection); 141 AddConnection(client_connection);
140 client_connection->service()->Init(client_connection->client(), 142 client_connection->service()->Init(client_connection->client(),
141 service_ptr.Pass()); 143 service_ptr.Pass());
142 OnConnectionMessagedClient(client_connection->service()->id()); 144 OnConnectionMessagedClient(client_connection->service()->id());
143 } 145 }
144 146
145 ViewTreeImpl* ConnectionManager::EmbedAtView(ConnectionSpecificId creator_id, 147 ViewTreeImpl* ConnectionManager::EmbedAtView(
146 const ViewId& view_id, 148 mojo::ConnectionSpecificId creator_id,
147 uint32_t policy_bitmask, 149 const ViewId& view_id,
148 mojo::ViewTreeClientPtr client) { 150 uint32_t policy_bitmask,
151 mojo::ViewTreeClientPtr client) {
149 mojo::ViewTreePtr service_ptr; 152 mojo::ViewTreePtr service_ptr;
150 ClientConnection* client_connection = 153 ClientConnection* client_connection =
151 delegate_->CreateClientConnectionForEmbedAtView( 154 delegate_->CreateClientConnectionForEmbedAtView(
152 this, GetProxy(&service_ptr), creator_id, view_id, policy_bitmask, 155 this, GetProxy(&service_ptr), creator_id, view_id, policy_bitmask,
153 client.Pass()); 156 client.Pass());
154 AddConnection(client_connection); 157 AddConnection(client_connection);
155 client_connection->service()->Init(client_connection->client(), 158 client_connection->service()->Init(client_connection->client(),
156 service_ptr.Pass()); 159 service_ptr.Pass());
157 OnConnectionMessagedClient(client_connection->service()->id()); 160 OnConnectionMessagedClient(client_connection->service()->id());
158 161
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 DCHECK_EQ(0u, connection_map_.count(connection->service()->id())); 328 DCHECK_EQ(0u, connection_map_.count(connection->service()->id()));
326 connection_map_[connection->service()->id()] = connection; 329 connection_map_[connection->service()->id()] = connection;
327 } 330 }
328 331
329 scoped_ptr<cc::CompositorFrame> 332 scoped_ptr<cc::CompositorFrame>
330 ConnectionManager::UpdateViewTreeFromCompositorFrame( 333 ConnectionManager::UpdateViewTreeFromCompositorFrame(
331 const mojo::CompositorFramePtr& input) { 334 const mojo::CompositorFramePtr& input) {
332 return ConvertToCompositorFrame(input, this); 335 return ConvertToCompositorFrame(input, this);
333 } 336 }
334 337
335 SurfacesState* ConnectionManager::GetSurfacesState() { 338 surfaces::SurfacesState* ConnectionManager::GetSurfacesState() {
336 return surfaces_state_.get(); 339 return surfaces_state_.get();
337 } 340 }
338 341
339 void ConnectionManager::OnScheduleViewPaint(const ServerView* view) { 342 void ConnectionManager::OnScheduleViewPaint(const ServerView* view) {
340 if (!in_destructor_) 343 if (!in_destructor_)
341 SchedulePaint(view, gfx::Rect(view->bounds().size())); 344 SchedulePaint(view, gfx::Rect(view->bounds().size()));
342 } 345 }
343 346
344 const ServerView* ConnectionManager::GetRootView(const ServerView* view) const { 347 const ServerView* ConnectionManager::GetRootView(const ServerView* view) const {
345 const ViewTreeHostImpl* host = GetViewTreeHostByView(view); 348 const ViewTreeHostImpl* host = GetViewTreeHostByView(view);
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 bounds.set_origin(p); 457 bounds.set_origin(p);
455 // TODO(fsamuel): This seems like a crude way to set the size that probably 458 // TODO(fsamuel): This seems like a crude way to set the size that probably
456 // doesn't work correctly in the general case. We need to get transforms 459 // doesn't work correctly in the general case. We need to get transforms
457 // working correctly in the general case. 460 // working correctly in the general case.
458 bounds.set_size(gfx::ToRoundedSize( 461 bounds.set_size(gfx::ToRoundedSize(
459 gfx::ScaleSize(bounds.size(), metadata->device_scale_factor))); 462 gfx::ScaleSize(bounds.size(), metadata->device_scale_factor)));
460 view->SetBounds(bounds); 463 view->SetBounds(bounds);
461 return true; 464 return true;
462 } 465 }
463 466
464 } // namespace mus 467 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/mus/connection_manager.h ('k') | components/mus/connection_manager_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698