OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/device_orientation/data_fetcher_impl_android.h" | 5 #include "content/browser/device_orientation/data_fetcher_impl_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/browser/device_orientation/orientation.h" | 11 #include "content/browser/device_orientation/orientation.h" |
12 #include "jni/DeviceOrientation_jni.h" | 12 #include "jni/DeviceOrientation_jni.h" |
13 | 13 |
14 using base::android::AttachCurrentThread; | 14 using base::android::AttachCurrentThread; |
15 using base::android::CheckException; | 15 using base::android::CheckException; |
16 using base::android::GetClass; | 16 using base::android::GetClass; |
17 using base::android::GetMethodID; | |
18 using base::android::ScopedJavaGlobalRef; | 17 using base::android::ScopedJavaGlobalRef; |
19 using base::android::ScopedJavaLocalRef; | 18 using base::android::ScopedJavaLocalRef; |
20 | 19 |
21 namespace content { | 20 namespace content { |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 // This should match ProviderImpl::kDesiredSamplingIntervalMs. | 24 // This should match ProviderImpl::kDesiredSamplingIntervalMs. |
26 // TODO(husky): Make that constant public so we can use it directly. | 25 // TODO(husky): Make that constant public so we can use it directly. |
27 const int kPeriodInMilliseconds = 100; | 26 const int kPeriodInMilliseconds = 100; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 reinterpret_cast<jint>(this), | 92 reinterpret_cast<jint>(this), |
94 rate_in_milliseconds); | 93 rate_in_milliseconds); |
95 } | 94 } |
96 | 95 |
97 void DataFetcherImplAndroid::Stop() { | 96 void DataFetcherImplAndroid::Stop() { |
98 DCHECK(!g_jni_obj.Get().is_null()); | 97 DCHECK(!g_jni_obj.Get().is_null()); |
99 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj()); | 98 Java_DeviceOrientation_stop(AttachCurrentThread(), g_jni_obj.Get().obj()); |
100 } | 99 } |
101 | 100 |
102 } // namespace content | 101 } // namespace content |
OLD | NEW |