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

Unified Diff: ui/views/cocoa/drag_drop_client_mac.h

Issue 1964283002: MacViews: Implemented Drag & Drop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forgot to add the test Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/views/cocoa/drag_drop_client_mac.h
diff --git a/ui/views/cocoa/drag_drop_client_mac.h b/ui/views/cocoa/drag_drop_client_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..cbdcc0eb5469f9972f2df9b8fce723e4b8a92ece
--- /dev/null
+++ b/ui/views/cocoa/drag_drop_client_mac.h
@@ -0,0 +1,90 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_VIEWS_COCOA_COCOA_DRAG_DROP_MANAGER_H_
tapted 2016/05/24 08:06:02 update guard
spqchan 2016/05/26 01:56:54 Done.
+#define UI_VIEWS_COCOA_COCOA_DRAG_DROP_MANAGER_H_
+
+#import <Cocoa/Cocoa.h>
+
+#include <memory>
+#include <vector>
+
+#import "base/mac/scoped_nsobject.h"
+#include "base/macros.h"
+#include "ui/base/dragdrop/drag_drop_types.h"
+#include "ui/views/views_export.h"
+#include "ui/views/widget/drop_helper.h"
+
+class DropHelper;
+
+@interface CocoaDragDropDataProvider : NSObject<NSPasteboardItemDataProvider>
tapted 2016/05/24 08:06:02 This needs to be VIEWS_EXPORT in order to link vie
spqchan 2016/05/26 01:56:54 Done.
+
+- (id)initWithData:(const ui::OSExchangeData&)data;
+
+@end
+
+namespace gfx {
+class Point;
+} // namespace gfx
tapted 2016/05/24 08:06:02 nit: we don't usually bother with comments on name
spqchan 2016/05/26 01:56:54 Done.
+
+namespace ui {
+class OSExchangeData;
+} // namespace ui
+
+namespace views {
+namespace test {
+class CocoaDragDropTest;
+}
+
+class BridgedNativeWidget;
+
+class VIEWS_EXPORT DragDropClientMac {
tapted 2016/05/24 08:06:02 nit: needs a comment (it's probably worth mentioni
spqchan 2016/05/26 01:56:54 Done.
+ public:
+ explicit DragDropClientMac(BridgedNativeWidget* view);
+ ~DragDropClientMac();
+
+ // Initiates a drag and drop session. Returns the drag operation that was
+ // applied at the end of the drag drop session.
+ void StartDragAndDrop(const ui::OSExchangeData& data,
+ const gfx::Point& location,
+ int operation,
+ 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();
+
+ // Calls when the the views::View bridged by the content view is set or
+ // cleared.
+ void SetRootView(View* view);
+
+ private:
+ friend class test::CocoaDragDropTest;
+
+ // Converts the given NSPoint to the coordinate system in Views.
+ gfx::Point LocationInView(NSPoint point) const;
+
+ // Provides the data for the drag and drop session.
+ base::scoped_nsobject<CocoaDragDropDataProvider> data_source_;
+
+ // Used to handle drag and drop with Views.
+ std::unique_ptr<DropHelper> drop_helper_;
+
+ // The drag and drop operation.
+ int operation_;
tapted 2016/05/24 08:06:02 needs to be initialized
spqchan 2016/05/26 01:56:54 Done.
+
+ // The bridge between the content view and the drag drop client.
+ BridgedNativeWidget* bridge_;
tapted 2016/05/24 08:06:01 // Weak. Owns |this|.
spqchan 2016/05/26 01:56:54 Done.
+
+ DISALLOW_COPY_AND_ASSIGN(DragDropClientMac);
+};
+
+} // namespace views
+
+#endif // UI_VIEWS_COCOA_COCOA_DRAG_DROP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698