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

Side by Side Diff: ppapi/shared_impl/ppb_input_event_shared.cc

Issue 8824015: Revert 113290 - Rename the shared_impl resource files to give them more regular names. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/ppb_input_event_shared.h ('k') | ppapi/shared_impl/ppb_instance_shared.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ppapi/shared_impl/ppb_input_event_shared.h"
6
7 #include "ppapi/shared_impl/ppapi_globals.h"
8 #include "ppapi/shared_impl/var.h"
9
10 using ppapi::thunk::PPB_InputEvent_API;
11
12 namespace ppapi {
13
14 InputEventData::InputEventData()
15 : is_filtered(false),
16 event_type(PP_INPUTEVENT_TYPE_UNDEFINED),
17 event_time_stamp(0.0),
18 event_modifiers(0),
19 mouse_button(PP_INPUTEVENT_MOUSEBUTTON_NONE),
20 mouse_position(PP_MakePoint(0, 0)),
21 mouse_click_count(0),
22 mouse_movement(PP_MakePoint(0, 0)),
23 wheel_delta(PP_MakeFloatPoint(0.0f, 0.0f)),
24 wheel_ticks(PP_MakeFloatPoint(0.0f, 0.0f)),
25 wheel_scroll_by_page(false),
26 key_code(0),
27 character_text(),
28 composition_target_segment(-1),
29 composition_selection_start(0),
30 composition_selection_end(0) {
31 }
32
33 InputEventData::~InputEventData() {
34 }
35
36 PPB_InputEvent_Shared::PPB_InputEvent_Shared(const InitAsImpl&,
37 PP_Instance instance,
38 const InputEventData& data)
39 : Resource(instance),
40 data_(data) {
41 }
42
43 PPB_InputEvent_Shared::PPB_InputEvent_Shared(const InitAsProxy&,
44 PP_Instance instance,
45 const InputEventData& data)
46 : Resource(HostResource::MakeInstanceOnly(instance)),
47 data_(data) {
48 }
49
50 PPB_InputEvent_API* PPB_InputEvent_Shared::AsPPB_InputEvent_API() {
51 return this;
52 }
53
54 const InputEventData& PPB_InputEvent_Shared::GetInputEventData() const {
55 return data_;
56 }
57
58 PP_InputEvent_Type PPB_InputEvent_Shared::GetType() {
59 return data_.event_type;
60 }
61
62 PP_TimeTicks PPB_InputEvent_Shared::GetTimeStamp() {
63 return data_.event_time_stamp;
64 }
65
66 uint32_t PPB_InputEvent_Shared::GetModifiers() {
67 return data_.event_modifiers;
68 }
69
70 PP_InputEvent_MouseButton PPB_InputEvent_Shared::GetMouseButton() {
71 return data_.mouse_button;
72 }
73
74 PP_Point PPB_InputEvent_Shared::GetMousePosition() {
75 return data_.mouse_position;
76 }
77
78 int32_t PPB_InputEvent_Shared::GetMouseClickCount() {
79 return data_.mouse_click_count;
80 }
81
82 PP_Point PPB_InputEvent_Shared::GetMouseMovement() {
83 return data_.mouse_movement;
84 }
85
86 PP_FloatPoint PPB_InputEvent_Shared::GetWheelDelta() {
87 return data_.wheel_delta;
88 }
89
90 PP_FloatPoint PPB_InputEvent_Shared::GetWheelTicks() {
91 return data_.wheel_ticks;
92 }
93
94 PP_Bool PPB_InputEvent_Shared::GetWheelScrollByPage() {
95 return PP_FromBool(data_.wheel_scroll_by_page);
96 }
97
98 uint32_t PPB_InputEvent_Shared::GetKeyCode() {
99 return data_.key_code;
100 }
101
102 PP_Var PPB_InputEvent_Shared::GetCharacterText() {
103 return StringVar::StringToPPVar(
104 PpapiGlobals::Get()->GetModuleForInstance(pp_instance()),
105 data_.character_text);
106 }
107
108 uint32_t PPB_InputEvent_Shared::GetIMESegmentNumber() {
109 if (data_.composition_segment_offsets.empty())
110 return 0;
111 return data_.composition_segment_offsets.size() - 1;
112 }
113
114 uint32_t PPB_InputEvent_Shared::GetIMESegmentOffset(uint32_t index) {
115 if (index >= data_.composition_segment_offsets.size())
116 return 0;
117 return data_.composition_segment_offsets[index];
118 }
119
120 int32_t PPB_InputEvent_Shared::GetIMETargetSegment() {
121 return data_.composition_target_segment;
122 }
123
124 void PPB_InputEvent_Shared::GetIMESelection(uint32_t* start, uint32_t* end) {
125 if (start)
126 *start = data_.composition_selection_start;
127 if (end)
128 *end = data_.composition_selection_end;
129 }
130
131 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/shared_impl/ppb_input_event_shared.h ('k') | ppapi/shared_impl/ppb_instance_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698