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

Unified Diff: ui/aura/mus/drag_drop_controller_mus.h

Issue 2455963006: Wires up drag/drop for aura-mus (Closed)
Patch Set: twweaks Created 4 years, 2 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
« no previous file with comments | « ui/aura/mus/drag_drop_controller_host.h ('k') | ui/aura/mus/drag_drop_controller_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/mus/drag_drop_controller_mus.h
diff --git a/ui/aura/mus/drag_drop_controller_mus.h b/ui/aura/mus/drag_drop_controller_mus.h
new file mode 100644
index 0000000000000000000000000000000000000000..9b4efa81b4a97bf5d340161b5740ae0bb5b9b103
--- /dev/null
+++ b/ui/aura/mus/drag_drop_controller_mus.h
@@ -0,0 +1,114 @@
+// 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 UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
+#define UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
+
+#include <stdint.h>
+
+#include <map>
+#include <memory>
+#include <vector>
+
+#include "ui/aura/client/drag_drop_client.h"
+#include "ui/aura/window_tracker.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
+
+namespace ui {
+class DropTargetEvent;
+class LocatedEvent;
+class OSExchangeData;
+
+namespace mojom {
+class WindowTree;
+}
+}
+
+namespace aura {
+
+class DragDropControllerHost;
+class WindowMus;
+
+// DragDropControllerMus acts as the DragDropClient for aura as well as
+// handling all drag operations from the server. Drag operations are forwarded
+// to the client::DragDropDelegate set on the target Window.
+class DragDropControllerMus : public client::DragDropClient {
+ public:
+ DragDropControllerMus(DragDropControllerHost* drag_drop_controller_host,
+ ui::mojom::WindowTree* window_tree);
+ ~DragDropControllerMus() override;
+
+ // Returns true if a drag was initiated and |id| identifies the change if of
+ // the drag.
+ bool DoesChangeIdMatchDragChangeId(uint32_t id) const;
+
+ // Forwarded from WindowTreeClient. These correspond to the functions of the
+ // same name defined in ui::mojom::WindowTreeClient.
+ void OnDragDropStart(std::map<std::string, std::vector<uint8_t>> data);
+ uint32_t OnDragEnter(WindowMus* window,
+ uint32_t event_flags,
+ const gfx::Point& screen_location,
+ uint32_t effect_bitmask);
+ uint32_t OnDragOver(WindowMus* window,
+ uint32_t event_flags,
+ const gfx::Point& screen_location,
+ uint32_t effect_bitmask);
+ void OnDragLeave(WindowMus* window);
+ uint32_t OnCompleteDrop(WindowMus* window,
+ uint32_t event_flags,
+ const gfx::Point& screen_location,
+ uint32_t effect_bitmask);
+ void OnPerformDragDropCompleted(uint32_t action_taken);
+ void OnDragDropDone();
+
+ // Overridden from client::DragDropClient:
+ int StartDragAndDrop(const ui::OSExchangeData& data,
+ Window* root_window,
+ Window* source_window,
+ const gfx::Point& screen_location,
+ int drag_operations,
+ ui::DragDropTypes::DragEventSource source) override;
+ void DragCancel() override;
+ bool IsDragDropInProgress() override;
+
+ private:
+ struct CurrentDragState;
+
+ // Called from OnDragEnter() and OnDragOver().
+ uint32_t HandleDragEnterOrOver(WindowMus* window,
+ uint32_t event_flags,
+ const gfx::Point& screen_location,
+ uint32_t effect_bitmask,
+ bool is_enter);
+
+ std::unique_ptr<ui::DropTargetEvent> CreateDropTargetEvent(
+ Window* window,
+ uint32_t event_flags,
+ const gfx::Point& screen_location,
+ uint32_t effect_bitmask);
+
+ DragDropControllerHost* drag_drop_controller_host_;
+
+ ui::mojom::WindowTree* window_tree_;
+
+ // State related to being the initiator of a drag started with
+ // PerformDragDrop(). If non-null a drag was started by this client and is
+ // still in progress. This references a value declared on the stack in
+ // StartDragAndDrop().
+ CurrentDragState* current_drag_state_ = nullptr;
+
+ // The entire drag data payload. We receive this during the drag enter event
+ // and cache it so we don't send this multiple times. This value is reset when
+ // the drag is done.
+ std::unique_ptr<ui::OSExchangeData> os_exchange_data_;
+
+ // Used to track the current drop target.
+ WindowTracker drop_target_window_tracker_;
+
+ DISALLOW_COPY_AND_ASSIGN(DragDropControllerMus);
+};
+
+} // namespace aura
+
+#endif // UI_AURA_MUS_DRAG_DROP_CONTROLLER_MUS_H_
« no previous file with comments | « ui/aura/mus/drag_drop_controller_host.h ('k') | ui/aura/mus/drag_drop_controller_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698