| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_DRAG_DATA_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 BookmarkDragData() { } | 79 BookmarkDragData() { } |
| 80 | 80 |
| 81 #if defined(TOOLKIT_VIEWS) | 81 #if defined(TOOLKIT_VIEWS) |
| 82 static OSExchangeData::CustomFormat GetBookmarkCustomFormat(); | 82 static OSExchangeData::CustomFormat GetBookmarkCustomFormat(); |
| 83 #endif | 83 #endif |
| 84 | 84 |
| 85 // Created a BookmarkDragData populated from the arguments. | 85 // Created a BookmarkDragData populated from the arguments. |
| 86 explicit BookmarkDragData(const BookmarkNode* node); | 86 explicit BookmarkDragData(const BookmarkNode* node); |
| 87 explicit BookmarkDragData(const std::vector<const BookmarkNode*>& nodes); | 87 explicit BookmarkDragData(const std::vector<const BookmarkNode*>& nodes); |
| 88 | 88 |
| 89 // Reads bookmarks from the given vector. |
| 90 bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); |
| 91 |
| 89 // Writes elements to the clipboard. | 92 // Writes elements to the clipboard. |
| 90 void WriteToClipboard(Profile* profile) const; | 93 void WriteToClipboard(Profile* profile) const; |
| 91 | 94 |
| 92 // Reads bookmarks from the general copy/paste clipboard. Prefers data | 95 // Reads bookmarks from the general copy/paste clipboard. Prefers data |
| 93 // written via WriteToClipboard but will also attempt to read a plain bookmark
. | 96 // written via WriteToClipboard but will also attempt to read a plain bookmark
. |
| 94 bool ReadFromClipboard(); | 97 bool ReadFromClipboard(); |
| 95 #if defined(OS_MACOSX) | 98 #if defined(OS_MACOSX) |
| 96 // Reads bookmarks that are being dragged from the drag and drop | 99 // Reads bookmarks that are being dragged from the drag and drop |
| 97 // pasteboard. | 100 // pasteboard. |
| 98 bool ReadFromDragClipboard(); | 101 bool ReadFromDragClipboard(); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 | 134 |
| 132 // Returns true if there is a single url. | 135 // Returns true if there is a single url. |
| 133 bool has_single_url() const { return is_valid() && elements[0].is_url; } | 136 bool has_single_url() const { return is_valid() && elements[0].is_url; } |
| 134 | 137 |
| 135 // Number of elements. | 138 // Number of elements. |
| 136 size_t size() const { return elements.size(); } | 139 size_t size() const { return elements.size(); } |
| 137 | 140 |
| 138 // Clears the data. | 141 // Clears the data. |
| 139 void Clear(); | 142 void Clear(); |
| 140 | 143 |
| 144 // Sets |profile_path_| to that of |profile|. This is useful for the |
| 145 // constructors/readers that don't set it. This should only be called if the |
| 146 // profile path is not already set. |
| 147 void SetOriginatingProfile(Profile* profile); |
| 148 |
| 141 // Returns true if this data is from the specified profile. | 149 // Returns true if this data is from the specified profile. |
| 142 bool IsFromProfile(Profile* profile) const; | 150 bool IsFromProfile(Profile* profile) const; |
| 143 | 151 |
| 144 // The actual elements written to the clipboard. | 152 // The actual elements written to the clipboard. |
| 145 std::vector<Element> elements; | 153 std::vector<Element> elements; |
| 146 | 154 |
| 147 // The MIME type for the clipboard format for BookmarkDragData. | 155 // The MIME type for the clipboard format for BookmarkDragData. |
| 148 static const char* kClipboardFormatString; | 156 static const char* kClipboardFormatString; |
| 149 | 157 |
| 150 static bool ClipboardContainsBookmarks(); | 158 static bool ClipboardContainsBookmarks(); |
| 151 | 159 |
| 152 private: | 160 private: |
| 153 // Path of the profile we originated from. | 161 // Path of the profile we originated from. |
| 154 FilePath::StringType profile_path_; | 162 FilePath::StringType profile_path_; |
| 155 }; | 163 }; |
| 156 | 164 |
| 157 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ | 165 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ |
| OLD | NEW |