| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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_NODE_DATA_H_ | 5 #ifndef CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ |
| 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ | 6 #define CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "chrome/browser/bookmarks/bookmark_model.h" | 13 #include "chrome/browser/bookmarks/bookmark_model.h" |
| 14 #include "ui/base/clipboard/clipboard.h" |
| 14 #include "ui/base/clipboard/clipboard_types.h" | 15 #include "ui/base/clipboard/clipboard_types.h" |
| 15 | 16 |
| 16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
| 17 #if defined(TOOLKIT_VIEWS) | 18 #if defined(TOOLKIT_VIEWS) |
| 18 #include "ui/base/dragdrop/os_exchange_data.h" | 19 #include "ui/base/dragdrop/os_exchange_data.h" |
| 19 #endif | 20 #endif |
| 20 | 21 |
| 21 class Pickle; | 22 class Pickle; |
| 22 class PickleIterator; | 23 class PickleIterator; |
| 23 class Profile; | 24 class Profile; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 friend struct BookmarkNodeData; | 75 friend struct BookmarkNodeData; |
| 75 | 76 |
| 76 // For reading/writing this Element. | 77 // For reading/writing this Element. |
| 77 void WriteToPickle(Pickle* pickle) const; | 78 void WriteToPickle(Pickle* pickle) const; |
| 78 bool ReadFromPickle(Pickle* pickle, PickleIterator* iterator); | 79 bool ReadFromPickle(Pickle* pickle, PickleIterator* iterator); |
| 79 | 80 |
| 80 // ID of the node. | 81 // ID of the node. |
| 81 int64 id_; | 82 int64 id_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // The MIME type for the clipboard format for BookmarkNodeData. | 85 // The Bookmark format type for BookmarkNodeData. |
| 85 static const char* kClipboardFormatString; | 86 static const ui::Clipboard::FormatType& GetFormatType(); |
| 86 | 87 |
| 87 BookmarkNodeData(); | 88 BookmarkNodeData(); |
| 88 | 89 |
| 89 // Created a BookmarkNodeData populated from the arguments. | 90 // Created a BookmarkNodeData populated from the arguments. |
| 90 explicit BookmarkNodeData(const BookmarkNode* node); | 91 explicit BookmarkNodeData(const BookmarkNode* node); |
| 91 explicit BookmarkNodeData(const std::vector<const BookmarkNode*>& nodes); | 92 explicit BookmarkNodeData(const std::vector<const BookmarkNode*>& nodes); |
| 92 | 93 |
| 93 ~BookmarkNodeData(); | 94 ~BookmarkNodeData(); |
| 94 | 95 |
| 95 #if defined(TOOLKIT_VIEWS) | |
| 96 static const ui::OSExchangeData::CustomFormat& GetBookmarkCustomFormat(); | |
| 97 #endif | |
| 98 | |
| 99 static bool ClipboardContainsBookmarks(); | 96 static bool ClipboardContainsBookmarks(); |
| 100 | 97 |
| 101 // Reads bookmarks from the given vector. | 98 // Reads bookmarks from the given vector. |
| 102 bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); | 99 bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); |
| 103 | 100 |
| 104 // Creates a single-bookmark DragData from url/title pair. | 101 // Creates a single-bookmark DragData from url/title pair. |
| 105 bool ReadFromTuple(const GURL& url, const base::string16& title); | 102 bool ReadFromTuple(const GURL& url, const base::string16& title); |
| 106 | 103 |
| 107 // Writes bookmarks to the specified clipboard. | 104 // Writes bookmarks to the specified clipboard. |
| 108 void WriteToClipboard(ui::ClipboardType type); | 105 void WriteToClipboard(ui::ClipboardType type); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 | 158 |
| 162 // The actual elements written to the clipboard. | 159 // The actual elements written to the clipboard. |
| 163 std::vector<Element> elements; | 160 std::vector<Element> elements; |
| 164 | 161 |
| 165 private: | 162 private: |
| 166 // Path of the profile we originated from. | 163 // Path of the profile we originated from. |
| 167 base::FilePath profile_path_; | 164 base::FilePath profile_path_; |
| 168 }; | 165 }; |
| 169 | 166 |
| 170 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ | 167 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ |
| OLD | NEW |