| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/bookmarks/bookmark_utils.h" | 5 #include "chrome/browser/bookmarks/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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 std::vector<const BookmarkNode*>* nodes) { | 221 std::vector<const BookmarkNode*>* nodes) { |
| 222 std::vector<string16> words; | 222 std::vector<string16> words; |
| 223 QueryParser parser; | 223 QueryParser parser; |
| 224 parser.ParseQueryWords(base::i18n::ToLower(text), &words); | 224 parser.ParseQueryWords(base::i18n::ToLower(text), &words); |
| 225 if (words.empty()) | 225 if (words.empty()) |
| 226 return; | 226 return; |
| 227 | 227 |
| 228 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); | 228 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); |
| 229 while (iterator.has_next()) { | 229 while (iterator.has_next()) { |
| 230 const BookmarkNode* node = iterator.Next(); | 230 const BookmarkNode* node = iterator.Next(); |
| 231 if (node->is_url() && DoesBookmarkContainWords(node, words, languages)) { | 231 if (DoesBookmarkContainWords(node, words, languages)) { |
| 232 nodes->push_back(node); | 232 nodes->push_back(node); |
| 233 if (nodes->size() == max_count) | 233 if (nodes->size() == max_count) |
| 234 return; | 234 return; |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 } | 237 } |
| 238 | 238 |
| 239 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 239 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 240 registry->RegisterBooleanPref( | 240 registry->RegisterBooleanPref( |
| 241 prefs::kShowBookmarkBar, | 241 prefs::kShowBookmarkBar, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 // Remove all the bookmarks. | 311 // Remove all the bookmarks. |
| 312 for (size_t i = 0; i < bookmarks.size(); ++i) { | 312 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 313 const BookmarkNode* node = bookmarks[i]; | 313 const BookmarkNode* node = bookmarks[i]; |
| 314 int index = node->parent()->GetIndexOf(node); | 314 int index = node->parent()->GetIndexOf(node); |
| 315 if (index > -1) | 315 if (index > -1) |
| 316 model->Remove(node->parent(), index); | 316 model->Remove(node->parent(), index); |
| 317 } | 317 } |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace bookmark_utils | 320 } // namespace bookmark_utils |
| OLD | NEW |