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