Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: services/ui/public/cpp/window.h

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky comments Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 SetCanAcceptDrops(WindowDropTarget* drop_target);
216 WindowDropTarget* drop_target() const { return drop_target_; }
sky 2016/09/13 18:15:31 Either return const here, or remove const from sig
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 int drag_pointer,
237 const std::map<std::string, std::vector<uint8_t>>& drag_data,
238 int drag_operation,
239 const gfx::Point& cursor_location,
240 const SkBitmap& bitmap,
241 const base::Callback<void(bool)>& callback);
242
228 // Tells the window manager to take control of moving the window. Returns 243 // Tells the window manager to take control of moving the window. Returns
229 // true if the move wasn't canceled. 244 // true if the move wasn't canceled.
230 void PerformWindowMove(mojom::MoveLoopSource source, 245 void PerformWindowMove(mojom::MoveLoopSource source,
231 const gfx::Point& cursor_location, 246 const gfx::Point& cursor_location,
232 const base::Callback<void(bool)>& callback); 247 const base::Callback<void(bool)>& callback);
233 248
234 // Tells the window manager to abort any current move initiated by 249 // Tells the window manager to abort any current move initiated by
235 // PerformWindowMove(). 250 // PerformWindowMove().
236 void CancelWindowMove(); 251 void CancelWindowMove();
237 252
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 350
336 gfx::Rect bounds_; 351 gfx::Rect bounds_;
337 gfx::Insets client_area_; 352 gfx::Insets client_area_;
338 std::vector<gfx::Rect> additional_client_areas_; 353 std::vector<gfx::Rect> additional_client_areas_;
339 std::unique_ptr<gfx::Rect> hit_test_mask_; 354 std::unique_ptr<gfx::Rect> hit_test_mask_;
340 355
341 bool visible_; 356 bool visible_;
342 float opacity_; 357 float opacity_;
343 int64_t display_id_; 358 int64_t display_id_;
344 359
360 // The client supplied delegate that receives drag events for this
361 // window (weak ptr).
362 WindowDropTarget* drop_target_ = nullptr;
363
345 // Whether this window can accept events. Initialized to true to 364 // Whether this window can accept events. Initialized to true to
346 // match ServerWindow. 365 // match ServerWindow.
347 bool can_accept_events_ = true; 366 bool can_accept_events_ = true;
348 367
349 mojom::Cursor cursor_id_; 368 mojom::Cursor cursor_id_;
350 369
351 SharedProperties properties_; 370 SharedProperties properties_;
352 371
353 // Drawn state of our parent. This is only meaningful for root Windows, in 372 // Drawn state of our parent. This is only meaningful for root Windows, in
354 // which the parent Window isn't exposed to the client. 373 // which the parent Window isn't exposed to the client.
355 bool parent_drawn_; 374 bool parent_drawn_;
356 375
357 // Value struct to keep the name and deallocator for this property. 376 // 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 377 // Key cannot be used for this purpose because it can be char* or
359 // WindowProperty<>. 378 // WindowProperty<>.
360 struct Value { 379 struct Value {
361 const char* name; 380 const char* name;
362 int64_t value; 381 int64_t value;
363 PropertyDeallocator deallocator; 382 PropertyDeallocator deallocator;
364 }; 383 };
365 384
366 std::map<const void*, Value> prop_map_; 385 std::map<const void*, Value> prop_map_;
367 386
368 DISALLOW_COPY_AND_ASSIGN(Window); 387 DISALLOW_COPY_AND_ASSIGN(Window);
369 }; 388 };
370 389
371 } // namespace ui 390 } // namespace ui
372 391
373 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_ 392 #endif // SERVICES_UI_PUBLIC_CPP_WINDOW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698