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

Side by Side Diff: content/browser/renderer_host/input/web_input_event_util.cc

Issue 1331013004: [KeyEvent Mac] Move WebInputEventFactory into chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove forward declare as the bot got updated Created 5 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include "content/browser/renderer_host/input/web_input_event_util.h" 8 #include "content/browser/renderer_host/input/web_input_event_util.h"
9 9
10 #include <cmath> 10 #include <cmath>
11 11
12 #include "base/strings/string_util.h" 12 #include "base/strings/string_util.h"
13 #include "content/common/input/web_touch_event_traits.h" 13 #include "content/common/input/web_touch_event_traits.h"
14 #include "ui/events/blink/blink_event_util.h" 14 #include "ui/events/blink/blink_event_util.h"
15 #include "ui/events/event_constants.h" 15 #include "ui/events/event_constants.h"
16 #include "ui/events/gesture_detection/gesture_event_data.h" 16 #include "ui/events/gesture_detection/gesture_event_data.h"
17 #include "ui/events/gesture_detection/motion_event.h" 17 #include "ui/events/gesture_detection/motion_event.h"
18 #include "ui/events/keycodes/dom/keycode_converter.h"
18 #include "ui/gfx/geometry/safe_integer_conversions.h" 19 #include "ui/gfx/geometry/safe_integer_conversions.h"
19 20
20 using blink::WebGestureEvent; 21 using blink::WebGestureEvent;
21 using blink::WebInputEvent; 22 using blink::WebInputEvent;
22 using blink::WebTouchEvent; 23 using blink::WebTouchEvent;
23 using blink::WebTouchPoint; 24 using blink::WebTouchPoint;
24 using ui::MotionEvent; 25 using ui::MotionEvent;
25 26
26 namespace { 27 namespace {
27 28
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 if (modifiers & blink::WebInputEvent::RightButtonDown) 181 if (modifiers & blink::WebInputEvent::RightButtonDown)
181 flags |= ui::EF_RIGHT_MOUSE_BUTTON; 182 flags |= ui::EF_RIGHT_MOUSE_BUTTON;
182 if (modifiers & blink::WebInputEvent::CapsLockOn) 183 if (modifiers & blink::WebInputEvent::CapsLockOn)
183 flags |= ui::EF_CAPS_LOCK_DOWN; 184 flags |= ui::EF_CAPS_LOCK_DOWN;
184 if (modifiers & blink::WebInputEvent::IsAutoRepeat) 185 if (modifiers & blink::WebInputEvent::IsAutoRepeat)
185 flags |= ui::EF_IS_REPEAT; 186 flags |= ui::EF_IS_REPEAT;
186 187
187 return flags; 188 return flags;
188 } 189 }
189 190
191 blink::WebInputEvent::Modifiers DomCodeToWebInputEventModifiers(
192 ui::DomCode code) {
193 switch (ui::KeycodeConverter::DomCodeToLocation(code)) {
194 case ui::DomKeyLocation::LEFT:
195 return blink::WebInputEvent::IsLeft;
196 case ui::DomKeyLocation::RIGHT:
197 return blink::WebInputEvent::IsRight;
198 case ui::DomKeyLocation::NUMPAD:
199 return blink::WebInputEvent::IsKeyPad;
200 case ui::DomKeyLocation::STANDARD:
201 break;
202 }
203 return static_cast<blink::WebInputEvent::Modifiers>(0);
204 }
205
190 } // namespace content 206 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698