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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 int64_t default_value); | 194 int64_t default_value); |
194 int64_t GetLocalPropertyInternal(const void* key, | 195 int64_t GetLocalPropertyInternal(const void* key, |
195 int64_t default_value) const; | 196 int64_t default_value) const; |
196 | 197 |
197 void LocalDestroy(); | 198 void LocalDestroy(); |
198 void LocalAddChild(Window* child); | 199 void LocalAddChild(Window* child); |
199 void LocalRemoveChild(Window* child); | 200 void LocalRemoveChild(Window* child); |
200 // Returns true if the order actually changed. | 201 // Returns true if the order actually changed. |
201 bool LocalReorder(Window* relative, mojom::OrderDirection direction); | 202 bool LocalReorder(Window* relative, mojom::OrderDirection direction); |
202 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); | 203 void LocalSetBounds(const gfx::Rect& old_bounds, const gfx::Rect& new_bounds); |
203 void LocalSetClientArea(const gfx::Rect& new_client_area); | 204 void LocalSetClientArea(const gfx::Insets& new_client_area); |
204 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, | 205 void LocalSetViewportMetrics(const mojom::ViewportMetrics& old_metrics, |
205 const mojom::ViewportMetrics& new_metrics); | 206 const mojom::ViewportMetrics& new_metrics); |
206 void LocalSetDrawn(bool drawn); | 207 void LocalSetDrawn(bool drawn); |
207 void LocalSetVisible(bool visible); | 208 void LocalSetVisible(bool visible); |
208 void LocalSetSharedProperty(const std::string& name, | 209 void LocalSetSharedProperty(const std::string& name, |
209 const std::vector<uint8_t>* data); | 210 const std::vector<uint8_t>* data); |
210 | 211 |
211 // Methods implementing visibility change notifications. See WindowObserver | 212 // Methods implementing visibility change notifications. See WindowObserver |
212 // for more details. | 213 // for more details. |
213 void NotifyWindowVisibilityChanged(Window* target); | 214 void NotifyWindowVisibilityChanged(Window* target); |
(...skipping 11 matching lines...) Expand all Loading... |
225 bool PrepareForEmbed(); | 226 bool PrepareForEmbed(); |
226 | 227 |
227 WindowTreeConnection* connection_; | 228 WindowTreeConnection* connection_; |
228 Id id_; | 229 Id id_; |
229 Window* parent_; | 230 Window* parent_; |
230 Children children_; | 231 Children children_; |
231 | 232 |
232 base::ObserverList<WindowObserver> observers_; | 233 base::ObserverList<WindowObserver> observers_; |
233 | 234 |
234 gfx::Rect bounds_; | 235 gfx::Rect bounds_; |
235 gfx::Rect client_area_; | 236 gfx::Insets client_area_; |
236 | 237 |
237 mojom::ViewportMetricsPtr viewport_metrics_; | 238 mojom::ViewportMetricsPtr viewport_metrics_; |
238 | 239 |
239 bool visible_; | 240 bool visible_; |
240 | 241 |
241 SharedProperties properties_; | 242 SharedProperties properties_; |
242 | 243 |
243 // Drawn state is derived from the visible state and the parent's visible | 244 // Drawn state is derived from the visible state and the parent's visible |
244 // state. This field is only used if the window has no parent (eg it's a | 245 // state. This field is only used if the window has no parent (eg it's a |
245 // root). | 246 // root). |
246 bool drawn_; | 247 bool drawn_; |
247 | 248 |
248 // Value struct to keep the name and deallocator for this property. | 249 // Value struct to keep the name and deallocator for this property. |
249 // Key cannot be used for this purpose because it can be char* or | 250 // Key cannot be used for this purpose because it can be char* or |
250 // WindowProperty<>. | 251 // WindowProperty<>. |
251 struct Value { | 252 struct Value { |
252 const char* name; | 253 const char* name; |
253 int64_t value; | 254 int64_t value; |
254 PropertyDeallocator deallocator; | 255 PropertyDeallocator deallocator; |
255 }; | 256 }; |
256 | 257 |
257 std::map<const void*, Value> prop_map_; | 258 std::map<const void*, Value> prop_map_; |
258 | 259 |
259 MOJO_DISALLOW_COPY_AND_ASSIGN(Window); | 260 MOJO_DISALLOW_COPY_AND_ASSIGN(Window); |
260 }; | 261 }; |
261 | 262 |
262 } // namespace mus | 263 } // namespace mus |
263 | 264 |
264 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ | 265 #endif // COMPONENTS_MUS_PUBLIC_CPP_WINDOW_H_ |
OLD | NEW |