OLD | NEW |
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/pickle.h" | 9 #include "base/pickle.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 title(node->GetTitle()), | 27 title(node->GetTitle()), |
28 date_added(node->date_added()), | 28 date_added(node->date_added()), |
29 date_folder_modified(node->date_folder_modified()), | 29 date_folder_modified(node->date_folder_modified()), |
30 id_(node->id()) { | 30 id_(node->id()) { |
31 if (node->GetMetaInfoMap()) | 31 if (node->GetMetaInfoMap()) |
32 meta_info_map = *node->GetMetaInfoMap(); | 32 meta_info_map = *node->GetMetaInfoMap(); |
33 for (int i = 0; i < node->child_count(); ++i) | 33 for (int i = 0; i < node->child_count(); ++i) |
34 children.push_back(Element(node->GetChild(i))); | 34 children.push_back(Element(node->GetChild(i))); |
35 } | 35 } |
36 | 36 |
| 37 BookmarkNodeData::Element::Element(const Element& other) = default; |
| 38 |
37 BookmarkNodeData::Element::~Element() { | 39 BookmarkNodeData::Element::~Element() { |
38 } | 40 } |
39 | 41 |
40 void BookmarkNodeData::Element::WriteToPickle(base::Pickle* pickle) const { | 42 void BookmarkNodeData::Element::WriteToPickle(base::Pickle* pickle) const { |
41 pickle->WriteBool(is_url); | 43 pickle->WriteBool(is_url); |
42 pickle->WriteString(url.spec()); | 44 pickle->WriteString(url.spec()); |
43 pickle->WriteString16(title); | 45 pickle->WriteString16(title); |
44 pickle->WriteInt64(id_); | 46 pickle->WriteInt64(id_); |
45 pickle->WriteUInt32(static_cast<uint32_t>(meta_info_map.size())); | 47 pickle->WriteUInt32(static_cast<uint32_t>(meta_info_map.size())); |
46 for (BookmarkNode::MetaInfoMap::const_iterator it = meta_info_map.begin(); | 48 for (BookmarkNode::MetaInfoMap::const_iterator it = meta_info_map.begin(); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 96 } |
95 } | 97 } |
96 return true; | 98 return true; |
97 } | 99 } |
98 | 100 |
99 // BookmarkNodeData ----------------------------------------------------------- | 101 // BookmarkNodeData ----------------------------------------------------------- |
100 | 102 |
101 BookmarkNodeData::BookmarkNodeData() { | 103 BookmarkNodeData::BookmarkNodeData() { |
102 } | 104 } |
103 | 105 |
| 106 BookmarkNodeData::BookmarkNodeData(const BookmarkNodeData& other) = default; |
| 107 |
104 BookmarkNodeData::BookmarkNodeData(const BookmarkNode* node) { | 108 BookmarkNodeData::BookmarkNodeData(const BookmarkNode* node) { |
105 elements.push_back(Element(node)); | 109 elements.push_back(Element(node)); |
106 } | 110 } |
107 | 111 |
108 BookmarkNodeData::BookmarkNodeData( | 112 BookmarkNodeData::BookmarkNodeData( |
109 const std::vector<const BookmarkNode*>& nodes) { | 113 const std::vector<const BookmarkNode*>& nodes) { |
110 ReadFromVector(nodes); | 114 ReadFromVector(nodes); |
111 } | 115 } |
112 | 116 |
113 BookmarkNodeData::~BookmarkNodeData() { | 117 BookmarkNodeData::~BookmarkNodeData() { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 profile_path_ = profile_path; | 299 profile_path_ = profile_path; |
296 } | 300 } |
297 | 301 |
298 bool BookmarkNodeData::IsFromProfilePath( | 302 bool BookmarkNodeData::IsFromProfilePath( |
299 const base::FilePath& profile_path) const { | 303 const base::FilePath& profile_path) const { |
300 // An empty path means the data is not associated with any profile. | 304 // An empty path means the data is not associated with any profile. |
301 return !profile_path_.empty() && profile_path_ == profile_path; | 305 return !profile_path_.empty() && profile_path_ == profile_path; |
302 } | 306 } |
303 | 307 |
304 } // namespace bookmarks | 308 } // namespace bookmarks |
OLD | NEW |