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

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: Removing non ContainsValue changes Created 4 years, 9 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 6a6f6afb28739cf80dcda7c9b70ca0ae93be2838..672a7baab48500794a160275f245945d3d54a581 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"
@@ -332,8 +333,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.
@@ -576,8 +576,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(
@@ -700,8 +699,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