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

Side by Side Diff: components/arc/input/arc_input_bridge_impl.h

Issue 1523643002: arc-bridge: Move most methods to Mojo interfaces (Closed) Base URL: https://chromium.googlesource.com/a/chromium/src.git@master
Patch Set: Rebased to ToT Created 5 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
« no previous file with comments | « components/arc/common/settings.mojom ('k') | components/arc/input/arc_input_bridge_impl.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef COMPONENTS_EXO_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_ 5 #ifndef COMPONENTS_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_
6 #define COMPONENTS_EXO_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_ 6 #define COMPONENTS_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_
7
8 #include <stdint.h>
9 #include <string>
10 #include <vector>
7 11
8 #include "base/files/scoped_file.h" 12 #include "base/files/scoped_file.h"
9 #include "base/macros.h" 13 #include "base/macros.h"
10 #include "components/arc/input/arc_input_bridge.h" 14 #include "components/arc/input/arc_input_bridge.h"
11 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
12 #include "ui/aura/env_observer.h" 16 #include "ui/aura/env_observer.h"
13 #include "ui/aura/window_tracker.h" 17 #include "ui/aura/window_tracker.h"
14 #include "ui/events/event.h" 18 #include "ui/events/event.h"
15 #include "ui/events/event_handler.h" 19 #include "ui/events/event_handler.h"
16 20
(...skipping 21 matching lines...) Expand all
38 explicit ArcInputBridgeImpl(ArcBridgeService* arc_bridge_service); 42 explicit ArcInputBridgeImpl(ArcBridgeService* arc_bridge_service);
39 ~ArcInputBridgeImpl() override; 43 ~ArcInputBridgeImpl() override;
40 44
41 // Overridden from ui::EventHandler: 45 // Overridden from ui::EventHandler:
42 void OnEvent(ui::Event* event) override; 46 void OnEvent(ui::Event* event) override;
43 47
44 // Overridden from aura::EnvObserver: 48 // Overridden from aura::EnvObserver:
45 void OnWindowInitialized(aura::Window* new_window) override; 49 void OnWindowInitialized(aura::Window* new_window) override;
46 50
47 // Overridden from ArcBridgeService::Observer: 51 // Overridden from ArcBridgeService::Observer:
48 void OnInstanceBootPhase(InstanceBootPhase phase) override; 52 void OnInputInstanceReady() override;
49 53
50 private: 54 private:
51 // Specialized method to translate and send events to the right file 55 // Specialized method to translate and send events to the right file
52 // descriptor. 56 // descriptor.
53 void SendKeyEvent(ui::KeyEvent* event); 57 void SendKeyEvent(ui::KeyEvent* event);
54 void SendTouchEvent(ui::TouchEvent* event); 58 void SendTouchEvent(ui::TouchEvent* event);
55 void SendMouseEvent(ui::MouseEvent* event); 59 void SendMouseEvent(ui::MouseEvent* event);
56 60
57 // Helper method to send a struct input_event to the file descriptor. This 61 // Helper method to send a struct input_event to the file descriptor. This
58 // method is to be called on the ui thread and will post a request to send 62 // method is to be called on the ui thread and will post a request to send
59 // the event to the io thread. 63 // the event to the io thread.
60 // The parameters map directly to the members of input_event as 64 // The parameters map directly to the members of input_event as
61 // defined by the evdev protocol. 65 // defined by the evdev protocol.
62 // |type| is the type of event to sent, such as EV_SYN, EV_KEY, EV_ABS. 66 // |type| is the type of event to sent, such as EV_SYN, EV_KEY, EV_ABS.
63 // |code| is either interpreted as axis (ABS_X, ABS_Y, ...) or as key-code 67 // |code| is either interpreted as axis (ABS_X, ABS_Y, ...) or as key-code
64 // (KEY_A, KEY_B, ...). 68 // (KEY_A, KEY_B, ...).
65 // |value| is either the value of that axis or the boolean value of the key 69 // |value| is either the value of that axis or the boolean value of the key
66 // as in 0 (released), 1 (pressed) or 2 (repeated press). 70 // as in 0 (released), 1 (pressed) or 2 (repeated press).
67 void SendKernelEvent(const base::ScopedFD& fd, 71 void SendKernelEvent(const base::ScopedFD& fd,
68 base::TimeDelta timestamp, 72 base::TimeDelta timestamp,
69 unsigned short type, 73 uint16_t type,
70 unsigned short code, 74 uint16_t code,
71 int value); 75 int value);
72 76
73 // Shorthand for sending EV_SYN/SYN_REPORT 77 // Shorthand for sending EV_SYN/SYN_REPORT
74 void SendSynReport(const base::ScopedFD& fd, base::TimeDelta timestamp); 78 void SendSynReport(const base::ScopedFD& fd, base::TimeDelta timestamp);
75 79
76 // Return existing or new slot for this event. 80 // Return existing or new slot for this event.
77 int AcquireTouchSlot(ui::TouchEvent* event); 81 int AcquireTouchSlot(ui::TouchEvent* event);
78 82
79 // Return touch slot for tracking id. 83 // Return touch slot for tracking id.
80 int FindTouchSlot(int tracking_id); 84 int FindTouchSlot(int tracking_id);
81 85
82 // Maps DOM key codes to evdev key codes 86 // Maps DOM key codes to evdev key codes
83 unsigned short DomCodeToEvdevCode(ui::DomCode dom_code); 87 uint16_t DomCodeToEvdevCode(ui::DomCode dom_code);
84
85 88
86 // Setup bridge devices on the instance side. This needs to be called after 89 // Setup bridge devices on the instance side. This needs to be called after
87 // the InstanceBootPhase::SYSTEM_SERVICES_READY has been reached. 90 // the InstanceBootPhase::SYSTEM_SERVICES_READY has been reached.
88 void SetupBridgeDevices(); 91 void SetupBridgeDevices();
89 92
90 // Creates and registers file descriptor pair with the ARC bridge service, 93 // Creates and registers file descriptor pair with the ARC bridge service,
91 // the write end is returned while the read end is sent through the bridge 94 // the write end is returned while the read end is sent through the bridge
92 // to the ARC instance. 95 // to the ARC instance.
93 // TODO(denniskempin): Make this interface more typesafe. 96 // TODO(denniskempin): Make this interface more typesafe.
94 // |name| should be the displayable name of the emulated device (e.g. "Chrome 97 // |name| should be the displayable name of the emulated device (e.g. "Chrome
(...skipping 28 matching lines...) Expand all
123 aura::WindowTracker arc_windows_; 126 aura::WindowTracker arc_windows_;
124 127
125 // WeakPtrFactory to use for callbacks. 128 // WeakPtrFactory to use for callbacks.
126 base::WeakPtrFactory<ArcInputBridgeImpl> weak_factory_; 129 base::WeakPtrFactory<ArcInputBridgeImpl> weak_factory_;
127 130
128 DISALLOW_COPY_AND_ASSIGN(ArcInputBridgeImpl); 131 DISALLOW_COPY_AND_ASSIGN(ArcInputBridgeImpl);
129 }; 132 };
130 133
131 } // namespace arc 134 } // namespace arc
132 135
133 #endif // COMPONENTS_EXO_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_ 136 #endif // COMPONENTS_ARC_INPUT_ARC_INPUT_BRIDGE_IMPL_H_
OLDNEW
« no previous file with comments | « components/arc/common/settings.mojom ('k') | components/arc/input/arc_input_bridge_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698