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

Side by Side Diff: components/bookmarks/browser/bookmark_node_data_views.cc

Issue 870293002: bookmarks: BookmarkNodeData's size() cleanups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 5 years, 10 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_node_data.h" 5 #include "components/bookmarks/browser/bookmark_node_data.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/pickle.h" 8 #include "base/pickle.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "ui/base/clipboard/clipboard.h" 10 #include "ui/base/clipboard/clipboard.h"
(...skipping 16 matching lines...) Expand all
27 27
28 return format; 28 return format;
29 } 29 }
30 30
31 void BookmarkNodeData::Write(const base::FilePath& profile_path, 31 void BookmarkNodeData::Write(const base::FilePath& profile_path,
32 ui::OSExchangeData* data) const { 32 ui::OSExchangeData* data) const {
33 DCHECK(data); 33 DCHECK(data);
34 34
35 // If there is only one element and it is a URL, write the URL to the 35 // If there is only one element and it is a URL, write the URL to the
36 // clipboard. 36 // clipboard.
37 if (elements.size() == 1 && elements[0].is_url) { 37 if (has_single_url()) {
38 if (elements[0].url.SchemeIs(kJavaScriptScheme)) { 38 if (elements[0].url.SchemeIs(kJavaScriptScheme)) {
39 data->SetString(base::UTF8ToUTF16(elements[0].url.spec())); 39 data->SetString(base::UTF8ToUTF16(elements[0].url.spec()));
40 } else { 40 } else {
41 data->SetURL(elements[0].url, elements[0].title); 41 data->SetURL(elements[0].url, elements[0].title);
42 } 42 }
43 } 43 }
44 44
45 Pickle data_pickle; 45 Pickle data_pickle;
46 WriteToPickle(profile_path, &data_pickle); 46 WriteToPickle(profile_path, &data_pickle);
47 47
(...skipping 18 matching lines...) Expand all
66 base::string16 title; 66 base::string16 title;
67 if (data.GetURLAndTitle( 67 if (data.GetURLAndTitle(
68 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title)) 68 ui::OSExchangeData::CONVERT_FILENAMES, &url, &title))
69 ReadFromTuple(url, title); 69 ReadFromTuple(url, title);
70 } 70 }
71 71
72 return is_valid(); 72 return is_valid();
73 } 73 }
74 74
75 } // namespace bookmarks 75 } // namespace bookmarks
OLDNEW
« no previous file with comments | « components/bookmarks/browser/bookmark_node_data_unittest.cc ('k') | components/bookmarks/browser/bookmark_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698