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

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

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