OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/events/event.h" | 5 #include "ui/events/event.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 | 10 |
(...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1040 is_char_(true), | 1040 is_char_(true), |
1041 key_(DomKey::FromCharacter(character)) { | 1041 key_(DomKey::FromCharacter(character)) { |
1042 } | 1042 } |
1043 | 1043 |
1044 KeyEvent::KeyEvent(const KeyEvent& rhs) | 1044 KeyEvent::KeyEvent(const KeyEvent& rhs) |
1045 : Event(rhs), | 1045 : Event(rhs), |
1046 key_code_(rhs.key_code_), | 1046 key_code_(rhs.key_code_), |
1047 code_(rhs.code_), | 1047 code_(rhs.code_), |
1048 is_char_(rhs.is_char_), | 1048 is_char_(rhs.is_char_), |
1049 key_(rhs.key_) { | 1049 key_(rhs.key_) { |
1050 if (rhs.extended_key_event_data_) | |
1051 extended_key_event_data_.reset(rhs.extended_key_event_data_->Clone()); | |
1052 } | 1050 } |
1053 | 1051 |
1054 KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) { | 1052 KeyEvent& KeyEvent::operator=(const KeyEvent& rhs) { |
1055 if (this != &rhs) { | 1053 if (this != &rhs) { |
1056 Event::operator=(rhs); | 1054 Event::operator=(rhs); |
1057 key_code_ = rhs.key_code_; | 1055 key_code_ = rhs.key_code_; |
1058 code_ = rhs.code_; | 1056 code_ = rhs.code_; |
1059 key_ = rhs.key_; | 1057 key_ = rhs.key_; |
1060 is_char_ = rhs.is_char_; | 1058 is_char_ = rhs.is_char_; |
1061 | |
1062 if (rhs.extended_key_event_data_) | |
1063 extended_key_event_data_.reset(rhs.extended_key_event_data_->Clone()); | |
1064 } | 1059 } |
1065 return *this; | 1060 return *this; |
1066 } | 1061 } |
1067 | 1062 |
1068 KeyEvent::~KeyEvent() {} | 1063 KeyEvent::~KeyEvent() {} |
1069 | 1064 |
1070 void KeyEvent::SetExtendedKeyEventData( | |
1071 std::unique_ptr<ExtendedKeyEventData> data) { | |
1072 extended_key_event_data_ = std::move(data); | |
1073 } | |
1074 | |
1075 void KeyEvent::ApplyLayout() const { | 1065 void KeyEvent::ApplyLayout() const { |
1076 ui::DomCode code = code_; | 1066 ui::DomCode code = code_; |
1077 if (code == DomCode::NONE) { | 1067 if (code == DomCode::NONE) { |
1078 // Catch old code that tries to do layout without a physical key, and try | 1068 // Catch old code that tries to do layout without a physical key, and try |
1079 // to recover using the KeyboardCode. Once key events are fully defined | 1069 // to recover using the KeyboardCode. Once key events are fully defined |
1080 // on construction (see TODO in event.h) this will go away. | 1070 // on construction (see TODO in event.h) this will go away. |
1081 VLOG(2) << "DomCode::NONE keycode=" << key_code_; | 1071 VLOG(2) << "DomCode::NONE keycode=" << key_code_; |
1082 code = UsLayoutKeyboardCodeToDomCode(key_code_); | 1072 code = UsLayoutKeyboardCodeToDomCode(key_code_); |
1083 if (code == DomCode::NONE) { | 1073 if (code == DomCode::NONE) { |
1084 key_ = DomKey::UNIDENTIFIED; | 1074 key_ = DomKey::UNIDENTIFIED; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 gfx::PointF(x, y), | 1274 gfx::PointF(x, y), |
1285 time_stamp, | 1275 time_stamp, |
1286 flags | EF_FROM_TOUCH), | 1276 flags | EF_FROM_TOUCH), |
1287 details_(details), | 1277 details_(details), |
1288 unique_touch_event_id_(unique_touch_event_id) {} | 1278 unique_touch_event_id_(unique_touch_event_id) {} |
1289 | 1279 |
1290 GestureEvent::~GestureEvent() { | 1280 GestureEvent::~GestureEvent() { |
1291 } | 1281 } |
1292 | 1282 |
1293 } // namespace ui | 1283 } // namespace ui |
OLD | NEW |