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 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 | 399 |
400 // Remove all the bookmarks. | 400 // Remove all the bookmarks. |
401 for (size_t i = 0; i < bookmarks.size(); ++i) { | 401 for (size_t i = 0; i < bookmarks.size(); ++i) { |
402 const BookmarkNode* node = bookmarks[i]; | 402 const BookmarkNode* node = bookmarks[i]; |
403 int index = node->parent()->GetIndexOf(node); | 403 int index = node->parent()->GetIndexOf(node); |
404 if (index > -1) | 404 if (index > -1) |
405 model->Remove(node->parent(), index); | 405 model->Remove(node->parent(), index); |
406 } | 406 } |
407 } | 407 } |
408 | 408 |
409 base::string16 CleanUpUrlForMatching(const GURL& gurl, | 409 base::string16 CleanUpUrlForMatching( |
410 const std::string& languages) { | 410 const GURL& gurl, |
411 return base::i18n::ToLower(net::FormatUrl( | 411 const std::string& languages, |
| 412 base::OffsetAdjuster::Adjustments* adjustments) { |
| 413 base::OffsetAdjuster::Adjustments tmp_adjustments; |
| 414 return base::i18n::ToLower(net::FormatUrlWithAdjustments( |
412 GURL(TruncateUrl(gurl.spec())), languages, | 415 GURL(TruncateUrl(gurl.spec())), languages, |
413 net::kFormatUrlOmitUsernamePassword, | 416 net::kFormatUrlOmitUsernamePassword, |
414 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, | 417 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, |
415 NULL, NULL, NULL)); | 418 NULL, NULL, adjustments ? adjustments : &tmp_adjustments)); |
416 } | 419 } |
417 | 420 |
418 base::string16 CleanUpTitleForMatching(const base::string16& title) { | 421 base::string16 CleanUpTitleForMatching(const base::string16& title) { |
419 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength)); | 422 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength)); |
420 } | 423 } |
421 | 424 |
422 } // namespace bookmark_utils | 425 } // namespace bookmark_utils |
423 | 426 |
424 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { | 427 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { |
425 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. | 428 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. |
426 return GetNodeByID(model->root_node(), id); | 429 return GetNodeByID(model->root_node(), id); |
427 } | 430 } |
OLD | NEW |