| 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_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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
| 12 #include "base/string16.h" | 12 #include "base/string16.h" |
| 13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
| 14 | 14 |
| 15 #if defined(TOOLKIT_VIEWS) | 15 #if defined(TOOLKIT_VIEWS) |
| 16 #include "app/os_exchange_data.h" | 16 #include "ui/base/dragdrop/os_exchange_data.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 class BookmarkNode; | 19 class BookmarkNode; |
| 20 class Pickle; | 20 class Pickle; |
| 21 class Profile; | 21 class Profile; |
| 22 | 22 |
| 23 // BookmarkNodeData is used to represent the following: | 23 // BookmarkNodeData is used to represent the following: |
| 24 // | 24 // |
| 25 // . A single URL. | 25 // . A single URL. |
| 26 // . A single node from the bookmark model. | 26 // . A single node from the bookmark model. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 void WriteToPickle(Pickle* pickle) const; | 67 void WriteToPickle(Pickle* pickle) const; |
| 68 bool ReadFromPickle(Pickle* pickle, void** iterator); | 68 bool ReadFromPickle(Pickle* pickle, void** iterator); |
| 69 | 69 |
| 70 // ID of the node. | 70 // ID of the node. |
| 71 int64 id_; | 71 int64 id_; |
| 72 }; | 72 }; |
| 73 | 73 |
| 74 BookmarkNodeData(); | 74 BookmarkNodeData(); |
| 75 | 75 |
| 76 #if defined(TOOLKIT_VIEWS) | 76 #if defined(TOOLKIT_VIEWS) |
| 77 static OSExchangeData::CustomFormat GetBookmarkCustomFormat(); | 77 static ui::OSExchangeData::CustomFormat GetBookmarkCustomFormat(); |
| 78 #endif | 78 #endif |
| 79 | 79 |
| 80 // Created a BookmarkNodeData populated from the arguments. | 80 // Created a BookmarkNodeData populated from the arguments. |
| 81 explicit BookmarkNodeData(const BookmarkNode* node); | 81 explicit BookmarkNodeData(const BookmarkNode* node); |
| 82 explicit BookmarkNodeData(const std::vector<const BookmarkNode*>& nodes); | 82 explicit BookmarkNodeData(const std::vector<const BookmarkNode*>& nodes); |
| 83 | 83 |
| 84 ~BookmarkNodeData(); | 84 ~BookmarkNodeData(); |
| 85 | 85 |
| 86 // Reads bookmarks from the given vector. | 86 // Reads bookmarks from the given vector. |
| 87 bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); | 87 bool ReadFromVector(const std::vector<const BookmarkNode*>& nodes); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 101 // pasteboard. | 101 // pasteboard. |
| 102 bool ReadFromDragClipboard(); | 102 bool ReadFromDragClipboard(); |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 #if defined(TOOLKIT_VIEWS) | 105 #if defined(TOOLKIT_VIEWS) |
| 106 // Writes elements to data. If there is only one element and it is a URL | 106 // Writes elements to data. If there is only one element and it is a URL |
| 107 // the URL and title are written to the clipboard in a format other apps can | 107 // the URL and title are written to the clipboard in a format other apps can |
| 108 // use. | 108 // use. |
| 109 // |profile| is used to identify which profile the data came from. Use a | 109 // |profile| is used to identify which profile the data came from. Use a |
| 110 // value of null to indicate the data is not associated with any profile. | 110 // value of null to indicate the data is not associated with any profile. |
| 111 void Write(Profile* profile, OSExchangeData* data) const; | 111 void Write(Profile* profile, ui::OSExchangeData* data) const; |
| 112 | 112 |
| 113 // Restores this data from the clipboard, returning true on success. | 113 // Restores this data from the clipboard, returning true on success. |
| 114 bool Read(const OSExchangeData& data); | 114 bool Read(const ui::OSExchangeData& data); |
| 115 #endif | 115 #endif |
| 116 | 116 |
| 117 // Writes the data for a drag to |pickle|. | 117 // Writes the data for a drag to |pickle|. |
| 118 void WriteToPickle(Profile* profile, Pickle* pickle) const; | 118 void WriteToPickle(Profile* profile, Pickle* pickle) const; |
| 119 | 119 |
| 120 // Reads the data for a drag from a |pickle|. | 120 // Reads the data for a drag from a |pickle|. |
| 121 bool ReadFromPickle(Pickle* pickle); | 121 bool ReadFromPickle(Pickle* pickle); |
| 122 | 122 |
| 123 // Returns the nodes represented by this DragData. If this DragData was | 123 // Returns the nodes represented by this DragData. If this DragData was |
| 124 // created from the same profile then the nodes from the model are returned. | 124 // created from the same profile then the nodes from the model are returned. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 static const char* kClipboardFormatString; | 157 static const char* kClipboardFormatString; |
| 158 | 158 |
| 159 static bool ClipboardContainsBookmarks(); | 159 static bool ClipboardContainsBookmarks(); |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 // Path of the profile we originated from. | 162 // Path of the profile we originated from. |
| 163 FilePath::StringType profile_path_; | 163 FilePath::StringType profile_path_; |
| 164 }; | 164 }; |
| 165 | 165 |
| 166 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ | 166 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_NODE_DATA_H_ |
| OLD | NEW |