Commit dd7c59f4 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

RemoteMacViews: Break views dependencies of DragDropClientMac

DragDropClientMac is one of the few remaining structures that Cocoa
and Views code depends on. Break this dependency cycle, so that we can
move all Cocoa code to ui/views_brige_mac.
* Separate out the interface that Cocoa depends on and move it to
  views_bridge_mac::DragDropClient.
* Make views::DragDropClientMac be a member of the browser side
  structure views::BridgedNativeWidgetHostImpl

Note that this does not solve the problem that drag drop behavior is
not implemented over mojo. When using RemoteMacViews, drag drop
functionality will still be absent.

Bug: 859152
Change-Id: I3d5b8a3b8ae9403effd17436e727ba4298bcae61
Reviewed-on: https://chromium-review.googlesource.com/1244720Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: ccameron <ccameron@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594144}
parent e5087536
...@@ -40,6 +40,10 @@ class Bridge : public BridgedNativeWidgetHostHelper { ...@@ -40,6 +40,10 @@ class Bridge : public BridgedNativeWidgetHostHelper {
*found_word = false; *found_word = false;
} }
double SheetPositionY() override { return 0; } double SheetPositionY() override { return 0; }
views_bridge_mac::DragDropClient* GetDragDropClient() override {
// Drag-drop only doesn't work across mojo yet.
return nullptr;
}
mojom::BridgedNativeWidgetHostPtr host_ptr_; mojom::BridgedNativeWidgetHostPtr host_ptr_;
std::unique_ptr<BridgedNativeWidgetImpl> bridge_impl_; std::unique_ptr<BridgedNativeWidgetImpl> bridge_impl_;
......
...@@ -252,7 +252,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -252,7 +252,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
- (void)insertTextInternal:(id)text; - (void)insertTextInternal:(id)text;
// Returns the native Widget's drag drop client. Possibly null. // Returns the native Widget's drag drop client. Possibly null.
- (views::DragDropClientMac*)dragDropClient; - (views_bridge_mac::DragDropClient*)dragDropClient;
// Menu action handlers. // Menu action handlers.
- (void)undo:(id)sender; - (void)undo:(id)sender;
...@@ -621,7 +621,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -621,7 +621,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
} }
} }
- (views::DragDropClientMac*)dragDropClient { - (views_bridge_mac::DragDropClient*)dragDropClient {
return bridge_ ? bridge_->drag_drop_client() : nullptr; return bridge_ ? bridge_->drag_drop_client() : nullptr;
} }
...@@ -769,18 +769,18 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -769,18 +769,18 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
} }
- (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender { - (NSDragOperation)draggingUpdated:(id<NSDraggingInfo>)sender {
views::DragDropClientMac* client = [self dragDropClient]; views_bridge_mac::DragDropClient* client = [self dragDropClient];
return client ? client->DragUpdate(sender) : ui::DragDropTypes::DRAG_NONE; return client ? client->DragUpdate(sender) : ui::DragDropTypes::DRAG_NONE;
} }
- (void)draggingExited:(id<NSDraggingInfo>)sender { - (void)draggingExited:(id<NSDraggingInfo>)sender {
views::DragDropClientMac* client = [self dragDropClient]; views_bridge_mac::DragDropClient* client = [self dragDropClient];
if (client) if (client)
client->DragExit(); client->DragExit();
} }
- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { - (BOOL)performDragOperation:(id<NSDraggingInfo>)sender {
views::DragDropClientMac* client = [self dragDropClient]; views_bridge_mac::DragDropClient* client = [self dragDropClient];
return client && client->Drop(sender) != NSDragOperationNone; return client && client->Drop(sender) != NSDragOperationNone;
} }
...@@ -1541,7 +1541,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) { ...@@ -1541,7 +1541,7 @@ ui::TextEditCommand GetTextEditCommandForMenuAction(SEL action) {
- (void)draggingSession:(NSDraggingSession*)session - (void)draggingSession:(NSDraggingSession*)session
endedAtPoint:(NSPoint)screenPoint endedAtPoint:(NSPoint)screenPoint
operation:(NSDragOperation)operation { operation:(NSDragOperation)operation {
views::DragDropClientMac* client = [self dragDropClient]; views_bridge_mac::DragDropClient* client = [self dragDropClient];
if (client) if (client)
client->EndDrag(); client->EndDrag();
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "ui/base/ime/text_input_client.h" #include "ui/base/ime/text_input_client.h"
#include "ui/display/display_observer.h" #include "ui/display/display_observer.h"
#import "ui/views/cocoa/bridged_native_widget_owner.h" #import "ui/views/cocoa/bridged_native_widget_owner.h"
#import "ui/views/focus/focus_manager.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#import "ui/views_bridge_mac/cocoa_mouse_capture_delegate.h" #import "ui/views_bridge_mac/cocoa_mouse_capture_delegate.h"
...@@ -36,8 +35,9 @@ namespace mojom { ...@@ -36,8 +35,9 @@ namespace mojom {
class BridgedNativeWidgetHost; class BridgedNativeWidgetHost;
} // namespace mojom } // namespace mojom
class CocoaMouseCapture;
class BridgedNativeWidgetHostHelper; class BridgedNativeWidgetHostHelper;
class CocoaMouseCapture;
class DragDropClient;
} // namespace views_bridge_mac } // namespace views_bridge_mac
...@@ -47,8 +47,6 @@ class BridgedNativeWidgetTestApi; ...@@ -47,8 +47,6 @@ class BridgedNativeWidgetTestApi;
} }
class CocoaWindowMoveLoop; class CocoaWindowMoveLoop;
class DragDropClientMac;
class View;
using views_bridge_mac::mojom::BridgedNativeWidgetHost; using views_bridge_mac::mojom::BridgedNativeWidgetHost;
using views_bridge_mac::BridgedNativeWidgetHostHelper; using views_bridge_mac::BridgedNativeWidgetHostHelper;
...@@ -94,12 +92,6 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl ...@@ -94,12 +92,6 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl
// this way. // this way.
void SetWindow(base::scoped_nsobject<NativeWidgetMacNSWindow> window); void SetWindow(base::scoped_nsobject<NativeWidgetMacNSWindow> window);
// Create the drag drop client for this widget.
// TODO(ccameron): This function takes a views::View (and is not rolled into
// CreateContentView) because drag-drop has not been routed through |host_|
// yet.
void CreateDragDropClient(views::View* view);
// Set the parent NSView for the widget. // Set the parent NSView for the widget.
// TODO(ccameron): Like SetWindow, this will need to pass a handle instead of // TODO(ccameron): Like SetWindow, this will need to pass a handle instead of
// an NSView across processes. // an NSView across processes.
...@@ -170,7 +162,7 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl ...@@ -170,7 +162,7 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl
BridgedNativeWidgetHostHelper* host_helper() { return host_helper_; } BridgedNativeWidgetHostHelper* host_helper() { return host_helper_; }
NSWindow* ns_window(); NSWindow* ns_window();
DragDropClientMac* drag_drop_client() { return drag_drop_client_.get(); } views_bridge_mac::DragDropClient* drag_drop_client();
bool is_translucent_window() const { return is_translucent_window_; } bool is_translucent_window() const { return is_translucent_window_; }
// The parent widget specified in Widget::InitParams::parent. If non-null, the // The parent widget specified in Widget::InitParams::parent. If non-null, the
...@@ -304,7 +296,6 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl ...@@ -304,7 +296,6 @@ class VIEWS_EXPORT BridgedNativeWidgetImpl
base::scoped_nsobject<ModalShowAnimationWithLayer> show_animation_; base::scoped_nsobject<ModalShowAnimationWithLayer> show_animation_;
std::unique_ptr<CocoaMouseCapture> mouse_capture_; std::unique_ptr<CocoaMouseCapture> mouse_capture_;
std::unique_ptr<CocoaWindowMoveLoop> window_move_loop_; std::unique_ptr<CocoaWindowMoveLoop> window_move_loop_;
std::unique_ptr<DragDropClientMac> drag_drop_client_;
ui::ModalType modal_type_ = ui::MODAL_TYPE_NONE; ui::ModalType modal_type_ = ui::MODAL_TYPE_NONE;
bool is_translucent_window_ = false; bool is_translucent_window_ = false;
bool widget_is_top_level_ = false; bool widget_is_top_level_ = false;
......
...@@ -456,7 +456,6 @@ void BridgedNativeWidgetImpl::SetBounds(const gfx::Rect& new_bounds, ...@@ -456,7 +456,6 @@ void BridgedNativeWidgetImpl::SetBounds(const gfx::Rect& new_bounds,
void BridgedNativeWidgetImpl::DestroyContentView() { void BridgedNativeWidgetImpl::DestroyContentView() {
if (!bridged_view_) if (!bridged_view_)
return; return;
drag_drop_client_.reset();
[bridged_view_ clearView]; [bridged_view_ clearView];
bridged_view_.reset(); bridged_view_.reset();
[window_ setContentView:nil]; [window_ setContentView:nil];
...@@ -481,10 +480,6 @@ void BridgedNativeWidgetImpl::CreateContentView(const gfx::Rect& bounds) { ...@@ -481,10 +480,6 @@ void BridgedNativeWidgetImpl::CreateContentView(const gfx::Rect& bounds) {
[window_ setContentView:bridged_view_]; [window_ setContentView:bridged_view_];
} }
void BridgedNativeWidgetImpl::CreateDragDropClient(View* view) {
drag_drop_client_.reset(new DragDropClientMac(this, view));
}
void BridgedNativeWidgetImpl::CloseWindow() { void BridgedNativeWidgetImpl::CloseWindow() {
// Keep |window| on the stack so that the ObjectiveC block below can capture // Keep |window| on the stack so that the ObjectiveC block below can capture
// it and properly increment the reference count bound to the posted task. // it and properly increment the reference count bound to the posted task.
...@@ -1005,6 +1000,10 @@ NSWindow* BridgedNativeWidgetImpl::ns_window() { ...@@ -1005,6 +1000,10 @@ NSWindow* BridgedNativeWidgetImpl::ns_window() {
return window_.get(); return window_.get();
} }
views_bridge_mac::DragDropClient* BridgedNativeWidgetImpl::drag_drop_client() {
return host_helper_->GetDragDropClient();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BridgedNativeWidgetImpl, ui::CATransactionObserver // BridgedNativeWidgetImpl, ui::CATransactionObserver
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "ui/base/ime/input_method_delegate.h" #include "ui/base/ime/input_method_delegate.h"
#include "ui/compositor/layer_owner.h" #include "ui/compositor/layer_owner.h"
#include "ui/views/cocoa/bridge_factory_host.h" #include "ui/views/cocoa/bridge_factory_host.h"
#include "ui/views/cocoa/drag_drop_client_mac.h"
#include "ui/views/focus/focus_manager.h" #include "ui/views/focus/focus_manager.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -92,6 +93,10 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl ...@@ -92,6 +93,10 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl
TooltipManager* tooltip_manager() { return tooltip_manager_.get(); } TooltipManager* tooltip_manager() { return tooltip_manager_.get(); }
DragDropClientMac* drag_drop_client() const {
return drag_drop_client_.get();
}
// Create and set the bridge object to be in this process. // Create and set the bridge object to be in this process.
void CreateLocalBridge(base::scoped_nsobject<NativeWidgetMacNSWindow> window, void CreateLocalBridge(base::scoped_nsobject<NativeWidgetMacNSWindow> window,
NSView* parent); NSView* parent);
...@@ -190,6 +195,7 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl ...@@ -190,6 +195,7 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl
gfx::DecoratedText* decorated_word, gfx::DecoratedText* decorated_word,
gfx::Point* baseline_point) override; gfx::Point* baseline_point) override;
double SheetPositionY() override; double SheetPositionY() override;
views_bridge_mac::DragDropClient* GetDragDropClient() override;
// BridgeFactoryHost::Observer: // BridgeFactoryHost::Observer:
void OnBridgeFactoryHostDestroying(BridgeFactoryHost* host) override; void OnBridgeFactoryHostDestroying(BridgeFactoryHost* host) override;
...@@ -293,6 +299,7 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl ...@@ -293,6 +299,7 @@ class VIEWS_EXPORT BridgedNativeWidgetHostImpl
Widget::InitParams::Type widget_type_ = Widget::InitParams::TYPE_WINDOW; Widget::InitParams::Type widget_type_ = Widget::InitParams::TYPE_WINDOW;
views::View* root_view_ = nullptr; // Weak. Owned by |native_widget_mac_|. views::View* root_view_ = nullptr; // Weak. Owned by |native_widget_mac_|.
std::unique_ptr<DragDropClientMac> drag_drop_client_;
// The mojo pointer to a BridgedNativeWidget, which may exist in another // The mojo pointer to a BridgedNativeWidget, which may exist in another
// process. // process.
......
...@@ -249,6 +249,15 @@ void BridgedNativeWidgetHostImpl::SetFullscreen(bool fullscreen) { ...@@ -249,6 +249,15 @@ void BridgedNativeWidgetHostImpl::SetFullscreen(bool fullscreen) {
void BridgedNativeWidgetHostImpl::SetRootView(views::View* root_view) { void BridgedNativeWidgetHostImpl::SetRootView(views::View* root_view) {
root_view_ = root_view; root_view_ = root_view;
if (root_view_) {
// TODO(ccameron): Drag-drop functionality does not yet run over mojo.
if (bridge_impl_) {
drag_drop_client_.reset(
new DragDropClientMac(bridge_impl_.get(), root_view_));
}
} else {
drag_drop_client_.reset();
}
} }
void BridgedNativeWidgetHostImpl::CreateCompositor( void BridgedNativeWidgetHostImpl::CreateCompositor(
...@@ -455,6 +464,11 @@ double BridgedNativeWidgetHostImpl::SheetPositionY() { ...@@ -455,6 +464,11 @@ double BridgedNativeWidgetHostImpl::SheetPositionY() {
return native_widget_mac_->SheetPositionY(); return native_widget_mac_->SheetPositionY();
} }
views_bridge_mac::DragDropClient*
BridgedNativeWidgetHostImpl::GetDragDropClient() {
return drag_drop_client_.get();
}
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// BridgedNativeWidgetHostImpl, BridgeFactoryHost::Observer: // BridgedNativeWidgetHostImpl, BridgeFactoryHost::Observer:
void BridgedNativeWidgetHostImpl::OnBridgeFactoryHostDestroying( void BridgedNativeWidgetHostImpl::OnBridgeFactoryHostDestroying(
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "ui/base/dragdrop/os_exchange_data.h" #include "ui/base/dragdrop/os_exchange_data.h"
#include "ui/views/views_export.h" #include "ui/views/views_export.h"
#include "ui/views/widget/drop_helper.h" #include "ui/views/widget/drop_helper.h"
#include "ui/views_bridge_mac/drag_drop_client.h"
// This class acts as a bridge between NSPasteboardItem and OSExchangeData by // This class acts as a bridge between NSPasteboardItem and OSExchangeData by
// implementing NSPasteboardItemDataProvider and writing data from // implementing NSPasteboardItemDataProvider and writing data from
...@@ -38,10 +39,10 @@ class View; ...@@ -38,10 +39,10 @@ class View;
// Implements drag and drop on MacViews. This class acts as a bridge between // Implements drag and drop on MacViews. This class acts as a bridge between
// the Views and native system's drag and drop. This class mimics // the Views and native system's drag and drop. This class mimics
// DesktopDragDropClientAuraX11. // DesktopDragDropClientAuraX11.
class VIEWS_EXPORT DragDropClientMac { class VIEWS_EXPORT DragDropClientMac : public views_bridge_mac::DragDropClient {
public: public:
DragDropClientMac(BridgedNativeWidgetImpl* bridge, View* root_view); DragDropClientMac(BridgedNativeWidgetImpl* bridge, View* root_view);
~DragDropClientMac(); ~DragDropClientMac() override;
// Initiates a drag and drop session. Returns the drag operation that was // Initiates a drag and drop session. Returns the drag operation that was
// applied at the end of the drag drop session. // applied at the end of the drag drop session.
...@@ -50,20 +51,14 @@ class VIEWS_EXPORT DragDropClientMac { ...@@ -50,20 +51,14 @@ class VIEWS_EXPORT DragDropClientMac {
int operation, int operation,
ui::DragDropTypes::DragEventSource source); ui::DragDropTypes::DragEventSource source);
// Called when mouse is dragged during a drag and drop.
NSDragOperation DragUpdate(id<NSDraggingInfo>);
// Called when mouse is released during a drag and drop.
NSDragOperation Drop(id<NSDraggingInfo> sender);
// Called when the drag and drop session has ended.
void EndDrag();
// Called when mouse leaves the drop area.
void DragExit();
DropHelper* drop_helper() { return &drop_helper_; } DropHelper* drop_helper() { return &drop_helper_; }
// views_bridge_mac::DragDropClient:
NSDragOperation DragUpdate(id<NSDraggingInfo>) override;
NSDragOperation Drop(id<NSDraggingInfo> sender) override;
void EndDrag() override;
void DragExit() override;
private: private:
friend class test::DragDropClientMacTest; friend class test::DragDropClientMacTest;
......
...@@ -156,7 +156,9 @@ class DragDropClientMacTest : public WidgetTest { ...@@ -156,7 +156,9 @@ class DragDropClientMacTest : public WidgetTest {
public: public:
DragDropClientMacTest() : widget_(new Widget) {} DragDropClientMacTest() : widget_(new Widget) {}
DragDropClientMac* drag_drop_client() { return bridge_->drag_drop_client(); } DragDropClientMac* drag_drop_client() {
return bridge_host_->drag_drop_client();
}
NSDragOperation DragUpdate(NSPasteboard* pasteboard) { NSDragOperation DragUpdate(NSPasteboard* pasteboard) {
DragDropClientMac* client = drag_drop_client(); DragDropClientMac* client = drag_drop_client();
......
...@@ -145,8 +145,6 @@ void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) { ...@@ -145,8 +145,6 @@ void NativeWidgetMac::InitNativeWidget(const Widget::InitParams& params) {
DCHECK(GetWidget()->GetRootView()); DCHECK(GetWidget()->GetRootView());
bridge_host_->SetRootView(GetWidget()->GetRootView()); bridge_host_->SetRootView(GetWidget()->GetRootView());
bridge()->CreateContentView(GetWidget()->GetRootView()->bounds()); bridge()->CreateContentView(GetWidget()->GetRootView()->bounds());
if (bridge_impl())
bridge_impl()->CreateDragDropClient(GetWidget()->GetRootView());
if (auto* focus_manager = GetWidget()->GetFocusManager()) { if (auto* focus_manager = GetWidget()->GetFocusManager()) {
bridge()->MakeFirstResponder(); bridge()->MakeFirstResponder();
bridge_host_->SetFocusManager(focus_manager); bridge_host_->SetFocusManager(focus_manager);
...@@ -220,7 +218,7 @@ void NativeWidgetMac::ReorderNativeViews() { ...@@ -220,7 +218,7 @@ void NativeWidgetMac::ReorderNativeViews() {
void NativeWidgetMac::ViewRemoved(View* view) { void NativeWidgetMac::ViewRemoved(View* view) {
DragDropClientMac* client = DragDropClientMac* client =
bridge_impl() ? bridge_impl()->drag_drop_client() : nullptr; bridge_host_ ? bridge_host_->drag_drop_client() : nullptr;
if (client) if (client)
client->drop_helper()->ResetTargetViewIfEquals(view); client->drop_helper()->ResetTargetViewIfEquals(view);
} }
...@@ -513,8 +511,8 @@ void NativeWidgetMac::RunShellDrag(View* view, ...@@ -513,8 +511,8 @@ void NativeWidgetMac::RunShellDrag(View* view,
const gfx::Point& location, const gfx::Point& location,
int operation, int operation,
ui::DragDropTypes::DragEventSource source) { ui::DragDropTypes::DragEventSource source) {
bridge_impl()->drag_drop_client()->StartDragAndDrop(view, data, operation, bridge_host_->drag_drop_client()->StartDragAndDrop(view, data, operation,
source); source);
} }
void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) { void NativeWidgetMac::SchedulePaintInRect(const gfx::Rect& rect) {
......
...@@ -12,6 +12,7 @@ component("views_bridge_mac") { ...@@ -12,6 +12,7 @@ component("views_bridge_mac") {
"cocoa_mouse_capture.h", "cocoa_mouse_capture.h",
"cocoa_mouse_capture.mm", "cocoa_mouse_capture.mm",
"cocoa_mouse_capture_delegate.h", "cocoa_mouse_capture_delegate.h",
"drag_drop_client.h",
"views_bridge_mac_export.h", "views_bridge_mac_export.h",
] ]
defines = [ "VIEWS_BRIDGE_MAC_IMPLEMENTATION" ] defines = [ "VIEWS_BRIDGE_MAC_IMPLEMENTATION" ]
......
...@@ -15,6 +15,8 @@ ...@@ -15,6 +15,8 @@
namespace views_bridge_mac { namespace views_bridge_mac {
class DragDropClient;
// This is a helper class for the mojo interface BridgedNativeWidgetHost. // This is a helper class for the mojo interface BridgedNativeWidgetHost.
// This provides an easier-to-use interface than the mojo for selected // This provides an easier-to-use interface than the mojo for selected
// functions. It also is temporarily exposing functionality that is not yet // functions. It also is temporarily exposing functionality that is not yet
...@@ -54,6 +56,10 @@ class VIEWS_BRIDGE_MAC_EXPORT BridgedNativeWidgetHostHelper { ...@@ -54,6 +56,10 @@ class VIEWS_BRIDGE_MAC_EXPORT BridgedNativeWidgetHostHelper {
// TODO(ccameron): This should be either moved to the mojo interface or // TODO(ccameron): This should be either moved to the mojo interface or
// separated out in such a way as to avoid needing to go through mojo. // separated out in such a way as to avoid needing to go through mojo.
virtual double SheetPositionY() = 0; virtual double SheetPositionY() = 0;
// Return a pointer to host's DragDropClientMac.
// TODO(ccameron): Drag-drop behavior needs to be implemented over mojo.
virtual DragDropClient* GetDragDropClient() = 0;
}; };
} // namespace views_bridge_mac } // namespace views_bridge_mac
......
// Copyright 2018 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_BRIDGE_MAC_DRAG_DROP_CLIENT_H_
#define UI_VIEWS_BRIDGE_MAC_DRAG_DROP_CLIENT_H_
#import <Cocoa/Cocoa.h>
#include "ui/views_bridge_mac/views_bridge_mac_export.h"
namespace views_bridge_mac {
// Interface between the content view of a BridgedNativeWidgetImpl and a
// DragDropClientMac in the browser process. This interface should eventually
// become mojo-ified, but at the moment only passes raw pointers (consequently,
// drag-drop behavior does not work in RemoteMacViews).
class VIEWS_BRIDGE_MAC_EXPORT DragDropClient {
public:
virtual ~DragDropClient() {}
// Called when mouse is dragged during a drag and drop.
virtual NSDragOperation DragUpdate(id<NSDraggingInfo>) = 0;
// Called when mouse is released during a drag and drop.
virtual NSDragOperation Drop(id<NSDraggingInfo> sender) = 0;
// Called when the drag and drop session has ended.
virtual void EndDrag() = 0;
// Called when mouse leaves the drop area.
virtual void DragExit() = 0;
};
} // namespace views_bridge_mac
#endif // UI_VIEWS_BRIDGE_MAC_DRAG_DROP_CLIENT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment