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

Unified Diff: ui/ozone/platform/caca/caca_event_source.cc

Issue 1878083002: Implement IsAsciiUpper and IsAsciiLower in base/strings/string_util.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git sync 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: ui/ozone/platform/caca/caca_event_source.cc
diff --git a/ui/ozone/platform/caca/caca_event_source.cc b/ui/ozone/platform/caca/caca_event_source.cc
index c6255c850a3a2de87a13000769369a38b6060b66..b430a8fec2a281f9dec798c65d211fb40fcf9846 100644
--- a/ui/ozone/platform/caca/caca_event_source.cc
+++ b/ui/ozone/platform/caca/caca_event_source.cc
@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
+#include "base/strings/string_util.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h"
@@ -74,7 +75,7 @@ ui::KeyboardCode GetKeyboardCode(const caca_event_t& event) {
};
int key_code = caca_get_event_key_ch(&event);
- if (key_code >= 'a' && key_code <= 'z')
+ if (base::IsAsciiLower(key_code))
return static_cast<ui::KeyboardCode>(key_code - ('a' - 'A'));
if (key_code >= '0' && key_code <= 'Z')
return static_cast<ui::KeyboardCode>(key_code);
@@ -86,7 +87,7 @@ ui::KeyboardCode GetKeyboardCode(const caca_event_t& event) {
int ModifierFromKey(const caca_event_t& event) {
int key_code = caca_get_event_key_ch(&event);
- if (key_code >= 'A' && key_code <= 'Z')
+ if (base::IsAsciiUpper(key_code))
return ui::EF_SHIFT_DOWN;
if ((key_code >= CACA_KEY_CTRL_A && key_code <= CACA_KEY_CTRL_G) ||
(key_code >= CACA_KEY_CTRL_J && key_code <= CACA_KEY_CTRL_L) ||

Powered by Google App Engine
This is Rietveld 408576698