| 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 "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 26 matching lines...) Expand all Loading... |
| 37 const ServerView* relative_view, | 37 const ServerView* relative_view, |
| 38 OrderDirection direction) const { | 38 OrderDirection direction) const { |
| 39 return true; | 39 return true; |
| 40 } | 40 } |
| 41 | 41 |
| 42 bool WindowManagerAccessPolicy::CanDeleteView(const ServerView* view) const { | 42 bool WindowManagerAccessPolicy::CanDeleteView(const ServerView* view) const { |
| 43 return view->id().connection_id == connection_id_; | 43 return view->id().connection_id == connection_id_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool WindowManagerAccessPolicy::CanGetViewTree(const ServerView* view) const { | 46 bool WindowManagerAccessPolicy::CanGetViewTree(const ServerView* view) const { |
| 47 return true; | 47 return view->id() != ClonedViewId(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool WindowManagerAccessPolicy::CanDescendIntoViewForViewTree( | 50 bool WindowManagerAccessPolicy::CanDescendIntoViewForViewTree( |
| 51 const ServerView* view) const { | 51 const ServerView* view) const { |
| 52 return true; | 52 return view->id() != ClonedViewId(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { | 55 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const { |
| 56 return view->id().connection_id == connection_id_; | 56 return view->id().connection_id == connection_id_; |
| 57 } | 57 } |
| 58 | 58 |
| 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 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 75 | 75 |
| 76 bool WindowManagerAccessPolicy::CanSetViewProperties( | 76 bool WindowManagerAccessPolicy::CanSetViewProperties( |
| 77 const ServerView* view) const { | 77 const ServerView* view) const { |
| 78 return view->id().connection_id == connection_id_; | 78 return view->id().connection_id == connection_id_; |
| 79 } | 79 } |
| 80 | 80 |
| 81 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( | 81 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange( |
| 82 const ServerView* view, | 82 const ServerView* view, |
| 83 const ServerView** new_parent, | 83 const ServerView** new_parent, |
| 84 const ServerView** old_parent) const { | 84 const ServerView** old_parent) const { |
| 85 if (view->id() == ClonedViewId()) |
| 86 return false; |
| 87 |
| 85 // Notify if we've already told the window manager about the view, or if we've | 88 // Notify if we've already told the window manager about the view, or if we've |
| 86 // already told the window manager about the parent. The later handles the | 89 // already told the window manager about the parent. The later handles the |
| 87 // case of a view that wasn't parented to the root getting added to the root. | 90 // case of a view that wasn't parented to the root getting added to the root. |
| 88 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent)); | 91 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent)); |
| 89 } | 92 } |
| 90 | 93 |
| 91 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { | 94 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { |
| 92 return delegate_->IsViewKnownForAccessPolicy(view); | 95 return delegate_->IsViewKnownForAccessPolicy(view); |
| 93 } | 96 } |
| 94 | 97 |
| 95 } // namespace service | 98 } // namespace service |
| 96 } // namespace mojo | 99 } // namespace mojo |
| OLD | NEW |