| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" | 9 #include "chrome/browser/bookmarks/bookmark_node_data.h" |
| 10 #include "ui/gfx/native_widget_types.h" | |
| 11 | 10 |
| 12 #if defined(__OBJC__) | 11 #if defined(__OBJC__) |
| 13 @class NSImage; | |
| 14 @class NSString; | 12 @class NSString; |
| 15 #else // __OBJC__ | |
| 16 class NSImage; | |
| 17 #endif // __OBJC__ | 13 #endif // __OBJC__ |
| 18 | 14 |
| 19 // This set of functions lets C++ code interact with the cocoa pasteboard | 15 // This set of functions lets C++ code interact with the cocoa pasteboard |
| 20 // and dragging methods. | 16 // and dragging methods. |
| 21 namespace bookmark_pasteboard_helper_mac { | 17 namespace bookmark_pasteboard_helper_mac { |
| 22 | 18 |
| 23 enum PasteboardType { | 19 enum PasteboardType { |
| 24 kCopyPastePasteboard, | 20 kCopyPastePasteboard, |
| 25 kDragPasteboard | 21 kDragPasteboard |
| 26 }; | 22 }; |
| 27 | 23 |
| 28 // Writes a set of bookmark elements from a profile to the specified pasteboard. | 24 // Writes a set of bookmark elements from a profile to the specified pasteboard. |
| 29 void WriteToPasteboard(PasteboardType type, | 25 void WriteToPasteboard(PasteboardType type, |
| 30 const std::vector<BookmarkNodeData::Element>& elements, | 26 const std::vector<BookmarkNodeData::Element>& elements, |
| 31 FilePath::StringType profile_path); | 27 FilePath::StringType profile_path); |
| 32 | 28 |
| 33 // Reads a set of bookmark elements from the specified pasteboard. | 29 // Reads a set of bookmark elements from the specified pasteboard. |
| 34 bool ReadFromPasteboard(PasteboardType type, | 30 bool ReadFromPasteboard(PasteboardType type, |
| 35 std::vector<BookmarkNodeData::Element>& elements, | 31 std::vector<BookmarkNodeData::Element>& elements, |
| 36 FilePath* profile_path); | 32 FilePath* profile_path); |
| 37 | 33 |
| 38 // Returns true if the specified pasteboard contains any sort of | 34 // Returns true if the specified pasteboard contains any sort of |
| 39 // bookmark elements. It currently does not consider a plaintext url a | 35 // bookmark elements. It currently does not consider a plaintext url a |
| 40 // valid bookmark. | 36 // valid bookmark. |
| 41 bool PasteboardContainsBookmarks(PasteboardType type); | 37 bool PasteboardContainsBookmarks(PasteboardType type); |
| 42 | 38 |
| 43 // Returns a drag image for a bookmark. | |
| 44 NSImage* DragImageForBookmark(NSImage* favicon, const string16& title); | |
| 45 | |
| 46 // Copies the bookmark nodes to the dragging pasteboard and initiates a | |
| 47 // drag from the specified view. |view| must be a |TabContentsViewCocoa*|. | |
| 48 void StartDrag(Profile* profile, const std::vector<const BookmarkNode*>& nodes, | |
| 49 gfx::NativeView view); | |
| 50 | |
| 51 } // namespace bookmark_pasteboard_helper_mac | 39 } // namespace bookmark_pasteboard_helper_mac |
| 52 | 40 |
| 53 #if defined(__OBJC__) | 41 #if defined(__OBJC__) |
| 54 // Pasteboard type for dictionary containing bookmark structure consisting | 42 // Pasteboard type for dictionary containing bookmark structure consisting |
| 55 // of individual bookmark nodes and/or bookmark folders. | 43 // of individual bookmark nodes and/or bookmark folders. |
| 56 extern "C" NSString* const kBookmarkDictionaryListPboardType; | 44 extern "C" NSString* const kBookmarkDictionaryListPboardType; |
| 57 #endif // __OBJC__ | 45 #endif // __OBJC__ |
| 58 | 46 |
| 59 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ | 47 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_PASTEBOARD_HELPER_MAC_H_ |
| OLD | NEW |