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 #ifndef COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ | 5 #ifndef COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ |
6 #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ | 6 #define COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // view is deleted the deleted view is implicitly removed from the parent. | 37 // view is deleted the deleted view is implicitly removed from the parent. |
38 class ServerView : public mojo::Surface, | 38 class ServerView : public mojo::Surface, |
39 public cc::SurfaceFactoryClient { | 39 public cc::SurfaceFactoryClient { |
40 public: | 40 public: |
41 ServerView(ServerViewDelegate* delegate, const ViewId& id); | 41 ServerView(ServerViewDelegate* delegate, const ViewId& id); |
42 ~ServerView() override; | 42 ~ServerView() override; |
43 | 43 |
44 void AddObserver(ServerViewObserver* observer); | 44 void AddObserver(ServerViewObserver* observer); |
45 void RemoveObserver(ServerViewObserver* observer); | 45 void RemoveObserver(ServerViewObserver* observer); |
46 | 46 |
| 47 // Sets the access policy that is used the next time Embed() is called. |
| 48 void set_pending_access_policy(uint32_t policy) { |
| 49 pending_access_policy_ = policy; |
| 50 } |
| 51 |
| 52 // Returns |pending_access_policy_| and resets it to the default. |
| 53 uint32_t get_and_clear_pending_access_policy() { |
| 54 const uint32_t policy = pending_access_policy_; |
| 55 pending_access_policy_ = mojo::ViewTree::ACCESS_POLICY_DEFAULT; |
| 56 return policy; |
| 57 } |
| 58 |
47 // Binds the provided |request| to |this| object. If an interface is already | 59 // Binds the provided |request| to |this| object. If an interface is already |
48 // bound to this ServerView then the old connection is closed first. | 60 // bound to this ServerView then the old connection is closed first. |
49 void Bind(mojo::InterfaceRequest<Surface> request, | 61 void Bind(mojo::InterfaceRequest<Surface> request, |
50 mojo::SurfaceClientPtr client); | 62 mojo::SurfaceClientPtr client); |
51 | 63 |
52 const ViewId& id() const { return id_; } | 64 const ViewId& id() const { return id_; } |
53 | 65 |
54 void Add(ServerView* child); | 66 void Add(ServerView* child); |
55 void Remove(ServerView* child); | 67 void Remove(ServerView* child); |
56 void Reorder(ServerView* child, | 68 void Reorder(ServerView* child, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // visible. | 112 // visible. |
101 bool IsDrawn() const; | 113 bool IsDrawn() const; |
102 | 114 |
103 void SetSurfaceId(cc::SurfaceId surface_id); | 115 void SetSurfaceId(cc::SurfaceId surface_id); |
104 const cc::SurfaceId& surface_id() const { return surface_id_; } | 116 const cc::SurfaceId& surface_id() const { return surface_id_; } |
105 | 117 |
106 const gfx::Size& last_submitted_frame_size() { | 118 const gfx::Size& last_submitted_frame_size() { |
107 return last_submitted_frame_size_; | 119 return last_submitted_frame_size_; |
108 } | 120 } |
109 | 121 |
110 // See mojom for for details. | |
111 void set_allows_reembed(bool value) { allows_reembed_ = value; } | |
112 bool allows_reembed() const { return allows_reembed_; } | |
113 | |
114 // mojo::Surface: | 122 // mojo::Surface: |
115 void SubmitCompositorFrame( | 123 void SubmitCompositorFrame( |
116 mojo::CompositorFramePtr frame, | 124 mojo::CompositorFramePtr frame, |
117 const SubmitCompositorFrameCallback& callback) override; | 125 const SubmitCompositorFrameCallback& callback) override; |
118 | 126 |
119 #if !defined(NDEBUG) | 127 #if !defined(NDEBUG) |
120 std::string GetDebugWindowHierarchy() const; | 128 std::string GetDebugWindowHierarchy() const; |
121 void BuildDebugInfo(const std::string& depth, std::string* result) const; | 129 void BuildDebugInfo(const std::string& depth, std::string* result) const; |
122 #endif | 130 #endif |
123 | 131 |
(...skipping 10 matching lines...) Expand all Loading... |
134 const ViewId id_; | 142 const ViewId id_; |
135 ServerView* parent_; | 143 ServerView* parent_; |
136 Views children_; | 144 Views children_; |
137 bool visible_; | 145 bool visible_; |
138 gfx::Rect bounds_; | 146 gfx::Rect bounds_; |
139 cc::SurfaceId surface_id_; | 147 cc::SurfaceId surface_id_; |
140 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; | 148 scoped_ptr<cc::SurfaceIdAllocator> surface_id_allocator_; |
141 scoped_ptr<cc::SurfaceFactory> surface_factory_; | 149 scoped_ptr<cc::SurfaceFactory> surface_factory_; |
142 float opacity_; | 150 float opacity_; |
143 gfx::Transform transform_; | 151 gfx::Transform transform_; |
144 bool allows_reembed_; | 152 uint32_t pending_access_policy_; |
145 ui::TextInputState text_input_state_; | 153 ui::TextInputState text_input_state_; |
146 gfx::Size last_submitted_frame_size_; | 154 gfx::Size last_submitted_frame_size_; |
147 | 155 |
148 std::map<std::string, std::vector<uint8_t>> properties_; | 156 std::map<std::string, std::vector<uint8_t>> properties_; |
149 | 157 |
150 base::ObserverList<ServerViewObserver> observers_; | 158 base::ObserverList<ServerViewObserver> observers_; |
151 mojo::SurfaceClientPtr client_; | 159 mojo::SurfaceClientPtr client_; |
152 mojo::Binding<Surface> binding_; | 160 mojo::Binding<Surface> binding_; |
153 | 161 |
154 DISALLOW_COPY_AND_ASSIGN(ServerView); | 162 DISALLOW_COPY_AND_ASSIGN(ServerView); |
155 }; | 163 }; |
156 | 164 |
157 } // namespace view_manager | 165 } // namespace view_manager |
158 | 166 |
159 #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ | 167 #endif // COMPONENTS_VIEW_MANAGER_SERVER_VIEW_H_ |
OLD | NEW |