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

Side by Side Diff: mojo/services/view_manager/window_manager_access_policy.cc

Issue 699173003: Makes ViewManagerServiceImpl track a single root (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: comment Created 6 years, 1 month 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 | « mojo/services/view_manager/view_manager_service_impl.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 "mojo/services/view_manager/window_manager_access_policy.h" 5 #include "mojo/services/view_manager/window_manager_access_policy.h"
6 6
7 #include "mojo/services/view_manager/access_policy_delegate.h" 7 #include "mojo/services/view_manager/access_policy_delegate.h"
8 #include "mojo/services/view_manager/server_view.h" 8 #include "mojo/services/view_manager/server_view.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 bool WindowManagerAccessPolicy::CanChangeViewVisibility( 59 bool WindowManagerAccessPolicy::CanChangeViewVisibility(
60 const ServerView* view) const { 60 const ServerView* view) const {
61 return view->id().connection_id == connection_id_; 61 return view->id().connection_id == connection_id_;
62 } 62 }
63 63
64 bool WindowManagerAccessPolicy::CanSetViewSurfaceId( 64 bool WindowManagerAccessPolicy::CanSetViewSurfaceId(
65 const ServerView* view) const { 65 const ServerView* view) const {
66 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view)) 66 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view))
67 return false; 67 return false;
68 return view->id().connection_id == connection_id_ || 68 return view->id().connection_id == connection_id_ ||
69 (delegate_->GetRootsForAccessPolicy().count( 69 (delegate_->IsRootForAccessPolicy(view->id()));
70 ViewIdToTransportId(view->id())) > 0);
71 } 70 }
72 71
73 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const { 72 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const {
74 return view->id().connection_id == connection_id_; 73 return view->id().connection_id == connection_id_;
75 } 74 }
76 75
77 bool WindowManagerAccessPolicy::CanSetViewProperties( 76 bool WindowManagerAccessPolicy::CanSetViewProperties(
78 const ServerView* view) const { 77 const ServerView* view) const {
79 return view->id().connection_id == connection_id_; 78 return view->id().connection_id == connection_id_;
80 } 79 }
81 80
82 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( 81 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange(
83 const ServerView* view, 82 const ServerView* view,
84 const ServerView** new_parent, 83 const ServerView** new_parent,
85 const ServerView** old_parent) const { 84 const ServerView** old_parent) const {
86 // Notify if we've already told the window manager about the view, or if we've 85 // Notify if we've already told the window manager about the view, or if we've
87 // already told the window manager about the parent. The later handles the 86 // already told the window manager about the parent. The later handles the
88 // case of a view that wasn't parented to the root getting added to the root. 87 // case of a view that wasn't parented to the root getting added to the root.
89 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent)); 88 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent));
90 } 89 }
91 90
92 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { 91 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const {
93 return delegate_->IsViewKnownForAccessPolicy(view); 92 return delegate_->IsViewKnownForAccessPolicy(view);
94 } 93 }
95 94
96 } // namespace service 95 } // namespace service
97 } // namespace mojo 96 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/view_manager/view_manager_service_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698