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

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

Issue 1076443002: Removed obsolete float_util.h as VS2013 supports standards well enough. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Fixed mistake in value converter. Created 5 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser/renderer_host/input/motion_event_android.h" 5 #include "content/browser/renderer_host/input/motion_event_android.h"
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 8
9 #include <cmath>
10
9 #include "base/android/jni_android.h" 11 #include "base/android/jni_android.h"
10 #include "base/float_util.h"
11 #include "jni/MotionEvent_jni.h" 12 #include "jni/MotionEvent_jni.h"
12 #include "ui/events/event_constants.h" 13 #include "ui/events/event_constants.h"
13 14
14 using base::android::AttachCurrentThread; 15 using base::android::AttachCurrentThread;
15 using namespace JNI_MotionEvent; 16 using namespace JNI_MotionEvent;
16 17
17 namespace content { 18 namespace content {
18 namespace { 19 namespace {
19 20
20 MotionEventAndroid::Action FromAndroidAction(int android_action) { 21 MotionEventAndroid::Action FromAndroidAction(int android_action) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 if ((meta_state & AMETA_CAPS_LOCK_ON) != 0) 86 if ((meta_state & AMETA_CAPS_LOCK_ON) != 0)
86 flags |= ui::EF_CAPS_LOCK_DOWN; 87 flags |= ui::EF_CAPS_LOCK_DOWN;
87 return flags; 88 return flags;
88 } 89 }
89 90
90 base::TimeTicks FromAndroidTime(int64 time_ms) { 91 base::TimeTicks FromAndroidTime(int64 time_ms) {
91 return base::TimeTicks() + base::TimeDelta::FromMilliseconds(time_ms); 92 return base::TimeTicks() + base::TimeDelta::FromMilliseconds(time_ms);
92 } 93 }
93 94
94 float ToValidFloat(float x) { 95 float ToValidFloat(float x) {
95 if (base::IsNaN(x)) 96 if (std::isnan(x))
96 return 0.f; 97 return 0.f;
97 98
98 // Wildly large orientation values have been observed in the wild after device 99 // Wildly large orientation values have been observed in the wild after device
99 // rotation. There's not much we can do in that case other than simply 100 // rotation. There's not much we can do in that case other than simply
100 // sanitize results beyond an absurd and arbitrary threshold. 101 // sanitize results beyond an absurd and arbitrary threshold.
101 if (std::abs(x) > 1e5f) 102 if (std::abs(x) > 1e5f)
102 return 0.f; 103 return 0.f;
103 104
104 return x; 105 return x;
105 } 106 }
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 result.tool_type = FromAndroidToolType(pointer.tool_type); 333 result.tool_type = FromAndroidToolType(pointer.tool_type);
333 return result; 334 return result;
334 } 335 }
335 336
336 // static 337 // static
337 bool MotionEventAndroid::RegisterMotionEventAndroid(JNIEnv* env) { 338 bool MotionEventAndroid::RegisterMotionEventAndroid(JNIEnv* env) {
338 return JNI_MotionEvent::RegisterNativesImpl(env); 339 return JNI_MotionEvent::RegisterNativesImpl(env);
339 } 340 }
340 341
341 } // namespace content 342 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698