Move ui::DragDropTypes::DragEventSource to Mojo
This CL adds ui.mojom.DragEventSource and replaces all the original uses
with it. It's a precursor CL for porting DragHostMsg_StartDragging to
Mojo.
Bug: 1039255
Change-Id: I4c3cf9347b45a681ec1ae9b1f6f79eaf1c1ba99d
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2315678
Commit-Queue: Henrique Ferreiro <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Cr-Commit-Position: refs/heads/master@{#794500}
diff --git a/ash/BUILD.gn b/ash/BUILD.gn
index 67fa7f7..b9f43d5 100644
--- a/ash/BUILD.gn
+++ b/ash/BUILD.gn
@@ -1527,6 +1527,7 @@
"//ui/aura",
"//ui/base/cursor:cursor_base",
"//ui/base/cursor/mojom:cursor_type",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/events",
"//ui/gfx",
"//ui/gfx/geometry",
@@ -2181,6 +2182,7 @@
"//ui/base:test_support",
"//ui/base/cursor:cursor_base",
"//ui/base/cursor/mojom:cursor_type",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/base/ime",
"//ui/base/ime/chromeos",
"//ui/chromeos",
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc
index cce8c79f..1380097 100644
--- a/ash/drag_drop/drag_drop_controller.cc
+++ b/ash/drag_drop/drag_drop_controller.cc
@@ -150,20 +150,20 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
if (!enabled_ || IsDragDropInProgress())
return 0;
const ui::OSExchangeDataProvider* provider = &data->provider();
// We do not support touch drag/drop without a drag image.
- if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH &&
+ if (source == ui::mojom::DragEventSource::kTouch &&
provider->GetDragImage().size().IsEmpty())
return 0;
current_drag_event_source_ = source;
DragDropTracker* tracker =
new DragDropTracker(root_window, drag_drop_window_delegate_.get());
- if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ if (source == ui::mojom::DragEventSource::kTouch) {
// We need to transfer the current gesture sequence and the GR's touch event
// queue to the |drag_drop_tracker_|'s capture window so that when it takes
// capture, it still gets a valid gesture state.
@@ -233,7 +233,7 @@
float drag_image_scale = 1;
int drag_image_vertical_offset = 0;
- if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ if (source == ui::mojom::DragEventSource::kTouch) {
drag_image_scale = kTouchDragImageScale;
drag_image_vertical_offset = kTouchDragImageVerticalOffset;
}
@@ -256,7 +256,7 @@
&drag_image_offset_);
drag_image->SetBoundsInScreen(drag_image_bounds);
drag_image->SetWidgetVisible(true);
- if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ if (source == ui::mojom::DragEventSource::kTouch) {
drag_image->SetTouchDragOperationHintPosition(
gfx::Point(drag_image_offset_.x(),
drag_image_offset_.y() + drag_image_vertical_offset));
@@ -295,8 +295,7 @@
// If current drag session was not started by mouse, dont process this mouse
// event, but consume it so it does not interfere with current drag session.
- if (current_drag_event_source_ !=
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE) {
+ if (current_drag_event_source_ != ui::mojom::DragEventSource::kMouse) {
event->StopPropagation();
return;
}
@@ -331,7 +330,7 @@
// If current drag session was not started by touch, dont process this touch
// event, but consume it so it does not interfere with current drag session.
- if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)
+ if (current_drag_event_source_ != ui::mojom::DragEventSource::kTouch)
event->StopPropagation();
if (event->handled())
@@ -354,7 +353,7 @@
event->StopPropagation();
// If current drag session was not started by touch, dont process this event.
- if (current_drag_event_source_ != ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)
+ if (current_drag_event_source_ != ui::mojom::DragEventSource::kTouch)
return;
// Apply kTouchDragImageVerticalOffset to the location.
diff --git a/ash/drag_drop/drag_drop_controller.h b/ash/drag_drop/drag_drop_controller.h
index 318907e..cfd74ed2 100644
--- a/ash/drag_drop/drag_drop_controller.h
+++ b/ash/drag_drop/drag_drop_controller.h
@@ -18,6 +18,7 @@
#include "base/time/time.h"
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/window_observer.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/events/event_constants.h"
#include "ui/events/event_handler.h"
@@ -58,7 +59,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
void AddObserver(aura::client::DragDropClientObserver* observer) override;
@@ -146,8 +147,8 @@
std::unique_ptr<DragDropTracker> drag_drop_tracker_;
std::unique_ptr<DragDropTrackerDelegate> drag_drop_window_delegate_;
- ui::DragDropTypes::DragEventSource current_drag_event_source_ =
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
+ ui::mojom::DragEventSource current_drag_event_source_ =
+ ui::mojom::DragEventSource::kMouse;
// Holds a synthetic long tap event to be sent to the |drag_source_window_|.
// See comment in OnGestureEvent() on why we need this.
diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc
index f0185c65..5966cc7 100644
--- a/ash/drag_drop/drag_drop_controller_unittest.cc
+++ b/ash/drag_drop/drag_drop_controller_unittest.cc
@@ -25,6 +25,7 @@
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/ui_base_switches.h"
#include "ui/events/event.h"
@@ -152,7 +153,7 @@
aura::Window* source_window,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) override {
+ ui::mojom::DragEventSource source) override {
drag_start_received_ = true;
data->GetString(&drag_string_);
return DragDropController::StartDragAndDrop(std::move(data), root_window,
@@ -1033,8 +1034,7 @@
aura::Window* window = widget->GetNativeWindow();
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window, gfx::Point(5, 5),
- ui::DragDropTypes::DRAG_MOVE,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
DragImageWindowObserver observer;
ASSERT_TRUE(GetDragImageWindow());
@@ -1068,8 +1068,7 @@
aura::Window* window = widget->GetNativeWindow();
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window, gfx::Point(405, 405),
- ui::DragDropTypes::DRAG_MOVE,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
DragImageWindowObserver observer;
ASSERT_TRUE(GetDragImageWindow());
GetDragImageWindow()->AddObserver(&observer);
@@ -1113,7 +1112,7 @@
aura::Window* window = widget->GetNativeWindow();
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window, gfx::Point(5, 5),
- ui::DragDropTypes::DRAG_MOVE, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
// Start dragging.
ui::MouseEvent e1(ui::ET_MOUSE_DRAGGED, gfx::Point(200, 0),
@@ -1198,8 +1197,7 @@
aura::Window* window = widget->GetNativeWindow();
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window, gfx::Point(5, 5),
- ui::DragDropTypes::DRAG_MOVE,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
EXPECT_EQ(TestObserver::State::kDragStartedInvoked, observer.state());
@@ -1228,7 +1226,7 @@
drag_drop_controller_->set_enabled(false);
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window, gfx::Point(5, 5),
- ui::DragDropTypes::DRAG_MOVE, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
EXPECT_EQ(TestObserver::State::kNotInvoked, observer.state());
drag_drop_controller_->RemoveObserver(&observer);
@@ -1262,7 +1260,7 @@
data->SetString(base::UTF8ToUTF16("I am being dragged"));
drag_drop_controller_->StartDragAndDrop(
std::move(data), window->GetRootWindow(), window.get(), gfx::Point(5, 5),
- ui::DragDropTypes::DRAG_MOVE, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::DragDropTypes::DRAG_MOVE, ui::mojom::DragEventSource::kMouse);
EXPECT_EQ(EventTargetTestDelegate::State::kPerformDropInvoked,
delegate.state());
diff --git a/ash/drag_drop/drag_image_view.cc b/ash/drag_drop/drag_image_view.cc
index 66206260..c5a57534 100644
--- a/ash/drag_drop/drag_image_view.cc
+++ b/ash/drag_drop/drag_image_view.cc
@@ -10,6 +10,7 @@
#include "base/memory/ptr_util.h"
#include "skia/ext/image_operations.h"
#include "ui/aura/window.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -19,7 +20,7 @@
namespace ash {
-DragImageView::DragImageView(ui::DragDropTypes::DragEventSource event_source)
+DragImageView::DragImageView(ui::mojom::DragEventSource event_source)
: drag_event_source_(event_source) {}
DragImageView::~DragImageView() = default;
@@ -27,7 +28,7 @@
// static
views::UniqueWidgetPtr DragImageView::Create(
aura::Window* root_window,
- ui::DragDropTypes::DragEventSource event_source) {
+ ui::mojom::DragEventSource event_source) {
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_TOOLTIP;
params.name = "DragWidget";
@@ -72,7 +73,7 @@
void DragImageView::SetTouchDragOperationHintOff() {
// Simply set the drag type to non-touch so that no hint is drawn.
- drag_event_source_ = ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
+ drag_event_source_ = ui::mojom::DragEventSource::kMouse;
// This disables the drag hint image. This should reduce the widget size if
// the drag image is smaller than the drag hint image, so we set new bounds.
@@ -167,7 +168,7 @@
}
bool DragImageView::ShouldDrawDragHint() const {
- return drag_event_source_ == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH;
+ return drag_event_source_ == ui::mojom::DragEventSource::kTouch;
}
gfx::Size DragImageView::GetMinimumSize() const {
diff --git a/ash/drag_drop/drag_image_view.h b/ash/drag_drop/drag_image_view.h
index d5f3d0f..c6068646 100644
--- a/ash/drag_drop/drag_image_view.h
+++ b/ash/drag_drop/drag_image_view.h
@@ -10,6 +10,7 @@
#include "ash/ash_export.h"
#include "base/macros.h"
#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/geometry/size.h"
#include "ui/views/controls/image_view.h"
@@ -37,9 +38,8 @@
// |source| is the event source that started this drag drop operation (touch
// or mouse). It is used to determine attributes of the drag image such as
// whether to show drag operation hint on top of the image.
- static views::UniqueWidgetPtr Create(
- aura::Window* root_window,
- ui::DragDropTypes::DragEventSource source);
+ static views::UniqueWidgetPtr Create(aura::Window* root_window,
+ ui::mojom::DragEventSource source);
// Sets the bounds of the native widget in screen
// coordinates.
@@ -72,7 +72,7 @@
gfx::Size GetMinimumSize() const override;
private:
- DragImageView(ui::DragDropTypes::DragEventSource source);
+ DragImageView(ui::mojom::DragEventSource source);
gfx::Image* DragHint() const;
// Drag hint images are only drawn when the input source is touch.
@@ -90,7 +90,7 @@
// we need to know the originally requested size to render the drag image.
gfx::Size drag_image_size_;
- ui::DragDropTypes::DragEventSource drag_event_source_;
+ ui::mojom::DragEventSource drag_event_source_;
// Bitmask of ui::DragDropTypes::DragOperation values.
int touch_drag_operation_ = ui::DragDropTypes::DRAG_NONE;
diff --git a/ash/drag_drop/drag_image_view_unittest.cc b/ash/drag_drop/drag_image_view_unittest.cc
index 4c5ab935..0e8d69e 100644
--- a/ash/drag_drop/drag_image_view_unittest.cc
+++ b/ash/drag_drop/drag_image_view_unittest.cc
@@ -6,7 +6,7 @@
#include "ash/test/ash_test_base.h"
#include "ui/aura/window.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/views/widget/unique_widget_ptr.h"
#include "ui/views/widget/widget.h"
@@ -16,9 +16,8 @@
TEST_F(DragDropImageTest, SetBoundsConsidersDragHintForTouch) {
std::unique_ptr<aura::Window> window = CreateTestWindow();
- views::UniqueWidgetPtr drag_image_widget = DragImageView::Create(
- window.get(),
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_TOUCH);
+ views::UniqueWidgetPtr drag_image_widget =
+ DragImageView::Create(window.get(), ui::mojom::DragEventSource::kTouch);
DragImageView* drag_image_view =
static_cast<DragImageView*>(drag_image_widget->GetContentsView());
@@ -50,9 +49,8 @@
TEST_F(DragDropImageTest, SetBoundsIgnoresDragHintForMouse) {
std::unique_ptr<aura::Window> window = CreateTestWindow();
- views::UniqueWidgetPtr drag_image_widget = DragImageView::Create(
- window.get(),
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_MOUSE);
+ views::UniqueWidgetPtr drag_image_widget =
+ DragImageView::Create(window.get(), ui::mojom::DragEventSource::kMouse);
DragImageView* drag_image_view =
static_cast<DragImageView*>(drag_image_widget->GetContentsView());
diff --git a/ash/shelf/scrollable_shelf_view.cc b/ash/shelf/scrollable_shelf_view.cc
index 349310ce..2f0d44f 100644
--- a/ash/shelf/scrollable_shelf_view.cc
+++ b/ash/shelf/scrollable_shelf_view.cc
@@ -19,6 +19,7 @@
#include "base/metrics/histogram_functions.h"
#include "base/numerics/ranges.h"
#include "chromeos/constants/chromeos_switches.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/compositor/animation_throughput_reporter.h"
#include "ui/compositor/paint_recorder.h"
@@ -1284,7 +1285,7 @@
int blur_radius) {
drag_icon_widget_ =
DragImageView::Create(GetWidget()->GetNativeWindow()->GetRootWindow(),
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::mojom::DragEventSource::kMouse);
DragImageView* drag_icon =
static_cast<DragImageView*>(drag_icon_widget_->GetContentsView());
drag_icon->SetImage(icon);
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index aeb586f..8385cf7 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -52,6 +52,7 @@
#include "base/timer/timer.h"
#include "chromeos/constants/chromeos_switches.h"
#include "ui/accessibility/ax_node_data.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/simple_menu_model.h"
#include "ui/base/ui_base_features.h"
@@ -863,8 +864,8 @@
drag_replaced_view_ = replaced_view;
aura::Window* root_window =
drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow();
- drag_image_widget_ = DragImageView::Create(
- root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ drag_image_widget_ =
+ DragImageView::Create(root_window, ui::mojom::DragEventSource::kMouse);
DragImageView* drag_image = GetDragImage();
if (blur_radius > 0)
SetDragImageBlur(icon.size(), blur_radius);
@@ -1447,8 +1448,8 @@
drag_replaced_view_ = replaced_view;
aura::Window* root_window =
drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow();
- drag_image_widget_ = DragImageView::Create(
- root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ drag_image_widget_ =
+ DragImageView::Create(root_window, ui::mojom::DragEventSource::kMouse);
DragImageView* drag_image = GetDragImage();
drag_image->SetImage(icon);
gfx::Size size = drag_image->GetPreferredSize();
diff --git a/chrome/browser/BUILD.gn b/chrome/browser/BUILD.gn
index ff176a0..23975344 100644
--- a/chrome/browser/BUILD.gn
+++ b/chrome/browser/BUILD.gn
@@ -4691,6 +4691,7 @@
]
deps += [
"//ui/aura",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/compositor",
"//ui/snapshot",
]
diff --git a/chrome/browser/download/drag_download_item_aura.cc b/chrome/browser/download/drag_download_item_aura.cc
index 6bbfbbcc1..3bdb9c7 100644
--- a/chrome/browser/download/drag_download_item_aura.cc
+++ b/chrome/browser/download/drag_download_item_aura.cc
@@ -15,6 +15,7 @@
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/file_info/file_info.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/display/screen.h"
#include "ui/gfx/geometry/point.h"
@@ -53,10 +54,10 @@
data->SetFilenames(file_infos);
gfx::Point location = display::Screen::GetScreen()->GetCursorScreenPoint();
- // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
+ // TODO(varunjain): Properly determine and send DragEventSource below.
aura::client::GetDragDropClient(root_window)
->StartDragAndDrop(
std::move(data), root_window, view, location,
ui::DragDropTypes::DRAG_COPY | ui::DragDropTypes::DRAG_LINK,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::mojom::DragEventSource::kMouse);
}
diff --git a/chrome/browser/extensions/BUILD.gn b/chrome/browser/extensions/BUILD.gn
index 0d980ae..15b2aee 100644
--- a/chrome/browser/extensions/BUILD.gn
+++ b/chrome/browser/extensions/BUILD.gn
@@ -900,6 +900,7 @@
"//ui/accessibility:ax_enums_mojo",
"//ui/base",
"//ui/base/clipboard",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/base/ime",
"//ui/display/manager",
"//ui/gfx",
diff --git a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
index cde5b9d3..00ad2b9 100644
--- a/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
+++ b/chrome/browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc
@@ -42,7 +42,7 @@
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/view_type_utils.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/webui/web_ui_util.h"
@@ -449,10 +449,9 @@
base::JoinString(params->id_list, ", "));
}
- ui::DragDropTypes::DragEventSource source =
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
+ ui::mojom::DragEventSource source = ui::mojom::DragEventSource::kMouse;
if (params->is_from_touch)
- source = ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH;
+ source = ui::mojom::DragEventSource::kTouch;
chrome::DragBookmarks(GetProfile(),
{std::move(nodes), params->drag_node_index,
diff --git a/chrome/browser/ui/BUILD.gn b/chrome/browser/ui/BUILD.gn
index 1612549b..ddec672 100644
--- a/chrome/browser/ui/BUILD.gn
+++ b/chrome/browser/ui/BUILD.gn
@@ -1537,6 +1537,7 @@
"//third_party/libaddressinput:strings",
"//ui/events",
]
+ public_deps += [ "//ui/base/dragdrop/mojom:mojom_headers" ]
if (use_ozone && !is_chromeos) {
deps += [
@@ -3958,6 +3959,7 @@
"//components/ui_devtools/views",
"//device/vr/buildflags:buildflags",
"//services/media_session/public/mojom",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/views:buildflags",
]
diff --git a/chrome/browser/ui/bookmarks/bookmark_browsertest.cc b/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
index 5f00f85..7abd0d10 100644
--- a/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_browsertest.cc
@@ -36,6 +36,7 @@
#include "content/public/test/browser_test_utils.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/gfx/image/image_skia.h"
@@ -231,9 +232,8 @@
chrome::DoBookmarkDragCallback cb = base::BindLambdaForTesting(
[&run_loop, page_title, page_url, expected_point](
std::unique_ptr<ui::OSExchangeData> drag_data,
- gfx::NativeView native_view,
- ui::DragDropTypes::DragEventSource source, gfx::Point point,
- int operation) {
+ gfx::NativeView native_view, ui::mojom::DragEventSource source,
+ gfx::Point point, int operation) {
GURL url;
base::string16 title;
EXPECT_TRUE(drag_data->provider().GetURLAndTitle(
@@ -257,7 +257,7 @@
{{node},
kDragNodeIndex,
platform_util::GetViewForWindow(browser()->window()->GetNativeWindow()),
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE,
+ ui::mojom::DragEventSource::kMouse,
expected_point},
std::move(cb));
@@ -280,7 +280,7 @@
chrome::DoBookmarkDragCallback cb = base::BindLambdaForTesting(
[&run_loop, expected_point](std::unique_ptr<ui::OSExchangeData> drag_data,
gfx::NativeView native_view,
- ui::DragDropTypes::DragEventSource source,
+ ui::mojom::DragEventSource source,
gfx::Point point, int operation) {
#if !defined(OS_MAC)
GURL url;
@@ -308,7 +308,7 @@
kDragNodeIndex,
platform_util::GetViewForWindow(
browser()->window()->GetNativeWindow()),
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE,
+ ui::mojom::DragEventSource::kMouse,
expected_point,
},
std::move(cb));
diff --git a/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc b/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc
index dc10b50..f348416 100644
--- a/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc
+++ b/chrome/browser/ui/bookmarks/bookmark_drag_drop.cc
@@ -29,7 +29,7 @@
std::vector<const bookmarks::BookmarkNode*> nodes,
int drag_node_index,
gfx::NativeView view,
- ui::DragDropTypes::DragEventSource source,
+ ui::mojom::DragEventSource source,
gfx::Point start_point)
: nodes(std::move(nodes)),
drag_node_index(drag_node_index),
diff --git a/chrome/browser/ui/bookmarks/bookmark_drag_drop.h b/chrome/browser/ui/bookmarks/bookmark_drag_drop.h
index aaf1ecef..56029de 100644
--- a/chrome/browser/ui/bookmarks/bookmark_drag_drop.h
+++ b/chrome/browser/ui/bookmarks/bookmark_drag_drop.h
@@ -10,7 +10,7 @@
#include "base/callback.h"
#include "build/build_config.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/gfx/geometry/point.h"
#include "ui/gfx/native_widget_types.h"
@@ -32,7 +32,7 @@
using DoBookmarkDragCallback =
base::OnceCallback<void(std::unique_ptr<ui::OSExchangeData> drag_data,
gfx::NativeView native_view,
- ui::DragDropTypes::DragEventSource source,
+ ui::mojom::DragEventSource source,
gfx::Point start_point,
int operation)>;
@@ -40,7 +40,7 @@
BookmarkDragParams(std::vector<const bookmarks::BookmarkNode*> nodes,
int drag_node_index,
gfx::NativeView view,
- ui::DragDropTypes::DragEventSource source,
+ ui::mojom::DragEventSource source,
gfx::Point start_point);
~BookmarkDragParams();
@@ -54,7 +54,7 @@
gfx::NativeView view;
// The source of the drag.
- ui::DragDropTypes::DragEventSource source;
+ ui::mojom::DragEventSource source;
// The point the drag started.
gfx::Point start_point;
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc b/chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc
index 5ec506a..d9e33fa 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_drag_drop_views.cc
@@ -19,6 +19,7 @@
#include "components/bookmarks/browser/bookmark_node_data.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -262,7 +263,7 @@
int64_t drag_node_id_ = -1;
int count_;
gfx::NativeView native_view_;
- ui::DragDropTypes::DragEventSource source_;
+ ui::mojom::DragEventSource source_;
const gfx::Point start_point_;
int operation_;
@@ -280,7 +281,7 @@
void DoDragImpl(std::unique_ptr<ui::OSExchangeData> drag_data,
gfx::NativeView native_view,
- ui::DragDropTypes::DragEventSource source,
+ ui::mojom::DragEventSource source,
gfx::Point point,
int operation) {
// Allow nested run loop so we get DnD events as we drag this around.
diff --git a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
index 53368f8..4557396 100644
--- a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
+++ b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
@@ -277,7 +277,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override {
+ ui::mojom::DragEventSource source) override {
DCHECK(!drag_started_);
if (!drag_started_) {
drag_started_ = true;
diff --git a/chrome/browser/ui/views/toolbar/home_button.cc b/chrome/browser/ui/views/toolbar/home_button.cc
index b1fb3fa..1bbffb4 100644
--- a/chrome/browser/ui/views/toolbar/home_button.cc
+++ b/chrome/browser/ui/views/toolbar/home_button.cc
@@ -16,6 +16,7 @@
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/user_prefs/user_prefs.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/menu_model.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index d2867693..65285f1 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -745,6 +745,7 @@
"//ui/accessibility:test_support",
"//ui/base:test_support",
"//ui/base/clipboard:clipboard_test_support",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/compositor:test_support",
"//ui/native_theme:test_support",
"//ui/resources",
diff --git a/components/exo/BUILD.gn b/components/exo/BUILD.gn
index 8088685..5799987 100644
--- a/components/exo/BUILD.gn
+++ b/components/exo/BUILD.gn
@@ -106,6 +106,7 @@
public_deps = [
"//ui/base/cursor:cursor_base",
"//ui/base/cursor/mojom:cursor_type",
+ "//ui/base/dragdrop/mojom:mojom_headers",
]
if (is_chromeos) {
@@ -274,6 +275,7 @@
"//chromeos/constants",
"//ui/base:test_support",
"//ui/base/cursor/mojom:cursor_type",
+ "//ui/base/dragdrop/mojom:mojom_shared",
]
}
diff --git a/components/exo/data_device.cc b/components/exo/data_device.cc
index 4682130..62ed63f 100644
--- a/components/exo/data_device.cc
+++ b/components/exo/data_device.cc
@@ -65,7 +65,7 @@
void DataDevice::StartDrag(DataSource* source,
Surface* origin,
Surface* icon,
- ui::DragDropTypes::DragEventSource event_source) {
+ ui::mojom::DragEventSource event_source) {
seat_->StartDrag(source, origin, icon, event_source);
}
diff --git a/components/exo/data_device.h b/components/exo/data_device.h
index 8b0bb19..bd6d23210 100644
--- a/components/exo/data_device.h
+++ b/components/exo/data_device.h
@@ -13,7 +13,7 @@
#include "components/exo/surface.h"
#include "components/exo/surface_observer.h"
#include "ui/base/clipboard/clipboard_observer.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
namespace ui {
class DropTargetEvent;
@@ -52,7 +52,7 @@
void StartDrag(DataSource* source,
Surface* origin,
Surface* icon,
- ui::DragDropTypes::DragEventSource event_source);
+ ui::mojom::DragEventSource event_source);
// Sets selection data to the clipboard.
// |source| represents data comes from the client.
diff --git a/components/exo/drag_drop_operation.cc b/components/exo/drag_drop_operation.cc
index e7ad6b3..5224320 100644
--- a/components/exo/drag_drop_operation.cc
+++ b/components/exo/drag_drop_operation.cc
@@ -13,6 +13,7 @@
#include "components/viz/common/frame_sinks/copy_output_request.h"
#include "components/viz/common/frame_sinks/copy_output_result.h"
#include "ui/aura/client/drag_drop_client.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
@@ -79,18 +80,17 @@
Surface* origin,
Surface* icon,
const gfx::Point& drag_start_point,
- ui::DragDropTypes::DragEventSource event_source) {
+ ui::mojom::DragEventSource event_source) {
auto* dnd_op = new DragDropOperation(source, origin, icon, drag_start_point,
event_source);
return dnd_op->weak_ptr_factory_.GetWeakPtr();
}
-DragDropOperation::DragDropOperation(
- DataSource* source,
- Surface* origin,
- Surface* icon,
- const gfx::Point& drag_start_point,
- ui::DragDropTypes::DragEventSource event_source)
+DragDropOperation::DragDropOperation(DataSource* source,
+ Surface* origin,
+ Surface* icon,
+ const gfx::Point& drag_start_point,
+ ui::mojom::DragEventSource event_source)
: SurfaceTreeHost("ExoDragDropOperation"),
source_(std::make_unique<ScopedDataSource>(source, this)),
origin_(std::make_unique<ScopedSurface>(origin, this)),
diff --git a/components/exo/drag_drop_operation.h b/components/exo/drag_drop_operation.h
index 823258c..436cec3 100644
--- a/components/exo/drag_drop_operation.h
+++ b/components/exo/drag_drop_operation.h
@@ -12,7 +12,7 @@
#include "components/exo/surface_tree_host.h"
#include "components/exo/wm_helper.h"
#include "ui/aura/client/drag_drop_client_observer.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
namespace ash {
class DragDropController;
@@ -51,7 +51,7 @@
Surface* origin,
Surface* icon,
const gfx::Point& drag_start_point,
- ui::DragDropTypes::DragEventSource event_source);
+ ui::mojom::DragEventSource event_source);
// Abort the operation if it hasn't been started yet, otherwise do nothing.
void AbortIfPending();
@@ -79,7 +79,7 @@
Surface* origin,
Surface* icon,
const gfx::Point& drag_start_point,
- ui::DragDropTypes::DragEventSource event_source);
+ ui::mojom::DragEventSource event_source);
~DragDropOperation() override;
void CaptureDragIcon();
@@ -119,7 +119,7 @@
// change in the future.
std::string mime_type_;
- ui::DragDropTypes::DragEventSource event_source_;
+ ui::mojom::DragEventSource event_source_;
base::WeakPtrFactory<DragDropOperation> weak_ptr_factory_;
diff --git a/components/exo/drag_drop_operation_unittest.cc b/components/exo/drag_drop_operation_unittest.cc
index 9e02d45..4cccc4c 100644
--- a/components/exo/drag_drop_operation_unittest.cc
+++ b/components/exo/drag_drop_operation_unittest.cc
@@ -16,6 +16,7 @@
#include "components/exo/surface.h"
#include "components/exo/test/exo_test_base.h"
#include "ui/aura/client/drag_drop_client.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
namespace exo {
namespace {
@@ -103,7 +104,7 @@
auto operation = DragDropOperation::Create(
data_source.get(), origin_surface.get(), icon_surface.get(), gfx::Point(),
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::mojom::DragEventSource::kMouse);
icon_surface->Commit();
base::RunLoop run_loop;
diff --git a/components/exo/pointer_unittest.cc b/components/exo/pointer_unittest.cc
index 90612f1..34098cf 100644
--- a/components/exo/pointer_unittest.cc
+++ b/components/exo/pointer_unittest.cc
@@ -30,6 +30,7 @@
#include "ui/aura/client/cursor_client.h"
#include "ui/aura/client/focus_client.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/events/event_utils.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/widget/widget.h"
@@ -937,8 +938,7 @@
EXPECT_CALL(pointer_delegate, OnPointerEnter(&origin, gfx::PointF(), 0));
generator.MoveMouseTo(origin.window()->GetBoundsInScreen().origin());
- seat.StartDrag(&source, &origin, &icon,
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_MOUSE);
+ seat.StartDrag(&source, &origin, &icon, ui::mojom::DragEventSource::kMouse);
EXPECT_TRUE(seat.get_drag_drop_operation_for_testing());
EXPECT_CALL(pointer_delegate, OnPointerButton).Times(2);
diff --git a/components/exo/seat.cc b/components/exo/seat.cc
index e4915ff..5a19ee3 100644
--- a/components/exo/seat.cc
+++ b/components/exo/seat.cc
@@ -81,7 +81,7 @@
void Seat::StartDrag(DataSource* source,
Surface* origin,
Surface* icon,
- ui::DragDropTypes::DragEventSource event_source) {
+ ui::mojom::DragEventSource event_source) {
// DragDropOperation manages its own lifetime.
drag_drop_operation_ = DragDropOperation::Create(
source, origin, icon, last_location_, event_source);
diff --git a/components/exo/seat.h b/components/exo/seat.h
index d5730af..e2b028ad 100644
--- a/components/exo/seat.h
+++ b/components/exo/seat.h
@@ -13,7 +13,7 @@
#include "ui/aura/client/focus_change_observer.h"
#include "ui/base/clipboard/clipboard_observer.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/events/event_handler.h"
#include "ui/events/keycodes/dom/dom_codes.h"
#include "ui/events/platform/platform_event_observer.h"
@@ -70,7 +70,7 @@
void StartDrag(DataSource* source,
Surface* origin,
Surface* icon,
- ui::DragDropTypes::DragEventSource event_source);
+ ui::mojom::DragEventSource event_source);
// Sets the last location in screen coordinates, irrespective of mouse or
// touch.
diff --git a/components/exo/seat_unittest.cc b/components/exo/seat_unittest.cc
index ac490f0..bde042f 100644
--- a/components/exo/seat_unittest.cc
+++ b/components/exo/seat_unittest.cc
@@ -16,6 +16,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
@@ -491,8 +492,7 @@
// Give origin a root window for DragDropOperation.
GetContext()->AddChild(origin.window());
- seat.StartDrag(&source, &origin, &icon,
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_MOUSE);
+ seat.StartDrag(&source, &origin, &icon, ui::mojom::DragEventSource::kMouse);
EXPECT_TRUE(seat.get_drag_drop_operation_for_testing());
seat.AbortPendingDragOperation();
EXPECT_FALSE(seat.get_drag_drop_operation_for_testing());
diff --git a/components/exo/touch_unittest.cc b/components/exo/touch_unittest.cc
index 217216f2..9c4c6b61 100644
--- a/components/exo/touch_unittest.cc
+++ b/components/exo/touch_unittest.cc
@@ -19,6 +19,7 @@
#include "components/exo/touch_delegate.h"
#include "components/exo/touch_stylus_delegate.h"
#include "testing/gmock/include/gmock/gmock.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/events/base_event_utils.h"
#include "ui/events/test/event_generator.h"
#include "ui/views/widget/widget.h"
@@ -519,8 +520,7 @@
EXPECT_CALL(touch_delegate, OnTouchFrame()).Times(2);
generator.MoveTouch(origin.window()->GetBoundsInScreen().origin());
- seat.StartDrag(&source, &origin, &icon,
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_MOUSE);
+ seat.StartDrag(&source, &origin, &icon, ui::mojom::DragEventSource::kMouse);
EXPECT_TRUE(seat.get_drag_drop_operation_for_testing());
EXPECT_CALL(touch_delegate, OnTouchDown).Times(1);
diff --git a/components/exo/wayland/BUILD.gn b/components/exo/wayland/BUILD.gn
index 8af1488..ae2f536 100644
--- a/components/exo/wayland/BUILD.gn
+++ b/components/exo/wayland/BUILD.gn
@@ -101,6 +101,7 @@
"//third_party/wayland-protocols:xdg_shell_protocol",
"//ui/aura",
"//ui/base",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/display/manager",
"//ui/events:dom_keycode_converter",
"//ui/events:events_base",
diff --git a/components/exo/wayland/wl_data_device_manager.cc b/components/exo/wayland/wl_data_device_manager.cc
index 5d08696c85..a34b13c 100644
--- a/components/exo/wayland/wl_data_device_manager.cc
+++ b/components/exo/wayland/wl_data_device_manager.cc
@@ -20,6 +20,7 @@
#include "components/exo/display.h"
#include "components/exo/wayland/serial_tracker.h"
#include "components/exo/wayland/server_util.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
namespace exo {
namespace wayland {
@@ -310,14 +311,12 @@
}
if (event_type == wayland::SerialTracker::EventType::POINTER_BUTTON_DOWN &&
serial_tracker_->GetPointerDownSerial() == serial) {
- data_device->StartDrag(
- source, origin, icon,
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_MOUSE);
+ data_device->StartDrag(source, origin, icon,
+ ui::mojom::DragEventSource::kMouse);
} else if (event_type == wayland::SerialTracker::EventType::TOUCH_DOWN &&
serial_tracker_->GetTouchDownSerial() == serial) {
- data_device->StartDrag(
- source, origin, icon,
- ui::DragDropTypes::DragEventSource::DRAG_EVENT_SOURCE_TOUCH);
+ data_device->StartDrag(source, origin, icon,
+ ui::mojom::DragEventSource::kTouch);
} else {
LOG(ERROR) << "The serial passed to StartDrag does not match its "
"expected types.";
diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
index bfecb782..38dd74f 100644
--- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc
+++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc
@@ -48,6 +48,7 @@
#include "third_party/blink/public/common/input/synthetic_web_input_event_builders.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drop_target_event.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
diff --git a/content/common/BUILD.gn b/content/common/BUILD.gn
index 2e096b7..13d4d9f 100644
--- a/content/common/BUILD.gn
+++ b/content/common/BUILD.gn
@@ -218,6 +218,8 @@
"//ui/accessibility/mojom",
"//ui/base/cursor:cursor_base",
"//ui/base/cursor/mojom:cursor_type",
+ "//ui/base/dragdrop/mojom:mojom_headers",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/events/ipc",
]
deps = [
diff --git a/content/common/drag_event_source_info.h b/content/common/drag_event_source_info.h
index d78ac45..f454779 100644
--- a/content/common/drag_event_source_info.h
+++ b/content/common/drag_event_source_info.h
@@ -6,7 +6,7 @@
#define CONTENT_COMMON_DRAG_EVENT_SOURCE_INFO_H_
#include "content/common/content_export.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/gfx/geometry/point.h"
namespace content {
@@ -14,7 +14,7 @@
// Information about the event that started a drag session.
struct CONTENT_EXPORT DragEventSourceInfo {
gfx::Point event_location;
- ui::DragDropTypes::DragEventSource event_source;
+ ui::mojom::DragEventSource event_source;
};
} // namespace content
diff --git a/content/common/drag_traits.h b/content/common/drag_traits.h
index f165ec0..b4aa9dc 100644
--- a/content/common/drag_traits.h
+++ b/content/common/drag_traits.h
@@ -7,6 +7,7 @@
#include "content/common/drag_event_source_info.h"
#include "ipc/ipc_message_macros.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/gfx/geometry/point.h"
#define IPC_MESSAGE_START DragMsgStart
@@ -16,4 +17,7 @@
IPC_STRUCT_TRAITS_MEMBER(event_source)
IPC_STRUCT_TRAITS_END()
+IPC_ENUM_TRAITS_MAX_VALUE(ui::mojom::DragEventSource,
+ ui::mojom::DragEventSource::kMaxValue)
+
#endif // CONTENT_COMMON_DRAG_TRAITS_H_
diff --git a/content/public/common/common_param_traits_macros.h b/content/public/common/common_param_traits_macros.h
index aa7b5ad..1c6f22d 100644
--- a/content/public/common/common_param_traits_macros.h
+++ b/content/public/common/common_param_traits_macros.h
@@ -27,7 +27,6 @@
#include "third_party/blink/public/platform/web_rect.h"
#include "third_party/blink/public/platform/web_url_request.h"
#include "ui/accessibility/ax_param_traits.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/page_transition_types.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/ipc/geometry/gfx_param_traits.h"
@@ -338,8 +337,6 @@
IPC_STRUCT_TRAITS_END()
IPC_ENUM_TRAITS(blink::WebDragOperation) // Bitmask.
-IPC_ENUM_TRAITS_MAX_VALUE(ui::DragDropTypes::DragEventSource,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_LAST)
IPC_ENUM_TRAITS_MAX_VALUE(content::DropData::Kind,
content::DropData::Kind::LAST)
diff --git a/content/renderer/BUILD.gn b/content/renderer/BUILD.gn
index aa9c757..39f15d88 100644
--- a/content/renderer/BUILD.gn
+++ b/content/renderer/BUILD.gn
@@ -379,6 +379,7 @@
"//ui/base",
"//ui/base/clipboard",
"//ui/base/cursor:cursor_base",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/base/ime",
"//ui/display",
"//ui/events:dom_keycode_converter",
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 31e8817..47ceac9 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -102,6 +102,7 @@
#include "third_party/blink/public/web/web_widget.h"
#include "third_party/skia/include/core/SkShader.h"
#include "ui/base/clipboard/clipboard_constants.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/ui_base_features.h"
#include "ui/base/ui_base_switches.h"
#include "ui/events/base_event_utils.h"
@@ -918,8 +919,7 @@
}
bool RenderWidget::WillHandleGestureEvent(const blink::WebGestureEvent& event) {
- possible_drag_event_info_.event_source =
- ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH;
+ possible_drag_event_info_.event_source = ui::mojom::DragEventSource::kTouch;
possible_drag_event_info_.event_location =
gfx::ToFlooredPoint(event.PositionInScreen());
@@ -930,8 +930,7 @@
for (auto& observer : render_frames_)
observer.RenderWidgetWillHandleMouseEvent();
- possible_drag_event_info_.event_source =
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE;
+ possible_drag_event_info_.event_source = ui::mojom::DragEventSource::kMouse;
possible_drag_event_info_.event_location =
gfx::Point(event.PositionInScreen().x(), event.PositionInScreen().y());
diff --git a/ui/aura/BUILD.gn b/ui/aura/BUILD.gn
index 54dce2a..0299d0f 100644
--- a/ui/aura/BUILD.gn
+++ b/ui/aura/BUILD.gn
@@ -136,6 +136,7 @@
public_deps = [
"//ui/base/cursor:cursor_base",
+ "//ui/base/dragdrop/mojom:mojom_headers",
"//ui/base/ime",
"//ui/compositor",
]
diff --git a/ui/aura/client/drag_drop_client.h b/ui/aura/client/drag_drop_client.h
index 3d08256..a6fa5ef 100644
--- a/ui/aura/client/drag_drop_client.h
+++ b/ui/aura/client/drag_drop_client.h
@@ -8,7 +8,7 @@
#include <memory>
#include "ui/aura/aura_export.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
@@ -39,7 +39,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) = 0;
+ ui::mojom::DragEventSource source) = 0;
// Called when a drag and drop session is cancelled.
virtual void DragCancel() = 0;
diff --git a/ui/base/dragdrop/drag_drop_types.h b/ui/base/dragdrop/drag_drop_types.h
index ae89b85..a6f0495 100644
--- a/ui/base/dragdrop/drag_drop_types.h
+++ b/ui/base/dragdrop/drag_drop_types.h
@@ -21,13 +21,6 @@
DRAG_LINK = 1 << 2
};
- enum DragEventSource {
- DRAG_EVENT_SOURCE_MOUSE = 0,
- DRAG_EVENT_SOURCE_TOUCH,
- DRAG_EVENT_SOURCE_LAST = DRAG_EVENT_SOURCE_TOUCH,
- DRAG_EVENT_SOURCE_COUNT
- };
-
#if defined(OS_WIN)
static uint32_t DragOperationToDropEffect(int drag_operation);
static int DropEffectToDragOperation(uint32_t effect);
diff --git a/ui/base/dragdrop/mojom/BUILD.gn b/ui/base/dragdrop/mojom/BUILD.gn
new file mode 100644
index 0000000..501cb0e
--- /dev/null
+++ b/ui/base/dragdrop/mojom/BUILD.gn
@@ -0,0 +1,9 @@
+# Copyright 2020 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.
+
+import("//mojo/public/tools/bindings/mojom.gni")
+
+mojom("mojom") {
+ sources = [ "drag_drop_types.mojom" ]
+}
diff --git a/ui/base/dragdrop/mojom/OWNERS b/ui/base/dragdrop/mojom/OWNERS
new file mode 100644
index 0000000..08850f4
--- /dev/null
+++ b/ui/base/dragdrop/mojom/OWNERS
@@ -0,0 +1,2 @@
+per-file *.mojom=set noparent
+per-file *.mojom=file://ipc/SECURITY_OWNERS
diff --git a/ui/base/dragdrop/mojom/drag_drop_types.mojom b/ui/base/dragdrop/mojom/drag_drop_types.mojom
new file mode 100644
index 0000000..bd378c3
--- /dev/null
+++ b/ui/base/dragdrop/mojom/drag_drop_types.mojom
@@ -0,0 +1,10 @@
+// Copyright 2020 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.
+
+module ui.mojom;
+
+enum DragEventSource {
+ kMouse,
+ kTouch
+};
diff --git a/ui/views/BUILD.gn b/ui/views/BUILD.gn
index 9c43bbb..29ebfd2 100644
--- a/ui/views/BUILD.gn
+++ b/ui/views/BUILD.gn
@@ -484,6 +484,7 @@
"//third_party/icu",
"//ui/accessibility",
"//ui/base/clipboard",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/display",
"//ui/latency",
"//ui/native_theme",
@@ -503,6 +504,7 @@
"//ui/base",
"//ui/base/clipboard",
"//ui/base/cursor:cursor_base",
+ "//ui/base/dragdrop/mojom:mojom_headers",
"//ui/base/ime/init",
"//ui/compositor",
"//ui/display",
@@ -1150,6 +1152,7 @@
"//ui/base:test_support",
"//ui/base/clipboard",
"//ui/base/clipboard:clipboard_test_support",
+ "//ui/base/dragdrop/mojom:mojom_shared",
"//ui/base/ime/init",
"//ui/compositor:test_support",
"//ui/display:test_support",
diff --git a/ui/views/cocoa/drag_drop_client_mac.h b/ui/views/cocoa/drag_drop_client_mac.h
index 608e73a..6e48ad44 100644
--- a/ui/views/cocoa/drag_drop_client_mac.h
+++ b/ui/views/cocoa/drag_drop_client_mac.h
@@ -12,7 +12,7 @@
#include "base/callback.h"
#include "base/macros.h"
#include "components/remote_cocoa/app_shim/drag_drop_client.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/views/views_export.h"
#include "ui/views/widget/drop_helper.h"
@@ -46,7 +46,7 @@
void StartDragAndDrop(View* view,
std::unique_ptr<ui::OSExchangeData> data,
int operation,
- ui::DragDropTypes::DragEventSource source);
+ ui::mojom::DragEventSource source);
DropHelper* drop_helper() { return &drop_helper_; }
diff --git a/ui/views/cocoa/drag_drop_client_mac.mm b/ui/views/cocoa/drag_drop_client_mac.mm
index 16ed882..eb361a9 100644
--- a/ui/views/cocoa/drag_drop_client_mac.mm
+++ b/ui/views/cocoa/drag_drop_client_mac.mm
@@ -9,6 +9,7 @@
#include "base/strings/sys_string_conversions.h"
#import "components/remote_cocoa/app_shim/bridged_content_view.h"
#import "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
#import "ui/base/dragdrop/os_exchange_data_provider_mac.h"
#include "ui/gfx/image/image_skia_util_mac.h"
#include "ui/views/drag_utils.h"
@@ -29,7 +30,7 @@
View* view,
std::unique_ptr<ui::OSExchangeData> data,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
exchange_data_ = std::move(data);
source_operation_ = operation;
is_drag_source_ = true;
diff --git a/ui/views/cocoa/drag_drop_client_mac_unittest.mm b/ui/views/cocoa/drag_drop_client_mac_unittest.mm
index 17c83e4..8fb1b38 100644
--- a/ui/views/cocoa/drag_drop_client_mac_unittest.mm
+++ b/ui/views/cocoa/drag_drop_client_mac_unittest.mm
@@ -12,6 +12,8 @@
#include "base/threading/thread_task_runner_handle.h"
#import "components/remote_cocoa/app_shim/native_widget_ns_window_bridge.h"
#import "ui/base/clipboard/clipboard_util_mac.h"
+#import "ui/base/dragdrop/drag_drop_types.h"
+#import "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/gfx/image/image_unittest_util.h"
#import "ui/views/cocoa/native_widget_mac_ns_window_host.h"
#include "ui/views/test/widget_test.h"
@@ -262,8 +264,8 @@
base::Unretained(drag_drop_client())));
// It will call ReleaseCapture().
- drag_drop_client()->StartDragAndDrop(
- target_, std::move(data), 0, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ drag_drop_client()->StartDragAndDrop(target_, std::move(data), 0,
+ ui::mojom::DragEventSource::kMouse);
// The capture should be released.
EXPECT_FALSE(ns_window_host_->IsMouseCaptureActive());
diff --git a/ui/views/controls/button/menu_button_unittest.cc b/ui/views/controls/button/menu_button_unittest.cc
index 77204842..0a51358 100644
--- a/ui/views/controls/button/menu_button_unittest.cc
+++ b/ui/views/controls/button/menu_button_unittest.cc
@@ -26,6 +26,7 @@
#if defined(USE_AURA)
#include "ui/aura/client/drag_drop_client.h"
#include "ui/aura/client/drag_drop_client_observer.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/events/event.h"
#include "ui/events/event_handler.h"
#endif
@@ -228,7 +229,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
void AddObserver(aura::client::DragDropClientObserver* observer) override {}
@@ -258,7 +259,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
if (IsDragDropInProgress())
return ui::DragDropTypes::DRAG_NONE;
drag_in_progress_ = true;
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 968a37a..bc95f2a1 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -17,6 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
#include "build/build_config.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/display/screen.h"
#include "ui/events/event.h"
@@ -1476,10 +1477,9 @@
int drag_ops = item->GetDelegate()->GetDragOperations(item);
did_initiate_drag_ = true;
base::WeakPtr<MenuController> this_ref = AsWeakPtr();
- // TODO(varunjain): Properly determine and send DRAG_EVENT_SOURCE below.
+ // TODO(varunjain): Properly determine and send DragEventSource below.
item->GetWidget()->RunShellDrag(nullptr, std::move(data), widget_loc,
- drag_ops,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ drag_ops, ui::mojom::DragEventSource::kMouse);
// MenuController may have been deleted so check before accessing member
// variables.
if (this_ref)
diff --git a/ui/views/controls/menu/menu_controller_unittest.cc b/ui/views/controls/menu/menu_controller_unittest.cc
index 7daab60..e44796e 100644
--- a/ui/views/controls/menu/menu_controller_unittest.cc
+++ b/ui/views/controls/menu/menu_controller_unittest.cc
@@ -45,6 +45,7 @@
#include "ui/aura/null_window_targeter.h"
#include "ui/aura/scoped_window_targeter.h"
#include "ui/aura/window.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/views/controls/menu/menu_pre_target_handler.h"
#endif
@@ -201,7 +202,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
@@ -222,7 +223,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
drag_in_progress_ = true;
start_drag_and_drop_callback_.Run();
return 0;
diff --git a/ui/views/drag_utils.h b/ui/views/drag_utils.h
index 1604d9ec..40cf7b70 100644
--- a/ui/views/drag_utils.h
+++ b/ui/views/drag_utils.h
@@ -7,7 +7,7 @@
#include <memory>
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/views_export.h"
@@ -24,7 +24,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source);
+ ui::mojom::DragEventSource source);
// Returns the device scale for the display associated with this |widget|'s
// native view.
diff --git a/ui/views/drag_utils_aura.cc b/ui/views/drag_utils_aura.cc
index 3142d9c0f..f888369 100644
--- a/ui/views/drag_utils_aura.cc
+++ b/ui/views/drag_utils_aura.cc
@@ -15,7 +15,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
gfx::Point screen_location(location);
wm::ConvertPointToScreen(view, &screen_location);
aura::Window* root_window = view->GetRootWindow();
diff --git a/ui/views/drag_utils_mac.mm b/ui/views/drag_utils_mac.mm
index 59dc6ea..256913a 100644
--- a/ui/views/drag_utils_mac.mm
+++ b/ui/views/drag_utils_mac.mm
@@ -10,7 +10,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
NOTIMPLEMENTED();
}
diff --git a/ui/views/view.cc b/ui/views/view.cc
index a000a81..174013d 100644
--- a/ui/views/view.cc
+++ b/ui/views/view.cc
@@ -26,6 +26,7 @@
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/base/cursor/cursor.h"
#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/ime/input_method.h"
#include "ui/compositor/clip_recorder.h"
#include "ui/compositor/compositor.h"
@@ -2779,7 +2780,7 @@
drag_controller_->CanStartDragForView(this, GetDragInfo()->start_pt,
event->location()))) {
if (DoDrag(*event, GetDragInfo()->start_pt,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE)) {
+ ui::mojom::DragEventSource::kMouse)) {
event->StopPropagation();
return;
}
@@ -2965,7 +2966,7 @@
bool View::DoDrag(const ui::LocatedEvent& event,
const gfx::Point& press_pt,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
int drag_operations = GetDragOperations(press_pt);
if (drag_operations == ui::DragDropTypes::DRAG_NONE)
return false;
diff --git a/ui/views/view.h b/ui/views/view.h
index 3c45851..3caacb00 100644
--- a/ui/views/view.h
+++ b/ui/views/view.h
@@ -30,8 +30,8 @@
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/class_property.h"
#include "ui/base/clipboard/clipboard_format_type.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drop_target_event.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/ui_base_types.h"
#include "ui/compositor/layer_delegate.h"
@@ -1868,7 +1868,7 @@
// Returns true if a drag was started.
bool DoDrag(const ui::LocatedEvent& event,
const gfx::Point& press_pt,
- ui::DragDropTypes::DragEventSource source);
+ ui::mojom::DragEventSource source);
// Property support ----------------------------------------------------------
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc
index 27e55c05..ab68d6d 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.cc
@@ -128,7 +128,7 @@
aura::Window* source_window,
const gfx::Point& root_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
if (!drag_handler_)
return ui::DragDropTypes::DragOperation::DRAG_NONE;
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h
index 631000d..ad8c8568 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone.h
@@ -77,7 +77,7 @@
aura::Window* source_window,
const gfx::Point& root_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
void AddObserver(aura::client::DragDropClientObserver* observer) override;
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone_unittest.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone_unittest.cc
index cfc7236c..a23b5cb 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_ozone_unittest.cc
@@ -12,6 +12,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/platform_window/platform_window.h"
#include "ui/platform_window/platform_window_handler/wm_drag_handler.h"
@@ -212,7 +213,7 @@
return client_->StartDragAndDrop(
std::move(data), widget_->GetNativeWindow()->GetRootWindow(),
widget_->GetNativeWindow(), gfx::Point(), operation,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::mojom::DragEventSource::kMouse);
}
// ViewsTestBase:
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
index e3bd6355..a4a9ebd9 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.cc
@@ -9,6 +9,7 @@
#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/dragdrop/drag_source_win.h"
#include "ui/base/dragdrop/drop_target_event.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data_provider_win.h"
#include "ui/base/win/event_creation_utils.h"
#include "ui/display/win/screen_win.h"
@@ -39,10 +40,10 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
drag_drop_in_progress_ = true;
drag_operation_ = operation;
- if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ if (source == ui::mojom::DragEventSource::kTouch) {
gfx::Point screen_point = display::win::ScreenWin::DIPToScreenPoint(
{screen_location.x(), screen_location.y()});
// Send a mouse down and mouse move before do drag drop runs its own event
@@ -66,7 +67,7 @@
ui::OSExchangeDataProviderWin::GetIDataObject(*data.get()),
drag_source_.Get(),
ui::DragDropTypes::DragOperationToDropEffect(operation), &effect);
- if (alive && source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) {
+ if (alive && source == ui::mojom::DragEventSource::kTouch) {
desktop_host_->SetInTouchDrag(false);
// Gesture state gets left in a state where you can't start
// another drag, unless it's cleaned up.
diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
index a55fe96..644de0c 100644
--- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
+++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_win.h
@@ -44,7 +44,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
void AddObserver(aura::client::DragDropClientObserver* observer) override;
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index fa9eeb3..48a9115 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -25,6 +25,7 @@
#include "ui/aura/window_occlusion_tracker.h"
#include "ui/aura/window_tree_host.h"
#include "ui/base/class_property.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
#include "ui/base/hit_test.h"
#include "ui/base/ime/input_method.h"
#include "ui/base/ui_base_features.h"
@@ -924,7 +925,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
views::RunShellDrag(content_window_, std::move(data), location, operation,
source);
}
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index 4e10aad..41a7b8af 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -177,7 +177,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void SchedulePaintInRect(const gfx::Rect& rect) override;
void ScheduleLayout() override;
void SetCursor(gfx::NativeCursor cursor) override;
diff --git a/ui/views/widget/desktop_aura/x11_drag_drop_client_unittest.cc b/ui/views/widget/desktop_aura/x11_drag_drop_client_unittest.cc
index 7beb018d7..882fc751 100644
--- a/ui/views/widget/desktop_aura/x11_drag_drop_client_unittest.cc
+++ b/ui/views/widget/desktop_aura/x11_drag_drop_client_unittest.cc
@@ -22,6 +22,7 @@
#include "ui/aura/test/test_screen.h"
#include "ui/aura/window.h"
#include "ui/aura/window_tree_host.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/base/x/x11_cursor.h"
#include "ui/base/x/x11_move_loop.h"
@@ -121,7 +122,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void DragCancel() override;
bool IsDragDropInProgress() override;
void AddObserver(aura::client::DragDropClientObserver* observer) override;
@@ -312,7 +313,7 @@
aura::Window* source_window,
const gfx::Point& screen_location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
InitDrag(operation, data.get());
auto loop = CreateMoveLoop(this);
@@ -478,7 +479,7 @@
return client_->StartDragAndDrop(
std::move(data), widget_->GetNativeWindow()->GetRootWindow(),
widget_->GetNativeWindow(), gfx::Point(), ui::DragDropTypes::DRAG_COPY,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE);
+ ui::mojom::DragEventSource::kMouse);
}
// ViewsTestBase:
diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc
index fa0d7ec..a5dedf7 100644
--- a/ui/views/widget/native_widget_aura.cc
+++ b/ui/views/widget/native_widget_aura.cc
@@ -700,7 +700,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
if (window_)
views::RunShellDrag(window_, std::move(data), location, operation, source);
}
diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h
index 2eba4ccf..d70aa0a 100644
--- a/ui/views/widget/native_widget_aura.h
+++ b/ui/views/widget/native_widget_aura.h
@@ -137,7 +137,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void SchedulePaintInRect(const gfx::Rect& rect) override;
void ScheduleLayout() override;
void SetCursor(gfx::NativeCursor cursor) override;
diff --git a/ui/views/widget/native_widget_mac.h b/ui/views/widget/native_widget_mac.h
index 0fbd95a..227123b 100644
--- a/ui/views/widget/native_widget_mac.h
+++ b/ui/views/widget/native_widget_mac.h
@@ -162,7 +162,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) override;
+ ui::mojom::DragEventSource source) override;
void SchedulePaintInRect(const gfx::Rect& rect) override;
void ScheduleLayout() override;
void SetCursor(gfx::NativeCursor cursor) override;
diff --git a/ui/views/widget/native_widget_mac.mm b/ui/views/widget/native_widget_mac.mm
index c3e62ff..4b1cf53 100644
--- a/ui/views/widget/native_widget_mac.mm
+++ b/ui/views/widget/native_widget_mac.mm
@@ -676,7 +676,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
ns_window_host_->drag_drop_client()->StartDragAndDrop(view, std::move(data),
operation, source);
}
diff --git a/ui/views/widget/native_widget_private.h b/ui/views/widget/native_widget_private.h
index ba3c722..73539269 100644
--- a/ui/views/widget/native_widget_private.h
+++ b/ui/views/widget/native_widget_private.h
@@ -9,6 +9,7 @@
#include <string>
#include "base/strings/string16.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/ui_base_types.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/widget/native_widget.h"
@@ -206,7 +207,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) = 0;
+ ui::mojom::DragEventSource source) = 0;
virtual void SchedulePaintInRect(const gfx::Rect& rect) = 0;
virtual void ScheduleLayout() = 0;
virtual void SetCursor(gfx::NativeCursor cursor) = 0;
diff --git a/ui/views/widget/root_view.cc b/ui/views/widget/root_view.cc
index fd8d126..01224fe 100644
--- a/ui/views/widget/root_view.cc
+++ b/ui/views/widget/root_view.cc
@@ -13,7 +13,7 @@
#include "ui/accessibility/ax_enums.mojom.h"
#include "ui/accessibility/ax_node_data.h"
#include "ui/base/cursor/cursor.h"
-#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-shared.h"
#include "ui/base/ui_base_switches_util.h"
#include "ui/compositor/layer.h"
#include "ui/events/event.h"
@@ -149,7 +149,7 @@
target->drag_controller()->CanStartDragForView(target, location,
location))) {
if (target->DoDrag(*event, location,
- ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH)) {
+ ui::mojom::DragEventSource::kTouch)) {
event->StopPropagation();
return;
}
diff --git a/ui/views/widget/widget.cc b/ui/views/widget/widget.cc
index ff906de..f025085 100644
--- a/ui/views/widget/widget.cc
+++ b/ui/views/widget/widget.cc
@@ -798,7 +798,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source) {
+ ui::mojom::DragEventSource source) {
dragged_view_ = view;
OnDragWillStart();
diff --git a/ui/views/widget/widget.h b/ui/views/widget/widget.h
index ef79785..032f77d 100644
--- a/ui/views/widget/widget.h
+++ b/ui/views/widget/widget.h
@@ -16,6 +16,7 @@
#include "base/optional.h"
#include "base/scoped_observer.h"
#include "build/build_config.h"
+#include "ui/base/dragdrop/mojom/drag_drop_types.mojom-forward.h"
#include "ui/base/ui_base_types.h"
#include "ui/events/event_source.h"
#include "ui/gfx/geometry/rect.h"
@@ -717,7 +718,7 @@
std::unique_ptr<ui::OSExchangeData> data,
const gfx::Point& location,
int operation,
- ui::DragDropTypes::DragEventSource source);
+ ui::mojom::DragEventSource source);
// Returns the view that requested the current drag operation via
// RunShellDrag(), or NULL if there is no such view or drag operation.