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

Unified Diff: ui/base/accelerators/accelerator_manager.cc

Issue 2930573005: Use ContainsValue() instead of std::find() in ui/android, ui/base and ui/views (Closed)
Patch Set: Changed EXPECT_FALSE to EXPECT_TRUE 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 | « ui/android/view_android.cc ('k') | ui/base/clipboard/clipboard.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/accelerators/accelerator_manager.cc
diff --git a/ui/base/accelerators/accelerator_manager.cc b/ui/base/accelerators/accelerator_manager.cc
index 7b4308adc20e2ecbcedc68803af181d8bdad2fa5..d5c8a5bec160b499832c1069414b32c9afb0ef9a 100644
--- a/ui/base/accelerators/accelerator_manager.cc
+++ b/ui/base/accelerators/accelerator_manager.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/stl_util.h"
#include "ui/base/accelerators/accelerator_manager_delegate.h"
namespace ui {
@@ -28,7 +29,7 @@ void AcceleratorManager::Register(
for (const ui::Accelerator& accelerator : accelerators) {
AcceleratorTargetList& targets = accelerators_[accelerator].second;
- DCHECK(std::find(targets.begin(), targets.end(), target) == targets.end())
+ DCHECK(!base::ContainsValue(targets, target))
<< "Registering the same target multiple times";
const bool is_first_target_for_accelerator = targets.empty();
@@ -71,9 +72,7 @@ void AcceleratorManager::UnregisterAll(AcceleratorTarget* target) {
for (AcceleratorMap::iterator map_iter = accelerators_.begin();
map_iter != accelerators_.end();) {
AcceleratorTargetList* targets = &map_iter->second.second;
- AcceleratorTargetList::iterator target_iter =
- std::find(targets->begin(), targets->end(), target);
- if (target_iter == targets->end()) {
+ if (!base::ContainsValue(*targets, target)) {
++map_iter;
} else {
auto tmp_iter = map_iter;
« no previous file with comments | « ui/android/view_android.cc ('k') | ui/base/clipboard/clipboard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698