Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(131)

Side by Side Diff: chrome/browser/bookmarks/bookmark_drag_data.h

Issue 159815: Refactor bookmark clipboard code to be cross platform. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix UMR Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 // ID of the node. 64 // ID of the node.
65 int64 id_; 65 int64 id_;
66 }; 66 };
67 67
68 BookmarkDragData() { } 68 BookmarkDragData() { }
69 69
70 // Created a BookmarkDragData populated from the arguments. 70 // Created a BookmarkDragData populated from the arguments.
71 explicit BookmarkDragData(const BookmarkNode* node); 71 explicit BookmarkDragData(const BookmarkNode* node);
72 explicit BookmarkDragData(const std::vector<const BookmarkNode*>& nodes); 72 explicit BookmarkDragData(const std::vector<const BookmarkNode*>& nodes);
73 73
74 // TODO(estade): Port to mac. It should be as simple as removing this ifdef
75 // after the relevant Clipboard functions are implemetned.
76 #if !defined(OS_MACOSX)
77 // Writes elements to the clipboard.
78 void WriteToClipboard(Profile* profile) const;
79
80 // Reads bookmarks from the clipboard. Prefers data written via
81 // WriteToClipboard but will also attempt to read a plain bookmark.
82 bool ReadFromClipboard();
83 #endif
84
74 #if defined(TOOLKIT_VIEWS) 85 #if defined(TOOLKIT_VIEWS)
75 // Writes elements to data. If there is only one element and it is a URL 86 // Writes elements to data. If there is only one element and it is a URL
76 // the URL and title are written to the clipboard in a format other apps can 87 // the URL and title are written to the clipboard in a format other apps can
77 // use. 88 // use.
78 // |profile| is used to identify which profile the data came from. Use a 89 // |profile| is used to identify which profile the data came from. Use a
79 // value of null to indicate the data is not associated with any profile. 90 // value of null to indicate the data is not associated with any profile.
80 void Write(Profile* profile, OSExchangeData* data) const; 91 void Write(Profile* profile, OSExchangeData* data) const;
81 92
82 // Restores this data from the clipboard, returning true on success. 93 // Restores this data from the clipboard, returning true on success.
83 bool Read(const OSExchangeData& data); 94 bool Read(const OSExchangeData& data);
(...skipping 23 matching lines...) Expand all
107 118
108 // Number of elements. 119 // Number of elements.
109 size_t size() const { return elements.size(); } 120 size_t size() const { return elements.size(); }
110 121
111 // Returns true if this data is from the specified profile. 122 // Returns true if this data is from the specified profile.
112 bool IsFromProfile(Profile* profile) const; 123 bool IsFromProfile(Profile* profile) const;
113 124
114 // The actual elements written to the clipboard. 125 // The actual elements written to the clipboard.
115 std::vector<Element> elements; 126 std::vector<Element> elements;
116 127
128 // The MIME type for the clipboard format for BookmarkDragData.
129 static const char* kClipboardFormatString;
130
117 private: 131 private:
118 // Path of the profile we originated from. 132 // Path of the profile we originated from.
119 #if defined(WCHAR_T_IS_UTF16) 133 #if defined(WCHAR_T_IS_UTF16)
120 std::wstring profile_path_; 134 std::wstring profile_path_;
121 #elif defined(WCHAR_T_IS_UTF32) 135 #elif defined(WCHAR_T_IS_UTF32)
122 std::string profile_path_; 136 std::string profile_path_;
123 #endif 137 #endif
124 }; 138 };
125 139
126 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_ 140 #endif // CHROME_BROWSER_BOOKMARKS_BOOKMARK_DRAG_DATA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698