drag_drop_types_mac.mm 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2016 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/base/dragdrop/drag_drop_types.h"
  5. #import <AppKit/AppKit.h>
  6. namespace ui {
  7. uint64_t DragDropTypes::DragOperationToNSDragOperation(int drag_operation) {
  8. NSUInteger ns_drag_operation = NSDragOperationNone;
  9. if (drag_operation & DRAG_LINK)
  10. ns_drag_operation |= NSDragOperationLink;
  11. if (drag_operation & DRAG_COPY)
  12. ns_drag_operation |= NSDragOperationCopy;
  13. if (drag_operation & DRAG_MOVE)
  14. ns_drag_operation |= NSDragOperationMove;
  15. return ns_drag_operation;
  16. }
  17. int DragDropTypes::NSDragOperationToDragOperation(uint64_t ns_drag_operation) {
  18. NSUInteger drag_operation = DRAG_NONE;
  19. if (ns_drag_operation & NSDragOperationLink)
  20. drag_operation |= DRAG_LINK;
  21. if (ns_drag_operation & NSDragOperationCopy)
  22. drag_operation |= DRAG_COPY;
  23. if (ns_drag_operation & NSDragOperationMove)
  24. drag_operation |= DRAG_MOVE;
  25. return drag_operation;
  26. }
  27. } // namespace ui