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

Side by Side Diff: ui/events/mojo/event_struct_traits.cc

Issue 2752093004: Makes KeyEvent struct traits restore Event::time_stamp() field (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 unified diff | Download patch
« no previous file with comments | « ui/events/event.cc ('k') | ui/events/mojo/struct_traits_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mojo/event_struct_traits.h" 5 #include "ui/events/mojo/event_struct_traits.h"
6 6
7 #include "ui/events/event.h" 7 #include "ui/events/event.h"
8 #include "ui/events/event_utils.h" 8 #include "ui/events/event_utils.h"
9 #include "ui/events/keycodes/dom/keycode_converter.h" 9 #include "ui/events/keycodes/dom/keycode_converter.h"
10 #include "ui/events/mojo/event_constants.mojom.h" 10 #include "ui/events/mojo/event_constants.mojom.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 switch (event.action()) { 243 switch (event.action()) {
244 case ui::mojom::EventType::KEY_PRESSED: 244 case ui::mojom::EventType::KEY_PRESSED:
245 case ui::mojom::EventType::KEY_RELEASED: { 245 case ui::mojom::EventType::KEY_RELEASED: {
246 ui::mojom::KeyDataPtr key_data; 246 ui::mojom::KeyDataPtr key_data;
247 if (!event.ReadKeyData<ui::mojom::KeyDataPtr>(&key_data)) 247 if (!event.ReadKeyData<ui::mojom::KeyDataPtr>(&key_data))
248 return false; 248 return false;
249 249
250 if (key_data->is_char) { 250 if (key_data->is_char) {
251 out->reset(new ui::KeyEvent( 251 out->reset(new ui::KeyEvent(
252 static_cast<base::char16>(key_data->character), 252 static_cast<base::char16>(key_data->character),
253 static_cast<ui::KeyboardCode>(key_data->key_code), event.flags())); 253 static_cast<ui::KeyboardCode>(key_data->key_code), event.flags(),
254 base::TimeTicks::FromInternalValue(event.time_stamp())));
254 255
255 } else { 256 } else {
256 out->reset(new ui::KeyEvent( 257 out->reset(new ui::KeyEvent(
257 event.action() == ui::mojom::EventType::KEY_PRESSED 258 event.action() == ui::mojom::EventType::KEY_PRESSED
258 ? ui::ET_KEY_PRESSED 259 ? ui::ET_KEY_PRESSED
259 : ui::ET_KEY_RELEASED, 260 : ui::ET_KEY_RELEASED,
260 static_cast<ui::KeyboardCode>(key_data->key_code), event.flags())); 261 static_cast<ui::KeyboardCode>(key_data->key_code), event.flags(),
262 base::TimeTicks::FromInternalValue(event.time_stamp())));
261 } 263 }
262 break; 264 break;
263 } 265 }
264 case ui::mojom::EventType::POINTER_DOWN: 266 case ui::mojom::EventType::POINTER_DOWN:
265 case ui::mojom::EventType::POINTER_UP: 267 case ui::mojom::EventType::POINTER_UP:
266 case ui::mojom::EventType::POINTER_MOVE: 268 case ui::mojom::EventType::POINTER_MOVE:
267 case ui::mojom::EventType::POINTER_CANCEL: 269 case ui::mojom::EventType::POINTER_CANCEL:
268 case ui::mojom::EventType::MOUSE_EXIT: 270 case ui::mojom::EventType::MOUSE_EXIT:
269 case ui::mojom::EventType::POINTER_WHEEL_CHANGED: { 271 case ui::mojom::EventType::POINTER_WHEEL_CHANGED: {
270 ui::mojom::PointerDataPtr pointer_data; 272 ui::mojom::PointerDataPtr pointer_data;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 return false; 320 return false;
319 } 321 }
320 322
321 if (!out->get()) 323 if (!out->get())
322 return false; 324 return false;
323 325
324 return event.ReadLatency((*out)->latency()); 326 return event.ReadLatency((*out)->latency());
325 } 327 }
326 328
327 } // namespace mojo 329 } // namespace mojo
OLDNEW
« no previous file with comments | « ui/events/event.cc ('k') | ui/events/mojo/struct_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698