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

Unified Diff: ui/events/event.cc

Issue 2765773002: Adds KeyEvent::properties (Closed)
Patch Set: Created 3 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: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index f5fd26751b192b89ac48bc99b281b0f9838feba9..6250ebbd2927e14fac40cdc3f955d680936206a2 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -17,6 +17,7 @@
#include <cmath>
#include <cstring>
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
@@ -1203,8 +1204,10 @@ KeyEvent::KeyEvent(const KeyEvent& rhs)
key_code_(rhs.key_code_),
code_(rhs.code_),
is_char_(rhs.is_char_),
- key_(rhs.key_) {
-}
+ key_(rhs.key_),
+ properties_(rhs.properties_
+ ? base::MakeUnique<Properties>(*rhs.properties_)
+ : nullptr) {}
KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) {
if (this != &rhs) {
@@ -1213,6 +1216,10 @@ KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) {
code_ = rhs.code_;
key_ = rhs.key_;
is_char_ = rhs.is_char_;
+ if (rhs.properties_)
+ properties_ = base::MakeUnique<Properties>(*rhs.properties_);
+ else
+ properties_.reset();
}
latency()->set_source_event_type(ui::SourceEventType::OTHER);
return *this;
@@ -1348,6 +1355,10 @@ void KeyEvent::NormalizeFlags() {
set_flags(flags() & ~mask);
}
+void KeyEvent::SetProperties(const Properties& properties) {
+ properties_ = base::MakeUnique<Properties>(properties);
+}
+
KeyboardCode KeyEvent::GetLocatedWindowsKeyboardCode() const {
return NonLocatedToLocatedKeyboardCode(key_code_, code_);
}

Powered by Google App Engine
This is Rietveld 408576698