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

Side by Side Diff: services/view_manager/view_manager_service_impl.cc

Issue 1082943002: Adds a ServerViewObserver interface (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: grammar Created 5 years, 8 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 | « services/view_manager/test_server_view_delegate.cc ('k') | no next file » | 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 "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
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
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
OLDNEW
« no previous file with comments | « services/view_manager/test_server_view_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698