| 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/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/pickle.h" | 10 #include "base/pickle.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 | 244 |
| 245 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes( | 245 std::vector<const BookmarkNode*> BookmarkNodeData::GetNodes( |
| 246 BookmarkModel* model, | 246 BookmarkModel* model, |
| 247 const base::FilePath& profile_path) const { | 247 const base::FilePath& profile_path) const { |
| 248 std::vector<const BookmarkNode*> nodes; | 248 std::vector<const BookmarkNode*> nodes; |
| 249 | 249 |
| 250 if (!IsFromProfilePath(profile_path)) | 250 if (!IsFromProfilePath(profile_path)) |
| 251 return nodes; | 251 return nodes; |
| 252 | 252 |
| 253 for (size_t i = 0; i < elements.size(); ++i) { | 253 for (size_t i = 0; i < elements.size(); ++i) { |
| 254 const BookmarkNode* node = GetBookmarkNodeByID(model, elements[i].id_); | 254 const BookmarkNode* node = |
| 255 bookmarks::GetBookmarkNodeByID(model, elements[i].id_); |
| 255 if (!node) { | 256 if (!node) { |
| 256 nodes.clear(); | 257 nodes.clear(); |
| 257 return nodes; | 258 return nodes; |
| 258 } | 259 } |
| 259 nodes.push_back(node); | 260 nodes.push_back(node); |
| 260 } | 261 } |
| 261 return nodes; | 262 return nodes; |
| 262 } | 263 } |
| 263 | 264 |
| 264 const BookmarkNode* BookmarkNodeData::GetFirstNode( | 265 const BookmarkNode* BookmarkNodeData::GetFirstNode( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 277 const base::FilePath& profile_path) { | 278 const base::FilePath& profile_path) { |
| 278 DCHECK(profile_path_.empty()); | 279 DCHECK(profile_path_.empty()); |
| 279 profile_path_ = profile_path; | 280 profile_path_ = profile_path; |
| 280 } | 281 } |
| 281 | 282 |
| 282 bool BookmarkNodeData::IsFromProfilePath( | 283 bool BookmarkNodeData::IsFromProfilePath( |
| 283 const base::FilePath& profile_path) const { | 284 const base::FilePath& profile_path) const { |
| 284 // An empty path means the data is not associated with any profile. | 285 // An empty path means the data is not associated with any profile. |
| 285 return !profile_path_.empty() && profile_path_ == profile_path; | 286 return !profile_path_.empty() && profile_path_ == profile_path; |
| 286 } | 287 } |
| OLD | NEW |