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

Unified Diff: ui/events/event.cc

Issue 267723008: Retires ui::TranslatedKeyEvent and replaces it with KeyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed AcceleratorControllerTest.MAYBE_ProcessOnce more. Created 6 years, 7 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/events/event.h ('k') | ui/keyboard/keyboard_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 062dfd8c736d5f89f1dee68ea3db1c200b45f50b..3bbae5efc3657ed407cd83c60abf939cbd05aa88 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -586,35 +586,33 @@ void KeyEvent::NormalizeFlags() {
set_flags(flags() & ~mask);
}
-////////////////////////////////////////////////////////////////////////////////
-// TranslatedKeyEvent
-
-TranslatedKeyEvent::TranslatedKeyEvent(const base::NativeEvent& native_event,
- bool is_char)
- : KeyEvent(native_event, is_char) {
- SetType(type() == ET_KEY_PRESSED ?
- ET_TRANSLATED_KEY_PRESS : ET_TRANSLATED_KEY_RELEASE);
-}
-
-TranslatedKeyEvent::TranslatedKeyEvent(bool is_press,
- KeyboardCode key_code,
- int flags)
- : KeyEvent((is_press ? ET_TRANSLATED_KEY_PRESS : ET_TRANSLATED_KEY_RELEASE),
- key_code,
- flags,
- false) {
-}
-
-TranslatedKeyEvent::TranslatedKeyEvent(const KeyEvent& key_event)
- : KeyEvent(key_event) {
- SetType(type() == ET_KEY_PRESSED ?
- ET_TRANSLATED_KEY_PRESS : ET_TRANSLATED_KEY_RELEASE);
- set_is_char(false);
+bool KeyEvent::IsTranslated() const {
+ switch (type()) {
+ case ET_KEY_PRESSED:
+ case ET_KEY_RELEASED:
+ return false;
+ case ET_TRANSLATED_KEY_PRESS:
+ case ET_TRANSLATED_KEY_RELEASE:
+ return true;
+ default:
+ NOTREACHED();
+ return false;
+ }
}
-void TranslatedKeyEvent::ConvertToKeyEvent() {
- SetType(type() == ET_TRANSLATED_KEY_PRESS ?
- ET_KEY_PRESSED : ET_KEY_RELEASED);
+void KeyEvent::SetTranslated(bool translated) {
+ switch (type()) {
+ case ET_KEY_PRESSED:
+ case ET_TRANSLATED_KEY_PRESS:
+ SetType(translated ? ET_TRANSLATED_KEY_PRESS : ET_KEY_PRESSED);
+ break;
+ case ET_KEY_RELEASED:
+ case ET_TRANSLATED_KEY_RELEASE:
+ SetType(translated ? ET_TRANSLATED_KEY_RELEASE : ET_KEY_RELEASED);
+ break;
+ default:
+ NOTREACHED();
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « ui/events/event.h ('k') | ui/keyboard/keyboard_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698