| 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" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 } | 94 } |
| 95 if (root_.get() && root_->connection_id == connection->id()) | 95 if (root_.get() && root_->connection_id == connection->id()) |
| 96 root_.reset(); | 96 root_.reset(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 mojo::ErrorCode ViewManagerServiceImpl::CreateView(const ViewId& view_id) { | 99 mojo::ErrorCode ViewManagerServiceImpl::CreateView(const ViewId& view_id) { |
| 100 if (view_id.connection_id != id_) | 100 if (view_id.connection_id != id_) |
| 101 return mojo::ERROR_CODE_ILLEGAL_ARGUMENT; | 101 return mojo::ERROR_CODE_ILLEGAL_ARGUMENT; |
| 102 if (view_map_.find(view_id.view_id) != view_map_.end()) | 102 if (view_map_.find(view_id.view_id) != view_map_.end()) |
| 103 return mojo::ERROR_CODE_VALUE_IN_USE; | 103 return mojo::ERROR_CODE_VALUE_IN_USE; |
| 104 view_map_[view_id.view_id] = new ServerView(connection_manager_, view_id); | 104 view_map_[view_id.view_id] = connection_manager_->CreateServerView(view_id); |
| 105 known_views_.insert(ViewIdToTransportId(view_id)); | 105 known_views_.insert(ViewIdToTransportId(view_id)); |
| 106 return mojo::ERROR_CODE_NONE; | 106 return mojo::ERROR_CODE_NONE; |
| 107 } | 107 } |
| 108 | 108 |
| 109 bool ViewManagerServiceImpl::AddView(const ViewId& parent_id, | 109 bool ViewManagerServiceImpl::AddView(const ViewId& parent_id, |
| 110 const ViewId& child_id) { | 110 const ViewId& child_id) { |
| 111 ServerView* parent = GetView(parent_id); | 111 ServerView* parent = GetView(parent_id); |
| 112 ServerView* child = GetView(child_id); | 112 ServerView* child = GetView(child_id); |
| 113 if (parent && child && child->parent() != parent && | 113 if (parent && child && child->parent() != parent && |
| 114 !child->Contains(parent) && access_policy_->CanAddView(parent, child)) { | 114 !child->Contains(parent) && access_policy_->CanAddView(parent, child)) { |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 645 } |
| 646 | 646 |
| 647 bool ViewManagerServiceImpl::IsViewRootOfAnotherConnectionForAccessPolicy( | 647 bool ViewManagerServiceImpl::IsViewRootOfAnotherConnectionForAccessPolicy( |
| 648 const ServerView* view) const { | 648 const ServerView* view) const { |
| 649 ViewManagerServiceImpl* connection = | 649 ViewManagerServiceImpl* connection = |
| 650 connection_manager_->GetConnectionWithRoot(view->id()); | 650 connection_manager_->GetConnectionWithRoot(view->id()); |
| 651 return connection && connection != this; | 651 return connection && connection != this; |
| 652 } | 652 } |
| 653 | 653 |
| 654 } // namespace view_manager | 654 } // namespace view_manager |
| OLD | NEW |