| 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 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 | 343 |
| 344 void GetBookmarksMatchingProperties(BookmarkModel* model, | 344 void GetBookmarksMatchingProperties(BookmarkModel* model, |
| 345 const QueryFields& query, | 345 const QueryFields& query, |
| 346 size_t max_count, | 346 size_t max_count, |
| 347 const std::string& languages, | 347 const std::string& languages, |
| 348 std::vector<const BookmarkNode*>* nodes) { | 348 std::vector<const BookmarkNode*>* nodes) { |
| 349 std::vector<base::string16> query_words; | 349 std::vector<base::string16> query_words; |
| 350 query_parser::QueryParser parser; | 350 query_parser::QueryParser parser; |
| 351 if (query.word_phrase_query) { | 351 if (query.word_phrase_query) { |
| 352 parser.ParseQueryWords(base::i18n::ToLower(*query.word_phrase_query), | 352 parser.ParseQueryWords(base::i18n::ToLower(*query.word_phrase_query), |
| 353 false /* always_prefix_search */, |
| 353 &query_words); | 354 &query_words); |
| 354 if (query_words.empty()) | 355 if (query_words.empty()) |
| 355 return; | 356 return; |
| 356 } | 357 } |
| 357 | 358 |
| 358 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); | 359 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); |
| 359 while (iterator.has_next()) { | 360 while (iterator.has_next()) { |
| 360 const BookmarkNode* node = iterator.Next(); | 361 const BookmarkNode* node = iterator.Next(); |
| 361 if ((!query_words.empty() && | 362 if ((!query_words.empty() && |
| 362 !DoesBookmarkContainWords(node, query_words, languages)) || | 363 !DoesBookmarkContainWords(node, query_words, languages)) || |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 } | 499 } |
| 499 return false; | 500 return false; |
| 500 } | 501 } |
| 501 | 502 |
| 502 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { | 503 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { |
| 503 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. | 504 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. |
| 504 return GetNodeByID(model->root_node(), id); | 505 return GetNodeByID(model->root_node(), id); |
| 505 } | 506 } |
| 506 | 507 |
| 507 } // namespace bookmarks | 508 } // namespace bookmarks |
| OLD | NEW |