OLD | NEW |
---|---|
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 "services/view_manager/view_manager_service_impl.h" | 5 #include "services/view_manager/view_manager_service_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "mojo/converters/geometry/geometry_type_converters.h" | 9 #include "mojo/converters/geometry/geometry_type_converters.h" |
10 #include "mojo/converters/input_events/input_events_type_converters.h" | 10 #include "mojo/converters/input_events/input_events_type_converters.h" |
11 #include "mojo/converters/surfaces/surfaces_type_converters.h" | 11 #include "mojo/converters/surfaces/surfaces_type_converters.h" |
12 #include "mojo/services/window_manager/public/interfaces/window_manager_internal .mojom.h" | 12 #include "mojo/services/window_manager/public/interfaces/window_manager_internal .mojom.h" |
13 #include "services/view_manager/connection_manager.h" | 13 #include "services/view_manager/connection_manager.h" |
14 #include "services/view_manager/default_access_policy.h" | 14 #include "services/view_manager/default_access_policy.h" |
15 #include "services/view_manager/display_manager.h" | 15 #include "services/view_manager/display_manager.h" |
16 #include "services/view_manager/server_view.h" | 16 #include "services/view_manager/server_view.h" |
17 #include "services/view_manager/window_manager_access_policy.h" | 17 #include "services/view_manager/window_manager_access_policy.h" |
18 | 18 |
19 using mojo::Array; | 19 using mojo::Array; |
20 using mojo::Callback; | 20 using mojo::Callback; |
21 using mojo::Id; | 21 using mojo::Id; |
22 using mojo::InterfaceRequest; | 22 using mojo::InterfaceRequest; |
23 using mojo::OrderDirection; | 23 using mojo::OrderDirection; |
24 using mojo::Rect; | |
viettrungluu
2015/09/10 18:11:09
"
| |
25 using mojo::ServiceProvider; | 24 using mojo::ServiceProvider; |
26 using mojo::ServiceProviderPtr; | 25 using mojo::ServiceProviderPtr; |
27 using mojo::String; | 26 using mojo::String; |
28 using mojo::ViewDataPtr; | 27 using mojo::ViewDataPtr; |
29 | 28 |
30 namespace view_manager { | 29 namespace view_manager { |
31 | 30 |
32 ViewManagerServiceImpl::ViewManagerServiceImpl( | 31 ViewManagerServiceImpl::ViewManagerServiceImpl( |
33 ConnectionManager* connection_manager, | 32 ConnectionManager* connection_manager, |
34 mojo::ConnectionSpecificId creator_id, | 33 mojo::ConnectionSpecificId creator_id, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
161 } | 160 } |
162 | 161 |
163 void ViewManagerServiceImpl::ProcessViewBoundsChanged( | 162 void ViewManagerServiceImpl::ProcessViewBoundsChanged( |
164 const ServerView* view, | 163 const ServerView* view, |
165 const gfx::Rect& old_bounds, | 164 const gfx::Rect& old_bounds, |
166 const gfx::Rect& new_bounds, | 165 const gfx::Rect& new_bounds, |
167 bool originated_change) { | 166 bool originated_change) { |
168 if (originated_change || !IsViewKnown(view)) | 167 if (originated_change || !IsViewKnown(view)) |
169 return; | 168 return; |
170 client()->OnViewBoundsChanged(ViewIdToTransportId(view->id()), | 169 client()->OnViewBoundsChanged(ViewIdToTransportId(view->id()), |
171 Rect::From(old_bounds), | 170 mojo::Rect::From(old_bounds), |
172 Rect::From(new_bounds)); | 171 mojo::Rect::From(new_bounds)); |
173 } | 172 } |
174 | 173 |
175 void ViewManagerServiceImpl::ProcessViewportMetricsChanged( | 174 void ViewManagerServiceImpl::ProcessViewportMetricsChanged( |
176 const mojo::ViewportMetrics& old_metrics, | 175 const mojo::ViewportMetrics& old_metrics, |
177 const mojo::ViewportMetrics& new_metrics, | 176 const mojo::ViewportMetrics& new_metrics, |
178 bool originated_change) { | 177 bool originated_change) { |
179 client()->OnViewViewportMetricsChanged(old_metrics.Clone(), | 178 client()->OnViewViewportMetricsChanged(old_metrics.Clone(), |
180 new_metrics.Clone()); | 179 new_metrics.Clone()); |
181 } | 180 } |
182 | 181 |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 ViewDataPtr ViewManagerServiceImpl::ViewToViewData(const ServerView* view) { | 408 ViewDataPtr ViewManagerServiceImpl::ViewToViewData(const ServerView* view) { |
410 DCHECK(IsViewKnown(view)); | 409 DCHECK(IsViewKnown(view)); |
411 const ServerView* parent = view->parent(); | 410 const ServerView* parent = view->parent(); |
412 // If the parent isn't known, it means the parent is not visible to us (not | 411 // If the parent isn't known, it means the parent is not visible to us (not |
413 // in roots), and should not be sent over. | 412 // in roots), and should not be sent over. |
414 if (parent && !IsViewKnown(parent)) | 413 if (parent && !IsViewKnown(parent)) |
415 parent = NULL; | 414 parent = NULL; |
416 ViewDataPtr view_data(mojo::ViewData::New()); | 415 ViewDataPtr view_data(mojo::ViewData::New()); |
417 view_data->parent_id = ViewIdToTransportId(parent ? parent->id() : ViewId()); | 416 view_data->parent_id = ViewIdToTransportId(parent ? parent->id() : ViewId()); |
418 view_data->view_id = ViewIdToTransportId(view->id()); | 417 view_data->view_id = ViewIdToTransportId(view->id()); |
419 view_data->bounds = Rect::From(view->bounds()); | 418 view_data->bounds = mojo::Rect::From(view->bounds()); |
420 view_data->properties = | 419 view_data->properties = |
421 mojo::Map<String, Array<uint8_t>>::From(view->properties()); | 420 mojo::Map<String, Array<uint8_t>>::From(view->properties()); |
422 view_data->visible = view->visible(); | 421 view_data->visible = view->visible(); |
423 view_data->drawn = view->IsDrawn(connection_manager_->root()); | 422 view_data->drawn = view->IsDrawn(connection_manager_->root()); |
424 view_data->viewport_metrics = | 423 view_data->viewport_metrics = |
425 connection_manager_->display_manager()->GetViewportMetrics().Clone(); | 424 connection_manager_->display_manager()->GetViewportMetrics().Clone(); |
426 return view_data.Pass(); | 425 return view_data.Pass(); |
427 } | 426 } |
428 | 427 |
429 void ViewManagerServiceImpl::GetViewTreeImpl( | 428 void ViewManagerServiceImpl::GetViewTreeImpl( |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
645 } | 644 } |
646 | 645 |
647 bool ViewManagerServiceImpl::IsViewRootOfAnotherConnectionForAccessPolicy( | 646 bool ViewManagerServiceImpl::IsViewRootOfAnotherConnectionForAccessPolicy( |
648 const ServerView* view) const { | 647 const ServerView* view) const { |
649 ViewManagerServiceImpl* connection = | 648 ViewManagerServiceImpl* connection = |
650 connection_manager_->GetConnectionWithRoot(view->id()); | 649 connection_manager_->GetConnectionWithRoot(view->id()); |
651 return connection && connection != this; | 650 return connection && connection != this; |
652 } | 651 } |
653 | 652 |
654 } // namespace view_manager | 653 } // namespace view_manager |
OLD | NEW |