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

Side by Side Diff: chrome/browser/bookmarks/bookmark_node_data.cc

Issue 7087009: FilePath: remove some functions that aren't really used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: simpler Created 9 years, 6 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
« no previous file with comments | « chrome/browser/bookmarks/bookmark_node_data.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chrome/browser/bookmarks/bookmark_node_data.h" 5 #include "chrome/browser/bookmarks/bookmark_node_data.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 191
192 return false; 192 return false;
193 } 193 }
194 194
195 bool BookmarkNodeData::ClipboardContainsBookmarks() { 195 bool BookmarkNodeData::ClipboardContainsBookmarks() {
196 return g_browser_process->clipboard()->IsFormatAvailableByString( 196 return g_browser_process->clipboard()->IsFormatAvailableByString(
197 BookmarkNodeData::kClipboardFormatString, ui::Clipboard::BUFFER_STANDARD); 197 BookmarkNodeData::kClipboardFormatString, ui::Clipboard::BUFFER_STANDARD);
198 } 198 }
199 #else 199 #else
200 void BookmarkNodeData::WriteToClipboard(Profile* profile) const { 200 void BookmarkNodeData::WriteToClipboard(Profile* profile) const {
201 bookmark_pasteboard_helper_mac::WriteToClipboard(elements, profile_path_); 201 bookmark_pasteboard_helper_mac::WriteToClipboard(elements,
202 profile_path_.value());
202 } 203 }
203 204
204 bool BookmarkNodeData::ReadFromClipboard() { 205 bool BookmarkNodeData::ReadFromClipboard() {
205 return bookmark_pasteboard_helper_mac::ReadFromClipboard(elements, 206 return bookmark_pasteboard_helper_mac::ReadFromClipboard(
206 &profile_path_); 207 elements, &profile_path_.value());
tony 2011/05/27 23:30:20 This looks like a compile error.
Mark Mentovai 2011/05/27 23:39:56 tony wrote:
207 } 208 }
208 209
209 bool BookmarkNodeData::ReadFromDragClipboard() { 210 bool BookmarkNodeData::ReadFromDragClipboard() {
210 return bookmark_pasteboard_helper_mac::ReadFromDragClipboard(elements, 211 // TODO(evan): bookmark_pasteboard_helper_mac should just use FilePaths.
211 &profile_path_); 212 FilePath::StringType buf;
213 if (!bookmark_pasteboard_helper_mac::ReadFromDragClipboard(elements, &buf))
214 return false;
215 profile_path_ = FilePath(buf);
216 return true;
212 } 217 }
213 218
214 bool BookmarkNodeData::ClipboardContainsBookmarks() { 219 bool BookmarkNodeData::ClipboardContainsBookmarks() {
215 return bookmark_pasteboard_helper_mac::ClipboardContainsBookmarks(); 220 return bookmark_pasteboard_helper_mac::ClipboardContainsBookmarks();
216 } 221 }
217 #endif // !defined(OS_MACOSX) 222 #endif // !defined(OS_MACOSX)
218 223
219 #if defined(TOOLKIT_VIEWS) 224 #if defined(TOOLKIT_VIEWS)
220 void BookmarkNodeData::Write(Profile* profile, ui::OSExchangeData* data) const { 225 void BookmarkNodeData::Write(Profile* profile, ui::OSExchangeData* data) const {
221 DCHECK(data); 226 DCHECK(data);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 if (data.GetURLAndTitle(&url, &title)) 260 if (data.GetURLAndTitle(&url, &title))
256 ReadFromTuple(url, title); 261 ReadFromTuple(url, title);
257 } 262 }
258 263
259 return is_valid(); 264 return is_valid();
260 } 265 }
261 #endif 266 #endif
262 267
263 void BookmarkNodeData::WriteToPickle(Profile* profile, Pickle* pickle) const { 268 void BookmarkNodeData::WriteToPickle(Profile* profile, Pickle* pickle) const {
264 FilePath path = profile ? profile->GetPath() : FilePath(); 269 FilePath path = profile ? profile->GetPath() : FilePath();
265 FilePath::WriteStringTypeToPickle(pickle, path.value()); 270 path.WriteToPickle(pickle);
266 pickle->WriteSize(elements.size()); 271 pickle->WriteSize(elements.size());
267 272
268 for (size_t i = 0; i < elements.size(); ++i) 273 for (size_t i = 0; i < elements.size(); ++i)
269 elements[i].WriteToPickle(pickle); 274 elements[i].WriteToPickle(pickle);
270 } 275 }
271 276
272 bool BookmarkNodeData::ReadFromPickle(Pickle* pickle) { 277 bool BookmarkNodeData::ReadFromPickle(Pickle* pickle) {
273 void* data_iterator = NULL; 278 void* data_iterator = NULL;
274 size_t element_count; 279 size_t element_count;
275 if (FilePath::ReadStringTypeFromPickle(pickle, &data_iterator, 280 if (profile_path_.ReadFromPickle(pickle, &data_iterator) &&
276 &profile_path_) &&
277 pickle->ReadSize(&data_iterator, &element_count)) { 281 pickle->ReadSize(&data_iterator, &element_count)) {
278 std::vector<Element> tmp_elements; 282 std::vector<Element> tmp_elements;
279 tmp_elements.resize(element_count); 283 tmp_elements.resize(element_count);
280 for (size_t i = 0; i < element_count; ++i) { 284 for (size_t i = 0; i < element_count; ++i) {
281 if (!tmp_elements[i].ReadFromPickle(pickle, &data_iterator)) { 285 if (!tmp_elements[i].ReadFromPickle(pickle, &data_iterator)) {
282 return false; 286 return false;
283 } 287 }
284 } 288 }
285 elements.swap(tmp_elements); 289 elements.swap(tmp_elements);
286 } 290 }
(...skipping 27 matching lines...) Expand all
314 318
315 void BookmarkNodeData::Clear() { 319 void BookmarkNodeData::Clear() {
316 profile_path_.clear(); 320 profile_path_.clear();
317 elements.clear(); 321 elements.clear();
318 } 322 }
319 323
320 void BookmarkNodeData::SetOriginatingProfile(Profile* profile) { 324 void BookmarkNodeData::SetOriginatingProfile(Profile* profile) {
321 DCHECK(profile_path_.empty()); 325 DCHECK(profile_path_.empty());
322 326
323 if (profile) 327 if (profile)
324 profile_path_ = profile->GetPath().value(); 328 profile_path_ = profile->GetPath();
325 } 329 }
326 330
327 bool BookmarkNodeData::IsFromProfile(Profile* profile) const { 331 bool BookmarkNodeData::IsFromProfile(Profile* profile) const {
328 // An empty path means the data is not associated with any profile. 332 // An empty path means the data is not associated with any profile.
329 return !profile_path_.empty() && profile_path_ == profile->GetPath().value(); 333 return !profile_path_.empty() && profile_path_ == profile->GetPath();
330 } 334 }
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_node_data.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698