Chromium Code Reviews| 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 base::OffsetAdjuster::Adjustments tmp_adjustments; | |
| 415 return base::i18n::ToLower(net::FormatUrlWithAdjustments( | |
| 413 GURL(TruncateUrl(gurl.spec())), languages, | 416 GURL(TruncateUrl(gurl.spec())), languages, |
| 414 net::kFormatUrlOmitUsernamePassword, | 417 net::kFormatUrlOmitUsernamePassword, |
| 415 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, | 418 net::UnescapeRule::SPACES | net::UnescapeRule::URL_SPECIAL_CHARS, |
| 416 NULL, NULL, NULL)); | 419 NULL, NULL, (adjustments != NULL) ? adjustments : &tmp_adjustments)); |
|
Peter Kasting
2014/04/24 21:00:52
Nit: Could also just write "adjustments ? ..."
Mark P
2014/04/24 23:05:17
Normally I tend to prefer the way I wrote it.
Howe
| |
| 417 } | 420 } |
| 418 | 421 |
| 419 base::string16 CleanUpTitleForMatching(const base::string16& title) { | 422 base::string16 CleanUpTitleForMatching(const base::string16& title) { |
| 420 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength)); | 423 return base::i18n::ToLower(title.substr(0u, kCleanedUpTitleMaxLength)); |
| 421 } | 424 } |
| 422 | 425 |
| 423 } // namespace bookmark_utils | 426 } // namespace bookmark_utils |
| 424 | 427 |
| 425 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { | 428 const BookmarkNode* GetBookmarkNodeByID(const BookmarkModel* model, int64 id) { |
| 426 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. | 429 // TODO(sky): TreeNode needs a method that visits all nodes using a predicate. |
| 427 return GetNodeByID(model->root_node(), id); | 430 return GetNodeByID(model->root_node(), id); |
| 428 } | 431 } |
| OLD | NEW |