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 "chrome/browser/android/blimp/chrome_blimp_client_context_delegate_andr
oid.h" |
| 6 |
| 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/memory/ptr_util.h" |
| 10 #include "chrome/browser/android/blimp/chrome_blimp_client_context_delegate.h" |
| 11 #include "chrome/browser/profiles/profile_android.h" |
| 12 #include "jni/ChromeBlimpClientContextDelegate_jni.h" |
| 13 |
| 14 namespace chrome { |
| 15 |
| 16 // static |
| 17 bool ChromeBlimpClientContextDelegateAndroid::RegisterJni(JNIEnv* env) { |
| 18 return RegisterNativesImpl(env); |
| 19 } |
| 20 |
| 21 // static |
| 22 static jlong Init(JNIEnv* env, |
| 23 const base::android::JavaParamRef<jobject>& jobj, |
| 24 const base::android::JavaParamRef<jobject>& jprofile) { |
| 25 Profile* profile = ProfileAndroid::FromProfileAndroid(jprofile.obj()); |
| 26 return reinterpret_cast<intptr_t>( |
| 27 new ChromeBlimpClientContextDelegateAndroid(env, jobj, profile)); |
| 28 } |
| 29 |
| 30 ChromeBlimpClientContextDelegateAndroid:: |
| 31 ChromeBlimpClientContextDelegateAndroid(JNIEnv* env, |
| 32 jobject jobj, |
| 33 Profile* profile) |
| 34 : ChromeBlimpClientContextDelegate(profile) { |
| 35 java_obj_.Reset(env, jobj); |
| 36 } |
| 37 |
| 38 void ChromeBlimpClientContextDelegateAndroid::Destroy( |
| 39 JNIEnv* env, |
| 40 const base::android::JavaParamRef<jobject>& jobj) { |
| 41 delete this; |
| 42 } |
| 43 |
| 44 ChromeBlimpClientContextDelegateAndroid:: |
| 45 ~ChromeBlimpClientContextDelegateAndroid() { |
| 46 Java_ChromeBlimpClientContextDelegate_clearNativePtr( |
| 47 base::android::AttachCurrentThread(), java_obj_.obj()); |
| 48 } |
| 49 |
| 50 } // namespace chrome |
OLD | NEW |