| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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 WindowObserver; | 30 class WindowObserver; |
| 31 class WindowSurface; | 31 class WindowSurface; |
| 32 class WindowSurfaceBinding; | 32 class WindowSurfaceBinding; |
| 33 class WindowDropTarget; |
| 33 class WindowTreeClient; | 34 class WindowTreeClient; |
| 34 class WindowTreeClientPrivate; | 35 class WindowTreeClientPrivate; |
| 35 | 36 |
| 36 namespace { | 37 namespace { |
| 37 class OrderChangedNotifier; | 38 class OrderChangedNotifier; |
| 38 } | 39 } |
| 39 | 40 |
| 40 // Defined in window_property.h (which we do not include) | 41 // Defined in window_property.h (which we do not include) |
| 41 template <typename T> | 42 template <typename T> |
| 42 struct WindowProperty; | 43 struct WindowProperty; |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 203 |
| 203 bool HasCapture() const; | 204 bool HasCapture() const; |
| 204 void SetCapture(); | 205 void SetCapture(); |
| 205 void ReleaseCapture(); | 206 void ReleaseCapture(); |
| 206 | 207 |
| 207 // Focus. See WindowTreeClient::ClearFocus() to reset focus. | 208 // Focus. See WindowTreeClient::ClearFocus() to reset focus. |
| 208 void SetFocus(); | 209 void SetFocus(); |
| 209 bool HasFocus() const; | 210 bool HasFocus() const; |
| 210 void SetCanFocus(bool can_focus); | 211 void SetCanFocus(bool can_focus); |
| 211 | 212 |
| 213 // Sets whether this window accepts drags. Passing a non-null |drop_target| |
| 214 // will enable acceptance of drops. Passing null will disable it. |
| 215 void SetCanAcceptDrags(WindowDropTarget* drop_target); |
| 216 WindowDropTarget* drop_target() const { return drop_target_; } |
| 217 |
| 212 // Sets whether this window accepts events. | 218 // Sets whether this window accepts events. |
| 213 void SetCanAcceptEvents(bool can_accept_events); | 219 void SetCanAcceptEvents(bool can_accept_events); |
| 214 | 220 |
| 215 // Embedding. See window_tree.mojom for details. | 221 // Embedding. See window_tree.mojom for details. |
| 216 void Embed(ui::mojom::WindowTreeClientPtr client, uint32_t flags = 0); | 222 void Embed(ui::mojom::WindowTreeClientPtr client, uint32_t flags = 0); |
| 217 | 223 |
| 218 // NOTE: callback is run synchronously if Embed() is not allowed on this | 224 // NOTE: callback is run synchronously if Embed() is not allowed on this |
| 219 // Window. | 225 // Window. |
| 220 void Embed(ui::mojom::WindowTreeClientPtr client, | 226 void Embed(ui::mojom::WindowTreeClientPtr client, |
| 221 const EmbedCallback& callback, | 227 const EmbedCallback& callback, |
| 222 uint32_t flags = 0); | 228 uint32_t flags = 0); |
| 223 | 229 |
| 224 // TODO(sky): this API is only applicable to the WindowManager. Move it | 230 // TODO(sky): this API is only applicable to the WindowManager. Move it |
| 225 // to a better place. | 231 // to a better place. |
| 226 void RequestClose(); | 232 void RequestClose(); |
| 227 | 233 |
| 234 // Starts an inter-process drag and drop operation. |
| 235 void PerformDragDrop( |
| 236 const std::map<std::string, std::vector<uint8_t>>& drag_data, |
| 237 int drag_operation, |
| 238 const gfx::Point& cursor_location, |
| 239 const SkBitmap& bitmap, |
| 240 const base::Callback<void(bool)>& callback); |
| 241 |
| 228 // Tells the window manager to take control of moving the window. Returns | 242 // Tells the window manager to take control of moving the window. Returns |
| 229 // true if the move wasn't canceled. | 243 // true if the move wasn't canceled. |
| 230 void PerformWindowMove(mojom::MoveLoopSource source, | 244 void PerformWindowMove(mojom::MoveLoopSource source, |
| 231 const gfx::Point& cursor_location, | 245 const gfx::Point& cursor_location, |
| 232 const base::Callback<void(bool)>& callback); | 246 const base::Callback<void(bool)>& callback); |
| 233 | 247 |
| 234 // Tells the window manager to abort any current move initiated by | 248 // Tells the window manager to abort any current move initiated by |
| 235 // PerformWindowMove(). | 249 // PerformWindowMove(). |
| 236 void CancelWindowMove(); | 250 void CancelWindowMove(); |
| 237 | 251 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 | 349 |
| 336 gfx::Rect bounds_; | 350 gfx::Rect bounds_; |
| 337 gfx::Insets client_area_; | 351 gfx::Insets client_area_; |
| 338 std::vector<gfx::Rect> additional_client_areas_; | 352 std::vector<gfx::Rect> additional_client_areas_; |
| 339 std::unique_ptr<gfx::Rect> hit_test_mask_; | 353 std::unique_ptr<gfx::Rect> hit_test_mask_; |
| 340 | 354 |
| 341 bool visible_; | 355 bool visible_; |
| 342 float opacity_; | 356 float opacity_; |
| 343 int64_t display_id_; | 357 int64_t display_id_; |
| 344 | 358 |
| 359 // The client supplied delegate that receives drag events for this |
| 360 // window. (weak ptr). |
| 361 WindowDropTarget* drop_target_ = nullptr; |
| 362 |
| 345 // Whether this window can accept events. Initialized to true to | 363 // Whether this window can accept events. Initialized to true to |
| 346 // match ServerWindow. | 364 // match ServerWindow. |
| 347 bool can_accept_events_ = true; | 365 bool can_accept_events_ = true; |
| 348 | 366 |
| 349 mojom::Cursor cursor_id_; | 367 mojom::Cursor cursor_id_; |
| 350 | 368 |
| 351 SharedProperties properties_; | 369 SharedProperties properties_; |
| 352 | 370 |
| 353 // Drawn state of our parent. This is only meaningful for root Windows, in | 371 // Drawn state of our parent. This is only meaningful for root Windows, in |
| 354 // which the parent Window isn't exposed to the client. | 372 // which the parent Window isn't exposed to the client. |
| 355 bool parent_drawn_; | 373 bool parent_drawn_; |
| 356 | 374 |
| 357 // Value struct to keep the name and deallocator for this property. | 375 // Value struct to keep the name and deallocator for this property. |
| 358 // Key cannot be used for this purpose because it can be char* or | 376 // Key cannot be used for this purpose because it can be char* or |
| 359 // WindowProperty<>. | 377 // WindowProperty<>. |
| 360 struct Value { | 378 struct Value { |
| 361 const char* name; | 379 const char* name; |
| 362 int64_t value; | 380 int64_t value; |
| 363 PropertyDeallocator deallocator; | 381 PropertyDeallocator deallocator; |
| 364 }; | 382 }; |
| 365 | 383 |
| 366 std::map<const void*, Value> prop_map_; | 384 std::map<const void*, Value> prop_map_; |
| 367 | 385 |
| 368 DISALLOW_COPY_AND_ASSIGN(Window); | 386 DISALLOW_COPY_AND_ASSIGN(Window); |
| 369 }; | 387 }; |
| 370 | 388 |
| 371 } // namespace ui | 389 } // namespace ui |
| 372 | 390 |
| 373 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_ | 391 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_ |
| OLD | NEW |