| 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_index.h" | 5 #include "components/bookmarks/browser/bookmark_index.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <iterator> | 9 #include <iterator> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 : std::unary_function<NodeTypedCountPair, const BookmarkNode*> { | 58 : std::unary_function<NodeTypedCountPair, const BookmarkNode*> { |
| 59 const BookmarkNode* operator()(const NodeTypedCountPair& pair) const { | 59 const BookmarkNode* operator()(const NodeTypedCountPair& pair) const { |
| 60 return pair.first; | 60 return pair.first; |
| 61 } | 61 } |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 | 65 |
| 66 BookmarkIndex::BookmarkIndex(BookmarkClient* client, | 66 BookmarkIndex::BookmarkIndex(BookmarkClient* client, |
| 67 const std::string& languages) | 67 const std::string& languages) |
| 68 : client_(client), | 68 : client_(client), languages_(languages) { |
| 69 languages_(languages) { | |
| 70 DCHECK(client_); | 69 DCHECK(client_); |
| 71 } | 70 } |
| 72 | 71 |
| 73 BookmarkIndex::~BookmarkIndex() { | 72 BookmarkIndex::~BookmarkIndex() { |
| 74 } | 73 } |
| 75 | 74 |
| 76 void BookmarkIndex::Add(const BookmarkNode* node) { | 75 void BookmarkIndex::Add(const BookmarkNode* node) { |
| 77 if (!node->is_url()) | 76 if (!node->is_url()) |
| 78 return; | 77 return; |
| 79 std::vector<base::string16> terms = | 78 std::vector<base::string16> terms = |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // We can get here if the node has the same term more than once. For | 276 // We can get here if the node has the same term more than once. For |
| 278 // example, a bookmark with the title 'foo foo' would end up here. | 277 // example, a bookmark with the title 'foo foo' would end up here. |
| 279 return; | 278 return; |
| 280 } | 279 } |
| 281 i->second.erase(node); | 280 i->second.erase(node); |
| 282 if (i->second.empty()) | 281 if (i->second.empty()) |
| 283 index_.erase(i); | 282 index_.erase(i); |
| 284 } | 283 } |
| 285 | 284 |
| 286 } // namespace bookmarks | 285 } // namespace bookmarks |
| OLD | NEW |