OLD | NEW |
| (Empty) |
1 // Copyright 2016 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 "blimp/client/core/settings/android/settings_android.h" | |
6 | |
7 #include "base/android/jni_android.h" | |
8 #include "jni/Settings_jni.h" | |
9 | |
10 namespace blimp { | |
11 namespace client { | |
12 | |
13 // static | |
14 bool SettingsAndroid::RegisterJni(JNIEnv* env) { | |
15 return RegisterNativesImpl(env); | |
16 } | |
17 | |
18 // static | |
19 SettingsAndroid* SettingsAndroid::FromJavaObject( | |
20 JNIEnv* env, | |
21 const base::android::JavaRef<jobject>& jobj) { | |
22 return reinterpret_cast<SettingsAndroid*>( | |
23 Java_Settings_getNativePtr(env, jobj)); | |
24 } | |
25 | |
26 base::android::ScopedJavaLocalRef<jobject> SettingsAndroid::GetJavaObject() { | |
27 return base::android::ScopedJavaLocalRef<jobject>(java_obj_); | |
28 } | |
29 | |
30 SettingsAndroid::SettingsAndroid(PrefService* local_state) | |
31 : Settings(local_state) { | |
32 JNIEnv* env = base::android::AttachCurrentThread(); | |
33 java_obj_.Reset( | |
34 env, Java_Settings_create(env, reinterpret_cast<intptr_t>(this)).obj()); | |
35 } | |
36 | |
37 SettingsAndroid::~SettingsAndroid() { | |
38 Java_Settings_onNativeDestroyed(base::android::AttachCurrentThread(), | |
39 java_obj_); | |
40 } | |
41 | |
42 void SettingsAndroid::SetEnableBlimpModeWrap(JNIEnv* env, | |
43 jobject jobj, | |
44 bool enable) { | |
45 SetEnableBlimpMode(enable); | |
46 } | |
47 | |
48 void SettingsAndroid::SetRecordWholeDocumentWrap(JNIEnv* env, | |
49 jobject jobj, | |
50 bool enable) { | |
51 SetRecordWholeDocument(enable); | |
52 } | |
53 | |
54 void SettingsAndroid::SetShowNetworkStatsWrap(JNIEnv* env, | |
55 jobject jobj, | |
56 bool enable) { | |
57 SetShowNetworkStats(enable); | |
58 } | |
59 | |
60 } // namespace client | |
61 } // namespace blimp | |
OLD | NEW |