Chromium Code Reviews| 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 SERVICES_UI_PUBLIC_CPP_WINDOW_H_ | 5 #ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_H_ |
| 6 #define SERVICES_UI_PUBLIC_CPP_WINDOW_H_ | 6 #define SERVICES_UI_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/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "mojo/public/cpp/bindings/array.h" | 14 #include "mojo/public/cpp/bindings/array.h" |
| 15 #include "services/shell/public/interfaces/interface_provider.mojom.h" | 15 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
| 16 #include "services/ui/common/types.h" | 16 #include "services/ui/common/types.h" |
| 17 #include "services/ui/public/interfaces/mus_constants.mojom.h" | 17 #include "services/ui/public/interfaces/mus_constants.mojom.h" |
| 18 #include "services/ui/public/interfaces/window_tree.mojom.h" | 18 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 19 #include "ui/gfx/geometry/insets.h" | 19 #include "ui/gfx/geometry/insets.h" |
| 20 #include "ui/gfx/geometry/rect.h" | 20 #include "ui/gfx/geometry/rect.h" |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Size; | 23 class Size; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 | 27 |
| 28 class InputEventHandler; | 28 class InputEventHandler; |
| 29 class ServiceProviderImpl; | 29 class ServiceProviderImpl; |
| 30 class SurfaceIdHandler; | |
| 30 class WindowObserver; | 31 class WindowObserver; |
| 31 class WindowSurface; | 32 class WindowSurface; |
| 32 class WindowSurfaceBinding; | 33 class WindowSurfaceBinding; |
| 33 class WindowDropTarget; | 34 class WindowDropTarget; |
| 34 class WindowTreeClient; | 35 class WindowTreeClient; |
| 35 class WindowTreeClientPrivate; | 36 class WindowTreeClientPrivate; |
| 36 | 37 |
| 37 namespace { | 38 namespace { |
| 38 class OrderChangedNotifier; | 39 class OrderChangedNotifier; |
| 39 } | 40 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 // | 156 // |
| 156 // These properties are only visible in the current process and are not | 157 // These properties are only visible in the current process and are not |
| 157 // shared with other mojo services. | 158 // shared with other mojo services. |
| 158 template <typename T> | 159 template <typename T> |
| 159 void ClearLocalProperty(const WindowProperty<T>* property); | 160 void ClearLocalProperty(const WindowProperty<T>* property); |
| 160 | 161 |
| 161 void set_input_event_handler(InputEventHandler* input_event_handler) { | 162 void set_input_event_handler(InputEventHandler* input_event_handler) { |
| 162 input_event_handler_ = input_event_handler; | 163 input_event_handler_ = input_event_handler; |
| 163 } | 164 } |
| 164 | 165 |
| 166 void set_surface_id_handler(SurfaceIdHandler* surface_id_handler) { | |
| 167 surface_id_handler_ = surface_id_handler; | |
| 168 } | |
| 169 | |
| 165 // Observation. | 170 // Observation. |
| 166 void AddObserver(WindowObserver* observer); | 171 void AddObserver(WindowObserver* observer); |
| 167 void RemoveObserver(WindowObserver* observer); | 172 void RemoveObserver(WindowObserver* observer); |
| 168 | 173 |
| 169 // Tree. | 174 // Tree. |
| 170 Window* parent() { return parent_; } | 175 Window* parent() { return parent_; } |
| 171 const Window* parent() const { return parent_; } | 176 const Window* parent() const { return parent_; } |
| 172 | 177 |
| 173 Window* GetRoot() { | 178 Window* GetRoot() { |
| 174 return const_cast<Window*>(const_cast<const Window*>(this)->GetRoot()); | 179 return const_cast<Window*>(const_cast<const Window*>(this)->GetRoot()); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 302 void LocalSetClientArea( | 307 void LocalSetClientArea( |
| 303 const gfx::Insets& new_client_area, | 308 const gfx::Insets& new_client_area, |
| 304 const std::vector<gfx::Rect>& additional_client_areas); | 309 const std::vector<gfx::Rect>& additional_client_areas); |
| 305 void LocalSetParentDrawn(bool drawn); | 310 void LocalSetParentDrawn(bool drawn); |
| 306 void LocalSetDisplay(int64_t display_id); | 311 void LocalSetDisplay(int64_t display_id); |
| 307 void LocalSetVisible(bool visible); | 312 void LocalSetVisible(bool visible); |
| 308 void LocalSetOpacity(float opacity); | 313 void LocalSetOpacity(float opacity); |
| 309 void LocalSetPredefinedCursor(mojom::Cursor cursor_id); | 314 void LocalSetPredefinedCursor(mojom::Cursor cursor_id); |
| 310 void LocalSetSharedProperty(const std::string& name, | 315 void LocalSetSharedProperty(const std::string& name, |
| 311 const std::vector<uint8_t>* data); | 316 const std::vector<uint8_t>* data); |
| 317 void LocalSetSurfaceId(const cc::SurfaceId& surface_id, | |
| 318 const cc::SurfaceSequence& surface_sequence, | |
| 319 const gfx::Size& frame_size, | |
| 320 float device_scale_factor); | |
| 312 | 321 |
| 313 // Notifies this winodw that its stacking position has changed. | 322 // Notifies this winodw that its stacking position has changed. |
| 314 void NotifyWindowStackingChanged(); | 323 void NotifyWindowStackingChanged(); |
| 315 // Methods implementing visibility change notifications. See WindowObserver | 324 // Methods implementing visibility change notifications. See WindowObserver |
| 316 // for more details. | 325 // for more details. |
| 317 void NotifyWindowVisibilityChanged(Window* target, bool visible); | 326 void NotifyWindowVisibilityChanged(Window* target, bool visible); |
| 318 // Notifies this window's observers. Returns false if |this| was deleted | 327 // Notifies this window's observers. Returns false if |this| was deleted |
| 319 // during the call (by an observer), otherwise true. | 328 // during the call (by an observer), otherwise true. |
| 320 bool NotifyWindowVisibilityChangedAtReceiver(Window* target, bool visible); | 329 bool NotifyWindowVisibilityChangedAtReceiver(Window* target, bool visible); |
| 321 // Notifies this window and its child hierarchy. Returns false if |this| was | 330 // Notifies this window and its child hierarchy. Returns false if |this| was |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 349 Children children_; | 358 Children children_; |
| 350 | 359 |
| 351 Window* stacking_target_; | 360 Window* stacking_target_; |
| 352 Window* transient_parent_; | 361 Window* transient_parent_; |
| 353 Children transient_children_; | 362 Children transient_children_; |
| 354 | 363 |
| 355 bool is_modal_; | 364 bool is_modal_; |
| 356 | 365 |
| 357 base::ObserverList<WindowObserver> observers_; | 366 base::ObserverList<WindowObserver> observers_; |
| 358 InputEventHandler* input_event_handler_; | 367 InputEventHandler* input_event_handler_; |
| 368 SurfaceIdHandler* surface_id_handler_; | |
| 359 | 369 |
| 360 gfx::Rect bounds_; | 370 gfx::Rect bounds_; |
| 361 gfx::Insets client_area_; | 371 gfx::Insets client_area_; |
| 362 std::vector<gfx::Rect> additional_client_areas_; | 372 std::vector<gfx::Rect> additional_client_areas_; |
| 363 std::unique_ptr<gfx::Rect> hit_test_mask_; | 373 std::unique_ptr<gfx::Rect> hit_test_mask_; |
| 364 | 374 |
| 365 bool visible_; | 375 bool visible_; |
| 366 float opacity_; | 376 float opacity_; |
| 367 int64_t display_id_; | 377 int64_t display_id_; |
| 368 | 378 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 386 // Key cannot be used for this purpose because it can be char* or | 396 // Key cannot be used for this purpose because it can be char* or |
| 387 // WindowProperty<>. | 397 // WindowProperty<>. |
| 388 struct Value { | 398 struct Value { |
| 389 const char* name; | 399 const char* name; |
| 390 int64_t value; | 400 int64_t value; |
| 391 PropertyDeallocator deallocator; | 401 PropertyDeallocator deallocator; |
| 392 }; | 402 }; |
| 393 | 403 |
| 394 std::map<const void*, Value> prop_map_; | 404 std::map<const void*, Value> prop_map_; |
| 395 | 405 |
| 406 struct SurfaceInfo { | |
|
sky
2016/10/14 20:55:46
I think this code would be clearer if you passed a
Fady Samuel
2016/10/14 21:32:48
Done.
| |
| 407 cc::SurfaceId surface_id; | |
| 408 cc::SurfaceSequence surface_sequence; | |
| 409 gfx::Size frame_size; | |
| 410 float device_scale_factor; | |
| 411 }; | |
| 412 SurfaceInfo surface_info_; | |
| 413 | |
| 396 DISALLOW_COPY_AND_ASSIGN(Window); | 414 DISALLOW_COPY_AND_ASSIGN(Window); |
| 397 }; | 415 }; |
| 398 | 416 |
| 399 } // namespace ui | 417 } // namespace ui |
| 400 | 418 |
| 401 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_ | 419 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_ |
| OLD | NEW |