| 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_utils.h" | 5 #include "components/bookmarks/browser/bookmark_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 if (!url.is_valid()) | 251 if (!url.is_valid()) |
| 252 return; | 252 return; |
| 253 BookmarkNode node(url); | 253 BookmarkNode node(url); |
| 254 node.SetTitle(base::ASCIIToUTF16(url.spec())); | 254 node.SetTitle(base::ASCIIToUTF16(url.spec())); |
| 255 bookmark_data = BookmarkNodeData(&node); | 255 bookmark_data = BookmarkNodeData(&node); |
| 256 } | 256 } |
| 257 if (index == -1) | 257 if (index == -1) |
| 258 index = parent->child_count(); | 258 index = parent->child_count(); |
| 259 ScopedGroupBookmarkActions group_paste(model); | 259 ScopedGroupBookmarkActions group_paste(model); |
| 260 | 260 |
| 261 if (bookmark_data.elements.size() == 1 && | 261 if (bookmark_data.num_elements() == 1 && |
| 262 model->IsBookmarked(bookmark_data.elements[0].url)) { | 262 model->IsBookmarked(bookmark_data.elements[0].url)) { |
| 263 MakeTitleUnique(model, | 263 MakeTitleUnique(model, |
| 264 parent, | 264 parent, |
| 265 bookmark_data.elements[0].url, | 265 bookmark_data.elements[0].url, |
| 266 &bookmark_data.elements[0].title); | 266 &bookmark_data.elements[0].title); |
| 267 } | 267 } |
| 268 | 268 |
| 269 CloneBookmarkNode(model, bookmark_data.elements, parent, index, true); | 269 CloneBookmarkNode(model, bookmark_data.elements, parent, index, true); |
| 270 } | 270 } |
| 271 | 271 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 } | 504 } |
| 505 return false; | 505 return false; |
| 506 } | 506 } |
| 507 | 507 |
| 508 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { | 508 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { |
| 509 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. | 509 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. |
| 510 return GetNodeByID(model->root_node(), id); | 510 return GetNodeByID(model->root_node(), id); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace bookmarks | 513 } // namespace bookmarks |
| OLD | NEW |