Chromium Code Reviews| Index: ui/views/cocoa/bridged_content_view.mm |
| diff --git a/ui/views/cocoa/bridged_content_view.mm b/ui/views/cocoa/bridged_content_view.mm |
| index c269729cc2e73633e333f5df86dbb614518c3f0a..44709c7c4b612b1c2ee7d1be1198dc703837f387 100644 |
| --- a/ui/views/cocoa/bridged_content_view.mm |
| +++ b/ui/views/cocoa/bridged_content_view.mm |
| @@ -10,6 +10,7 @@ |
| #include "base/strings/sys_string_conversions.h" |
| #include "skia/ext/skia_utils_mac.h" |
| #include "ui/base/cocoa/cocoa_base_utils.h" |
| +#include "ui/base/dragdrop/os_exchange_data_provider_mac.h" |
| #include "ui/base/ime/input_method.h" |
| #include "ui/base/ime/text_input_client.h" |
| #include "ui/compositor/canvas_painter.h" |
| @@ -23,9 +24,12 @@ |
| #import "ui/gfx/path_mac.h" |
| #include "ui/gfx/scoped_ns_graphics_context_save_gstate_mac.h" |
| #include "ui/strings/grit/ui_strings.h" |
| +#import "ui/views/cocoa/bridged_native_widget.h" |
| +#include "ui/views/cocoa/drag_drop_client_mac.h" |
| #include "ui/views/controls/menu/menu_config.h" |
| #include "ui/views/controls/menu/menu_controller.h" |
| #include "ui/views/view.h" |
| +#include "ui/views/widget/native_widget_mac.h" |
| #include "ui/views/widget/widget.h" |
| using views::MenuController; |
| @@ -191,6 +195,8 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client, |
| // Notification handler invoked when the Full Keyboard Access mode is changed. |
| - (void)onFullKeyboardAccessModeChanged:(NSNotification*)notification; |
| +- (views::DragDropClientMac*)dragDropClient; |
| + |
| // Menu action handlers. |
| - (void)undo:(id)sender; |
| - (void)redo:(id)sender; |
| @@ -239,6 +245,10 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client, |
| // setting. |
| [self updateFullKeyboardAccess]; |
| } |
| + |
| + [self registerForDraggedTypes:ui::OSExchangeDataProviderMac:: |
| + SupportedPasteboardTypes()]; |
| + |
| return self; |
| } |
| @@ -270,6 +280,22 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client, |
| hostedView_->GetWidget()->OnMouseEvent(&event); |
| } |
| +- (NSDragOperation)draggingEntered:(id<NSDraggingInfo>)sender { |
| + return [self dragDropClient]->DragUpdate(sender); |
|
tapted
2016/05/24 08:06:01
[self dragDropClient] needs to return null under s
spqchan
2016/05/26 01:56:53
Done.
|
| +} |
| + |
| +- (NSDragOperation)draggingUpdated:(id)sender { |
| + return [self dragDropClient]->DragUpdate(sender); |
| +} |
| + |
| +- (void)draggingEnded:(id)sender { |
| + [self dragDropClient]->EndDrag(); |
| +} |
| + |
| +- (BOOL)performDragOperation:(id<NSDraggingInfo>)sender { |
| + return [self dragDropClient]->Drop(sender) != NSDragOperationNone; |
| +} |
| + |
| - (void)updateTooltipIfRequiredAt:(const gfx::Point&)locationInContent { |
| DCHECK(hostedView_); |
| base::string16 newTooltipText; |
| @@ -362,6 +388,11 @@ gfx::Rect GetFirstRectForRangeHelper(const ui::TextInputClient* client, |
| [self updateFullKeyboardAccess]; |
| } |
| +- (views::DragDropClientMac*)dragDropClient { |
| + return views::NativeWidgetMac::GetBridgeForNativeWindow([self window]) |
|
tapted
2016/05/24 08:06:00
GetBridgeForNativeWindow can return null. Annoying
spqchan
2016/05/26 01:56:53
Done.
|
| + ->drag_drop_client(); |
| +} |
| + |
| - (void)undo:(id)sender { |
| // This DCHECK is more strict than a similar check in handleAction:. It can be |
| // done here because the actors sending these actions should be calling |