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

Side by Side Diff: components/mus/ws/window_manager_access_policy.cc

Issue 1406153004: components/mus/public/interfaces View => Window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another rebase Created 5 years, 2 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/mus/ws/window_manager_access_policy.h ('k') | components/pdf_viewer/pdf_viewer.cc » ('j') | 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 "components/mus/ws/window_manager_access_policy.h" 5 #include "components/mus/ws/window_manager_access_policy.h"
6 6
7 #include "components/mus/ws/access_policy_delegate.h" 7 #include "components/mus/ws/access_policy_delegate.h"
8 #include "components/mus/ws/server_view.h" 8 #include "components/mus/ws/server_view.h"
9 9
10 namespace mus { 10 namespace mus {
11 11
12 // TODO(sky): document why this differs from default for each case. Maybe want 12 // TODO(sky): document why this differs from default for each case. Maybe want
13 // to subclass DefaultAccessPolicy. 13 // to subclass DefaultAccessPolicy.
14 14
15 WindowManagerAccessPolicy::WindowManagerAccessPolicy( 15 WindowManagerAccessPolicy::WindowManagerAccessPolicy(
16 ConnectionSpecificId connection_id, 16 ConnectionSpecificId connection_id,
17 AccessPolicyDelegate* delegate) 17 AccessPolicyDelegate* delegate)
18 : connection_id_(connection_id), delegate_(delegate) {} 18 : connection_id_(connection_id), delegate_(delegate) {}
19 19
20 WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {} 20 WindowManagerAccessPolicy::~WindowManagerAccessPolicy() {}
21 21
22 bool WindowManagerAccessPolicy::CanRemoveViewFromParent( 22 bool WindowManagerAccessPolicy::CanRemoveWindowFromParent(
23 const ServerView* view) const { 23 const ServerView* view) const {
24 return true; 24 return true;
25 } 25 }
26 26
27 bool WindowManagerAccessPolicy::CanAddView(const ServerView* parent, 27 bool WindowManagerAccessPolicy::CanAddWindow(const ServerView* parent,
28 const ServerView* child) const { 28 const ServerView* child) const {
29 return true; 29 return true;
30 } 30 }
31 31
32 bool WindowManagerAccessPolicy::CanReorderView( 32 bool WindowManagerAccessPolicy::CanReorderWindow(
33 const ServerView* view, 33 const ServerView* view,
34 const ServerView* relative_view, 34 const ServerView* relative_view,
35 mojo::OrderDirection direction) const { 35 mojom::OrderDirection direction) const {
36 return true; 36 return true;
37 } 37 }
38 38
39 bool WindowManagerAccessPolicy::CanDeleteView(const ServerView* view) const { 39 bool WindowManagerAccessPolicy::CanDeleteWindow(const ServerView* view) const {
40 return view->id().connection_id == connection_id_; 40 return view->id().connection_id == connection_id_;
41 } 41 }
42 42
43 bool WindowManagerAccessPolicy::CanGetViewTree(const ServerView* view) const { 43 bool WindowManagerAccessPolicy::CanGetWindowTree(const ServerView* view) const {
44 return true; 44 return true;
45 } 45 }
46 46
47 bool WindowManagerAccessPolicy::CanDescendIntoViewForViewTree( 47 bool WindowManagerAccessPolicy::CanDescendIntoViewForViewTree(
48 const ServerView* view) const { 48 const ServerView* view) const {
49 return true; 49 return true;
50 } 50 }
51 51
52 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view, 52 bool WindowManagerAccessPolicy::CanEmbed(const ServerView* view,
53 uint32_t policy_bitmask) const { 53 uint32_t policy_bitmask) const {
54 return !delegate_->IsRootForAccessPolicy(view->id()); 54 return !delegate_->IsRootForAccessPolicy(view->id());
55 } 55 }
56 56
57 bool WindowManagerAccessPolicy::CanChangeViewVisibility( 57 bool WindowManagerAccessPolicy::CanChangeViewVisibility(
58 const ServerView* view) const { 58 const ServerView* view) const {
59 // The WindowManager can change the visibility of the root too. 59 // The WindowManager can change the visibility of the root too.
60 return view->id().connection_id == connection_id_ || 60 return view->id().connection_id == connection_id_ ||
61 (view->GetRoot() == view); 61 (view->GetRoot() == view);
62 } 62 }
63 63
64 bool WindowManagerAccessPolicy::CanSetWindowSurfaceId( 64 bool WindowManagerAccessPolicy::CanSetWindowSurfaceId(
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_->IsRootForAccessPolicy(view->id())); 69 (delegate_->IsRootForAccessPolicy(view->id()));
70 } 70 }
71 71
72 bool WindowManagerAccessPolicy::CanSetViewBounds(const ServerView* view) const { 72 bool WindowManagerAccessPolicy::CanSetWindowBounds(
73 return view->id().connection_id == connection_id_;
74 }
75
76 bool WindowManagerAccessPolicy::CanSetViewProperties(
77 const ServerView* view) const { 73 const ServerView* view) const {
78 return view->id().connection_id == connection_id_; 74 return view->id().connection_id == connection_id_;
79 } 75 }
80 76
81 bool WindowManagerAccessPolicy::CanSetViewTextInputState( 77 bool WindowManagerAccessPolicy::CanSetWindowProperties(
82 const ServerView* view) const { 78 const ServerView* view) const {
83 return view->id().connection_id == connection_id_; 79 return view->id().connection_id == connection_id_;
84 } 80 }
81
82 bool WindowManagerAccessPolicy::CanSetWindowTextInputState(
83 const ServerView* view) const {
84 return view->id().connection_id == connection_id_;
85 }
85 86
86 bool WindowManagerAccessPolicy::CanSetFocus(const ServerView* view) const { 87 bool WindowManagerAccessPolicy::CanSetFocus(const ServerView* view) const {
87 return true; 88 return true;
88 } 89 }
89 90
90 bool WindowManagerAccessPolicy::CanSetClientArea( 91 bool WindowManagerAccessPolicy::CanSetClientArea(
91 const ServerView* window) const { 92 const ServerView* window) const {
92 return window->id().connection_id == connection_id_ || 93 return window->id().connection_id == connection_id_ ||
93 delegate_->IsRootForAccessPolicy(window->id()); 94 delegate_->IsRootForAccessPolicy(window->id());
94 } 95 }
(...skipping 11 matching lines...) Expand all
106 const ServerView* WindowManagerAccessPolicy::GetViewForFocusChange( 107 const ServerView* WindowManagerAccessPolicy::GetViewForFocusChange(
107 const ServerView* focused) { 108 const ServerView* focused) {
108 return focused; 109 return focused;
109 } 110 }
110 111
111 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const { 112 bool WindowManagerAccessPolicy::IsViewKnown(const ServerView* view) const {
112 return delegate_->IsViewKnownForAccessPolicy(view); 113 return delegate_->IsViewKnownForAccessPolicy(view);
113 } 114 }
114 115
115 } // namespace mus 116 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_access_policy.h ('k') | components/pdf_viewer/pdf_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698