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

Side by Side Diff: content/browser/renderer_host/native_web_keyboard_event_aura.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Fix mouse up event sender not modifying modifiers Created 4 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "content/public/browser/native_web_keyboard_event.h" 5 #include "content/public/browser/native_web_keyboard_event.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/events/base_event_utils.h" 8 #include "ui/events/base_event_utils.h"
9 #include "ui/events/blink/web_input_event.h" 9 #include "ui/events/blink/web_input_event.h"
10 #include "ui/events/event.h" 10 #include "ui/events/event.h"
11 11
12 namespace { 12 namespace {
13 13
14 // We need to copy |os_event| in NativeWebKeyboardEvent because it is 14 // We need to copy |os_event| in NativeWebKeyboardEvent because it is
15 // queued in RenderWidgetHost and may be passed and used 15 // queued in RenderWidgetHost and may be passed and used
16 // RenderViewHostDelegate::HandledKeybardEvent after the original aura 16 // RenderViewHostDelegate::HandledKeybardEvent after the original aura
17 // event is destroyed. 17 // event is destroyed.
18 ui::Event* CopyEvent(const ui::Event* event) { 18 ui::Event* CopyEvent(const ui::Event* event) {
19 return event ? ui::Event::Clone(*event).release() : nullptr; 19 return event ? ui::Event::Clone(*event).release() : nullptr;
20 } 20 }
21 21
22 } // namespace 22 } // namespace
23 23
24 using blink::WebKeyboardEvent; 24 using blink::WebKeyboardEvent;
25 25
26 namespace content { 26 namespace content {
27 27
28 NativeWebKeyboardEvent::NativeWebKeyboardEvent() 28 NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type type,
29 : os_event(NULL), 29 int modifiers,
30 skip_in_browser(false) { 30 base::TimeTicks timestamp)
31 } 31 : NativeWebKeyboardEvent(type,
32 modifiers,
33 ui::EventTimeStampToSeconds(timestamp)) {}
34
35 NativeWebKeyboardEvent::NativeWebKeyboardEvent(blink::WebInputEvent::Type type,
36 int modifiers,
37 double timestampSeconds)
38 : WebKeyboardEvent(type, modifiers, timestampSeconds),
39 os_event(NULL),
majidvp 2016/12/19 20:09:52 s/NULL/nullptr/
dtapuska 2016/12/20 19:49:21 Done.
40 skip_in_browser(false) {}
32 41
33 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event) 42 NativeWebKeyboardEvent::NativeWebKeyboardEvent(gfx::NativeEvent native_event)
34 : NativeWebKeyboardEvent(static_cast<ui::KeyEvent&>(*native_event)) { 43 : NativeWebKeyboardEvent(static_cast<ui::KeyEvent&>(*native_event)) {
35 } 44 }
36 45
37 NativeWebKeyboardEvent::NativeWebKeyboardEvent(const ui::KeyEvent& key_event) 46 NativeWebKeyboardEvent::NativeWebKeyboardEvent(const ui::KeyEvent& key_event)
38 : WebKeyboardEvent(ui::MakeWebKeyboardEvent(key_event)), 47 : WebKeyboardEvent(ui::MakeWebKeyboardEvent(key_event)),
39 os_event(CopyEvent(&key_event)), 48 os_event(CopyEvent(&key_event)),
40 skip_in_browser(false) {} 49 skip_in_browser(false) {}
41 50
(...skipping 22 matching lines...) Expand all
64 os_event = CopyEvent(other.os_event); 73 os_event = CopyEvent(other.os_event);
65 skip_in_browser = other.skip_in_browser; 74 skip_in_browser = other.skip_in_browser;
66 return *this; 75 return *this;
67 } 76 }
68 77
69 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() { 78 NativeWebKeyboardEvent::~NativeWebKeyboardEvent() {
70 delete os_event; 79 delete os_event;
71 } 80 }
72 81
73 } // namespace content 82 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698