Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1450)

Unified Diff: ios/chrome/browser/bookmarks/bookmarks_utils.cc

Issue 2945803002: Use ContainsValue() instead of std::find() in ios/ (Closed)
Patch Set: Fixed compilation error. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ios/chrome/browser/passwords/password_generation_agent.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/bookmarks/bookmarks_utils.cc
diff --git a/ios/chrome/browser/bookmarks/bookmarks_utils.cc b/ios/chrome/browser/bookmarks/bookmarks_utils.cc
index a7ece33186c047547a51343b61d6793d414e3911..82a8036cc6036ceccf554ba082b600439ae9dcd9 100644
--- a/ios/chrome/browser/bookmarks/bookmarks_utils.cc
+++ b/ios/chrome/browser/bookmarks/bookmarks_utils.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
+#include "base/stl_util.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/prefs/pref_service.h"
#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h"
@@ -72,11 +73,7 @@ std::vector<const BookmarkNode*> RootLevelFolders(BookmarkModel* model) {
bool IsPrimaryPermanentNode(const BookmarkNode* node, BookmarkModel* model) {
std::vector<const BookmarkNode*> primary_nodes(PrimaryPermanentNodes(model));
- if (std::find(primary_nodes.begin(), primary_nodes.end(), node) !=
- primary_nodes.end()) {
- return true;
- }
- return false;
+ return base::ContainsValue(primary_nodes, node);
}
const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node,
@@ -88,9 +85,7 @@ const BookmarkNode* RootLevelFolderForNode(const BookmarkNode* node,
const std::vector<const BookmarkNode*> root_folders(RootLevelFolders(model));
const BookmarkNode* top = node;
- while (top &&
- std::find(root_folders.begin(), root_folders.end(), top) ==
- root_folders.end()) {
+ while (top && !base::ContainsValue(root_folders, top)) {
top = top->parent();
}
return top;
« no previous file with comments | « no previous file | ios/chrome/browser/passwords/password_generation_agent.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698