cocoa_dnd_util.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // Copyright (c) 2012 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. #ifndef UI_BASE_DRAGDROP_COCOA_DND_UTIL_H_
  5. #define UI_BASE_DRAGDROP_COCOA_DND_UTIL_H_
  6. #import <Cocoa/Cocoa.h>
  7. #include <string>
  8. #include <vector>
  9. #include "base/component_export.h"
  10. class GURL;
  11. namespace ui {
  12. // Dummy data type that Chrome places in dragging pasteboards. There is never
  13. // any data associated with this type; it's only used to ensure that Chrome
  14. // supports any drag initiated inside of Chrome, whether or not data has been
  15. // associated with it.
  16. COMPONENT_EXPORT(UI_BASE) extern NSString* const kChromeDragDummyPboardType;
  17. // Mail.app and TextEdit accept drags that have both HTML and image flavors on
  18. // them, but don't process them correctly <http://crbug.com/55879>. Therefore,
  19. // if there is an image flavor, don't put the HTML data on as HTML, but rather
  20. // put it on as this Chrome-only flavor. External apps won't see HTML but
  21. // Chrome will know enough to read it as HTML. <http://crbug.com/55879>
  22. COMPONENT_EXPORT(UI_BASE) extern NSString* const kChromeDragImageHTMLPboardType;
  23. // Populates the |url| and |title| with URL data in |pboard|. There may be more
  24. // than one, but we only handle dropping the first. |url| must not be |NULL|;
  25. // |title| is an optional parameter. Returns |YES| if URL data was obtained from
  26. // the pasteboard, |NO| otherwise. If |convert_filenames| is |YES|, the function
  27. // will also attempt to convert filenames in |pboard| to file URLs.
  28. COMPONENT_EXPORT(UI_BASE)
  29. BOOL PopulateURLAndTitleFromPasteboard(GURL* url,
  30. std::u16string* title,
  31. NSPasteboard* pboard,
  32. BOOL convert_filenames);
  33. } // namespace ui
  34. #endif // UI_BASE_DRAGDROP_COCOA_DND_UTIL_H_