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

Unified Diff: services/ui/public/cpp/window_drop_target.h

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Clear the implicit pointer drags before start. 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/public/cpp/window_drop_target.h
diff --git a/services/ui/public/cpp/window_drop_target.h b/services/ui/public/cpp/window_drop_target.h
new file mode 100644
index 0000000000000000000000000000000000000000..096a1600c1abed8d3b28b930e701cc95c6c47ee1
--- /dev/null
+++ b/services/ui/public/cpp/window_drop_target.h
@@ -0,0 +1,64 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_
+#define SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_
+
+#include <map>
+#include <vector>
+
+#include "ui/gfx/geometry/point.h"
+
+namespace ui {
+
+// Interface that clients that want to opt-in to receiving drag drop events
+// pass to their mus::Window. This is the client side equivalent to the
sky 2016/09/08 23:37:20 mus->ui
+// messages defined in ui::ws::DragTargetConnection.
sky 2016/09/08 23:37:20 ui->mojom
+class WindowDropTarget {
+ public:
+ virtual ~WindowDropTarget() {}
+
+ // On the first time the pointer enters the associated mus::Window, we get a
+ // start message with all the data that's part of the drag. (The source
+ // mus::Window receives this immediately through the client library instead
sky 2016/09/08 23:37:20 mus->ui (to a global search/replace as I'm going t
+ // of asynchronously.)
+ virtual void OnDragStart(
+ std::map<std::string, std::vector<uint8_t>> mime_data) = 0;
+
+ // Each time the pointer enters the associated mus::Window, we receive an
+ // enter event and return a bitmask of drop operations that can be performed
+ // at this location, in terms of the ui::mojom::kDropEffect{None,Move,
+ // Copy,Link} constants.
+ virtual uint32_t OnDragEnter(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) = 0;
+
+ // Each time the pointer moves inside the associated mus::Window, we receive
+ // an over event and return a bitmask of drop oeprations.
+ virtual uint32_t OnDragOver(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) = 0;
+
+ // Each time the pointer leaves the associated mus::Window, we receive a
+ // leave event.
+ virtual void OnDragLeave() = 0;
+
+ // If the user releases the pointer over the associated mus::Window, wee
+ // receive this drop event to actually try to perform the drop. Unlike the
+ // other methods in this class which return a value, this return value is not
+ // a bitmask and is the operation which was actually completed. Returning 0
+ // indicates that the drag failed and shouldn't be reported as a success.
+ virtual uint32_t OnDragDrop(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) = 0;
+
+ // When a drag that entered the associated window finishes one way or
+ // another, the target receives this message to clear the mime_data from the
+ // start message, along with any other client specific caches.
+ virtual void OnDragFinish() = 0;
+};
+
+} // namespace ui
+
+#endif // SERVICES_UI_PUBLIC_CPP_WINDOW_DROP_TARGET_H_

Powered by Google App Engine
This is Rietveld 408576698