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_MUS_PUBLIC_CPP_WINDOW_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ |
6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "components/mus/public/cpp/types.h" | 13 #include "components/mus/public/cpp/types.h" |
14 #include "components/mus/public/interfaces/mus_constants.mojom.h" | 14 #include "components/mus/public/interfaces/mus_constants.mojom.h" |
15 #include "components/mus/public/interfaces/surface_id.mojom.h" | 15 #include "components/mus/public/interfaces/surface_id.mojom.h" |
16 #include "components/mus/public/interfaces/window_tree.mojom.h" | 16 #include "components/mus/public/interfaces/window_tree.mojom.h" |
17 #include "mojo/application/public/interfaces/service_provider.mojom.h" | 17 #include "mojo/application/public/interfaces/service_provider.mojom.h" |
18 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" | 18 #include "third_party/mojo/src/mojo/public/cpp/bindings/array.h" |
19 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" | 19 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" |
| 20 #include "ui/gfx/geometry/insets.h" |
20 #include "ui/gfx/geometry/rect.h" | 21 #include "ui/gfx/geometry/rect.h" |
21 | 22 |
22 namespace gfx { | 23 namespace gfx { |
23 class Size; | 24 class Size; |
24 } | 25 } |
25 | 26 |
26 namespace mus { | 27 namespace mus { |
27 | 28 |
28 class ServiceProviderImpl; | 29 class ServiceProviderImpl; |
29 class WindowObserver; | 30 class WindowObserver; |
(...skipping 26 matching lines...) Expand all Loading... |
56 | 57 |
57 WindowTreeConnection* connection() { return connection_; } | 58 WindowTreeConnection* connection() { return connection_; } |
58 | 59 |
59 // Configuration. | 60 // Configuration. |
60 Id id() const { return id_; } | 61 Id id() const { return id_; } |
61 | 62 |
62 // Geometric disposition. | 63 // Geometric disposition. |
63 const gfx::Rect& bounds() const { return bounds_; } | 64 const gfx::Rect& bounds() const { return bounds_; } |
64 void SetBounds(const gfx::Rect& bounds); | 65 void SetBounds(const gfx::Rect& bounds); |
65 | 66 |
66 const gfx::Rect& client_area() const { return client_area_; } | 67 const gfx::Insets& client_area() const { return client_area_; } |
67 void SetClientArea(const gfx::Rect& client_area); | 68 void SetClientArea(const gfx::Insets& new_client_area); |
68 | 69 |
69 // Visibility (also see IsDrawn()). When created windows are hidden. | 70 // Visibility (also see IsDrawn()). When created windows are hidden. |
70 bool visible() const { return visible_; } | 71 bool visible() const { return visible_; } |
71 void SetVisible(bool value); | 72 void SetVisible(bool value); |
72 | 73 |
73 const mojom::ViewportMetrics& viewport_metrics() { | 74 const mojom::ViewportMetrics& viewport_metrics() { |
74 return *viewport_metrics_; | 75 return *viewport_metrics_; |
75 } | 76 } |
76 | 77 |
77 scoped_ptr<WindowSurface> RequestSurface(mojom::SurfaceType type); | 78 scoped_ptr<WindowSurface> RequestSurface(mojom::SurfaceType type); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 int64_t default_value); | 193 int64_t default_value); |
193 int64_t GetLocalPropertyInternal(const void* key, | 194 int64_t GetLocalPropertyInternal(const void* key, |
194 int64_t default_value) const; | 195 int64_t default_value) const; |
195 | 196 |
196 void LocalDestroy(); | 197 void LocalDestroy(); |
197 void LocalAddChild(Window* child); | 198 void LocalAddChild(Window* child); |
198 void LocalRemoveChild(Window* child); | 199 void LocalRemoveChild(Window* child); |
199 // Returns true if the order actually changed. | 200 // Returns true if the order actually changed. |
200 bool LocalReorder(Window* relative, mojom::OrderDirection direction); | 201 bool LocalReorder(Window* relative, mojom::OrderDirection direction); |
201 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); | 202 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); |
202 void LocalSetClientArea(const gfx::Rect& new_client_area); | 203 void LocalSetClientArea(const gfx::Insets& new_client_area); |
203 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, | 204 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, |
204 const mojom::ViewportMetrics& new_metrics); | 205 const mojom::ViewportMetrics& new_metrics); |
205 void LocalSetDrawn(bool drawn); | 206 void LocalSetDrawn(bool drawn); |
206 void LocalSetVisible(bool visible); | 207 void LocalSetVisible(bool visible); |
207 void LocalSetSharedProperty(const std::string& name, | 208 void LocalSetSharedProperty(const std::string& name, |
208 const std::vector<uint8_t>* data); | 209 const std::vector<uint8_t>* data); |
209 | 210 |
210 // Methods implementing visibility change notifications. See WindowObserver | 211 // Methods implementing visibility change notifications. See WindowObserver |
211 // for more details. | 212 // for more details. |
212 void NotifyWindowVisibilityChanged(Window* target); | 213 void NotifyWindowVisibilityChanged(Window* target); |
(...skipping 11 matching lines...) Expand all Loading... |
224 bool PrepareForEmbed(); | 225 bool PrepareForEmbed(); |
225 | 226 |
226 WindowTreeConnection* connection_; | 227 WindowTreeConnection* connection_; |
227 Id id_; | 228 Id id_; |
228 Window* parent_; | 229 Window* parent_; |
229 Children children_; | 230 Children children_; |
230 | 231 |
231 base::ObserverList<WindowObserver> observers_; | 232 base::ObserverList<WindowObserver> observers_; |
232 | 233 |
233 gfx::Rect bounds_; | 234 gfx::Rect bounds_; |
234 gfx::Rect client_area_; | 235 gfx::Insets client_area_; |
235 | 236 |
236 mojom::ViewportMetricsPtr viewport_metrics_; | 237 mojom::ViewportMetricsPtr viewport_metrics_; |
237 | 238 |
238 bool visible_; | 239 bool visible_; |
239 | 240 |
240 SharedProperties properties_; | 241 SharedProperties properties_; |
241 | 242 |
242 // Drawn state is derived from the visible state and the parent's visible | 243 // Drawn state is derived from the visible state and the parent's visible |
243 // state. This field is only used if the window has no parent (eg it's a | 244 // state. This field is only used if the window has no parent (eg it's a |
244 // root). | 245 // root). |
245 bool drawn_; | 246 bool drawn_; |
246 | 247 |
247 // Value struct to keep the name and deallocator for this property. | 248 // Value struct to keep the name and deallocator for this property. |
248 // Key cannot be used for this purpose because it can be char* or | 249 // Key cannot be used for this purpose because it can be char* or |
249 // WindowProperty<>. | 250 // WindowProperty<>. |
250 struct Value { | 251 struct Value { |
251 const char* name; | 252 const char* name; |
252 int64_t value; | 253 int64_t value; |
253 PropertyDeallocator deallocator; | 254 PropertyDeallocator deallocator; |
254 }; | 255 }; |
255 | 256 |
256 std::map<const void*, Value> prop_map_; | 257 std::map<const void*, Value> prop_map_; |
257 | 258 |
258 MOJO_DISALLOW_COPY_AND_ASSIGN(Window); | 259 MOJO_DISALLOW_COPY_AND_ASSIGN(Window); |
259 }; | 260 }; |
260 | 261 |
261 } // namespace mus | 262 } // namespace mus |
262 | 263 |
263 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ | 264 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ |
OLD | NEW |