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

Unified Diff: chrome/browser/ui/input_method/input_method_engine.cc

Issue 2947593005: Use ContainsValue() instead of std::find() in chrome/browser/ui/ (Closed)
Patch Set: 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
Index: chrome/browser/ui/input_method/input_method_engine.cc
diff --git a/chrome/browser/ui/input_method/input_method_engine.cc b/chrome/browser/ui/input_method/input_method_engine.cc
index 2b459df37f055763f1b43e47911cabbeb2d259dd..8ebbd4bd3aec31a7065b9c2cc3fc7e8262add3b8 100644
--- a/chrome/browser/ui/input_method/input_method_engine.cc
+++ b/chrome/browser/ui/input_method/input_method_engine.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "chrome/browser/ui/input_method/input_method_engine.h"
+#include "base/stl_util.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
@@ -268,16 +269,14 @@ bool InputMethodEngine::IsValidKeyForAllPages(ui::KeyEvent* ui_event) {
ui::VKEY_RETURN};
if (ui_event->GetDomKey().IsCharacter() && !ui_event->IsControlDown() &&
!ui_event->IsCommandDown()) {
- return std::find(invalid_character_keycodes.begin(),
- invalid_character_keycodes.end(),
- ui_event->key_code()) == invalid_character_keycodes.end();
+ return !base::ContainsValue(invalid_character_keycodes,
+ ui_event->key_code());
}
// Whitelists Backspace key and arrow keys.
std::vector<ui::KeyboardCode> whitelist_keycodes{
ui::VKEY_BACK, ui::VKEY_LEFT, ui::VKEY_RIGHT, ui::VKEY_UP, ui::VKEY_DOWN};
- return std::find(whitelist_keycodes.begin(), whitelist_keycodes.end(),
- ui_event->key_code()) != whitelist_keycodes.end();
+ return base::ContainsValue(whitelist_keycodes, ui_event->key_code());
}
} // namespace input_method

Powered by Google App Engine
This is Rietveld 408576698