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

Unified Diff: chrome/browser/ui/toolbar/toolbar_actions_model.cc

Issue 1715683002: chrome: Use base's ContainsValue helper function instead of std::find (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated as per latest code Created 4 years, 8 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
Index: chrome/browser/ui/toolbar/toolbar_actions_model.cc
diff --git a/chrome/browser/ui/toolbar/toolbar_actions_model.cc b/chrome/browser/ui/toolbar/toolbar_actions_model.cc
index d0941201c8687a9ce7ed060f6dc1e7d3321012ad..bea6022ee468bbdc6267b1be4e8d357b8312e15a 100644
--- a/chrome/browser/ui/toolbar/toolbar_actions_model.cc
+++ b/chrome/browser/ui/toolbar/toolbar_actions_model.cc
@@ -11,6 +11,7 @@
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_base.h"
#include "base/single_thread_task_runner.h"
+#include "base/stl_util.h"
#include "base/thread_task_runner_handle.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/component_migration_helper.h"
@@ -321,8 +322,7 @@ void ToolbarActionsModel::AddItem(const ToolbarItem& item, bool is_component) {
// See if we have a last known good position for this extension.
bool is_new_extension =
- std::find(last_known_positions_.begin(), last_known_positions_.end(),
- item.id) == last_known_positions_.end();
+ !ContainsValue(last_known_positions_, item.id);
// New extensions go at the right (end) of the visible extensions. Other
// extensions go at their previous position.
@@ -565,8 +565,7 @@ void ToolbarActionsModel::Populate() {
}
bool ToolbarActionsModel::HasItem(const ToolbarItem& item) const {
- return std::find(toolbar_items_.begin(), toolbar_items_.end(), item) !=
- toolbar_items_.end();
+ return ContainsValue(toolbar_items_, item);
}
bool ToolbarActionsModel::HasComponentAction(
@@ -689,8 +688,7 @@ void ToolbarActionsModel::OnActionToolbarPrefChange() {
std::vector<std::string> pref_positions = extension_prefs_->GetToolbarOrder();
size_t pref_position_size = pref_positions.size();
for (size_t i = 0; i < last_known_positions_.size(); ++i) {
- if (std::find(pref_positions.begin(), pref_positions.end(),
- last_known_positions_[i]) == pref_positions.end()) {
+ if (!ContainsValue(pref_positions, last_known_positions_[i])) {
pref_positions.push_back(last_known_positions_[i]);
}
}

Powered by Google App Engine
This is Rietveld 408576698