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

Side by Side Diff: components/view_manager/window_manager_access_policy.cc

Issue 1344573002: Mandoline: Rename components/view_manager to components/mus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 5 years, 3 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 | « components/view_manager/window_manager_access_policy.h ('k') | components/web_view/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "components/view_manager/window_manager_access_policy.h"
6
7 #include "components/view_manager/access_policy_delegate.h"
8 #include "components/view_manager/server_view.h"
9
10 namespace view_manager {
11
12 // TODO(sky): document why this differs from default for each case. Maybe want
13 // to subclass DefaultAccessPolicy.
14
15 WindowManagerAccessPolicy::WindowManagerAccessPolicy(
16 mojo::ConnectionSpecificId connection_id,
17 AccessPolicyDelegate* delegate)
18 : connection_id_(connection_id), delegate_(delegate) {
19 }
20
21 WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {
22 }
23
24 bool WindowManagerAccessPolicy::CanRemoveViewFromParent(
25 const ServerView* view) const {
26 return true;
27 }
28
29 bool WindowManagerAccessPolicy::CanAddView(const ServerView* parent,
30 const ServerView* child) const {
31 return true;
32 }
33
34 bool WindowManagerAccessPolicy::CanReorderView(
35 const ServerView* view,
36 const ServerView* relative_view,
37 mojo::OrderDirection direction) const {
38 return true;
39 }
40
41 bool WindowManagerAccessPolicy::CanDeleteView(const ServerView* view) const {
42 return view->id().connection_id == connection_id_;
43 }
44
45 bool WindowManagerAccessPolicy::CanGetViewTree(const ServerView* view) const {
46 return true;
47 }
48
49 bool WindowManagerAccessPolicy::CanDescendIntoViewForViewTree(
50 const ServerView* view) const {
51 return true;
52 }
53
54 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view) const {
55 return !delegate_->IsRootForAccessPolicy(view->id());
56 }
57
58 bool WindowManagerAccessPolicy::CanChangeViewVisibility(
59 const ServerView* view) const {
60 // The WindowManager can change the visibility of the root too.
61 return view->id().connection_id == connection_id_ ||
62 (view->GetRoot() == view);
63 }
64
65 bool WindowManagerAccessPolicy::CanSetViewSurfaceId(
66 const ServerView* view) const {
67 if (delegate_->IsViewRootOfAnotherConnectionForAccessPolicy(view))
68 return false;
69 return view->id().connection_id == connection_id_ ||
70 (delegate_->IsRootForAccessPolicy(view->id()));
71 }
72
73 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const {
74 return view->id().connection_id == connection_id_;
75 }
76
77 bool WindowManagerAccessPolicy::CanSetViewProperties(
78 const ServerView* view) const {
79 return view->id().connection_id == connection_id_;
80 }
81
82 bool WindowManagerAccessPolicy::CanSetViewTextInputState(
83 const ServerView* view) const {
84 return view->id().connection_id == connection_id_;
85 }
86
87 bool WindowManagerAccessPolicy::CanSetFocus(const ServerView* view) const {
88 return true;
89 }
90
91 bool WindowManagerAccessPolicy::CanSetAccessPolicy(
92 const ServerView* view) const {
93 return true;
94 }
95
96 bool WindowManagerAccessPolicy::ShouldNotifyOnHierarchyChange(
97 const ServerView* view,
98 const ServerView** new_parent,
99 const ServerView** old_parent) const {
100 // Notify if we've already told the window manager about the view, or if we've
101 // already told the window manager about the parent. The later handles the
102 // case of a view that wasn't parented to the root getting added to the root.
103 return IsViewKnown(view) || (*new_parent && IsViewKnown(*new_parent));
104 }
105
106 const ServerView* WindowManagerAccessPolicy::GetViewForFocusChange(
107 const ServerView* focused) {
108 return focused;
109 }
110
111 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const {
112 return delegate_->IsViewKnownForAccessPolicy(view);
113 }
114
115 } // namespace view_manager
OLDNEW
« no previous file with comments | « components/view_manager/window_manager_access_policy.h ('k') | components/web_view/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698