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

Unified Diff: ui/views/mus/drop_target_mus.h

Issue 2266603002: mus: Implement interwindow drag and drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uploaded for a few comments. Created 4 years, 4 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: ui/views/mus/drop_target_mus.h
diff --git a/ui/views/mus/drop_target_mus.h b/ui/views/mus/drop_target_mus.h
new file mode 100644
index 0000000000000000000000000000000000000000..20053bdef9e23cf04fa767b28b87745f91d7f75b
--- /dev/null
+++ b/ui/views/mus/drop_target_mus.h
@@ -0,0 +1,83 @@
+// 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_VIEWS_MUS_DROP_TARGET_MUS_H_
+#define UI_VIEWS_MUS_DROP_TARGET_MUS_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "services/ui/public/cpp/window_drop_target.h"
+#include "ui/aura/window_observer.h"
+
+namespace aura {
+class RootWindow;
+class Window;
+
+namespace client {
+class DragDropDelegate;
+}
+}
+
+namespace ui {
+class DropTargetEvent;
+class OSExchangeData;
+}
+
+namespace views {
+
+class DropTargetMus : public ui::WindowDropTarget, public aura::WindowObserver {
+ public:
+ DropTargetMus(aura::Window* root_window);
+ ~DropTargetMus() override;
+
+ private:
+ // Common functionality for the ui::DropTargetWin methods to translate from
+ // mus data types to Aura ones.
+ void Translate(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask,
+ std::unique_ptr<ui::OSExchangeData>* data,
+ std::unique_ptr<ui::DropTargetEvent>* event,
+ aura::client::DragDropDelegate** delegate);
+
+ void NotifyDragLeave();
+
+ // Overridden from ui::WindowDropTarget:
+ uint32_t OnDragEnter(std::map<std::string, std::vector<uint8_t>> mime_types,
+ uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) override;
+ uint32_t OnDragOver(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) override;
+ void OnDragLeave() override;
+ uint32_t OnDragDrop(uint32_t key_state,
+ const gfx::Point& position,
+ uint32_t effect_bitmask) override;
+
+ // Overridden from aura::WindowObserver:
+ void OnWindowDestroyed(aura::Window* window) override;
+
+ // The root window associated with this drop target.
+ aura::Window* root_window_;
+
+ // The Aura window that is currently under the cursor. We need to manually
+ // keep track of this because mus will only call our drag enter method once
+ // when the user enters the associated mus::Window. But inside mus there
+ // could be multiple aura windows, so we need to generate drag enter events
+ // for them.
+ aura::Window* target_window_;
+
+ // The entire drag data payload. We receive this during the drag enter event
+ // and cache it so we don't send this multiple times. We reset this value on
+ // leave or drop.
+ std::map<std::string, std::vector<uint8_t>> mime_data_;
+
+ DISALLOW_COPY_AND_ASSIGN(DropTargetMus);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_MUS_DROP_TARGET_MUS_H_

Powered by Google App Engine
This is Rietveld 408576698