| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 std::vector<const BookmarkNode*>* nodes) { | 223 std::vector<const BookmarkNode*>* nodes) { |
| 224 std::vector<string16> words; | 224 std::vector<string16> words; |
| 225 QueryParser parser; | 225 QueryParser parser; |
| 226 parser.ParseQueryWords(base::i18n::ToLower(text), &words); | 226 parser.ParseQueryWords(base::i18n::ToLower(text), &words); |
| 227 if (words.empty()) | 227 if (words.empty()) |
| 228 return; | 228 return; |
| 229 | 229 |
| 230 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); | 230 ui::TreeNodeIterator<const BookmarkNode> iterator(model->root_node()); |
| 231 while (iterator.has_next()) { | 231 while (iterator.has_next()) { |
| 232 const BookmarkNode* node = iterator.Next(); | 232 const BookmarkNode* node = iterator.Next(); |
| 233 if (DoesBookmarkContainWords(node, words, languages)) { | 233 if (DoesBookmarkContainWords(node, words, languages) && |
| 234 !model->is_permanent_node(node)) { |
| 234 nodes->push_back(node); | 235 nodes->push_back(node); |
| 235 if (nodes->size() == max_count) | 236 if (nodes->size() == max_count) |
| 236 return; | 237 return; |
| 237 } | 238 } |
| 238 } | 239 } |
| 239 } | 240 } |
| 240 | 241 |
| 241 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { | 242 void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { |
| 242 registry->RegisterBooleanPref( | 243 registry->RegisterBooleanPref( |
| 243 prefs::kShowBookmarkBar, | 244 prefs::kShowBookmarkBar, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 // Remove all the bookmarks. | 314 // Remove all the bookmarks. |
| 314 for (size_t i = 0; i < bookmarks.size(); ++i) { | 315 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 315 const BookmarkNode* node = bookmarks[i]; | 316 const BookmarkNode* node = bookmarks[i]; |
| 316 int index = node->parent()->GetIndexOf(node); | 317 int index = node->parent()->GetIndexOf(node); |
| 317 if (index > -1) | 318 if (index > -1) |
| 318 model->Remove(node->parent(), index); | 319 model->Remove(node->parent(), index); |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 } // namespace bookmark_utils | 323 } // namespace bookmark_utils |
| OLD | NEW |