OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 "blimp/client/core/android/blimp_client_context_impl_android.h" | 5 #include "blimp/client/core/android/blimp_client_context_impl_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "blimp/client/core/contents/blimp_contents_impl.h" | 10 #include "blimp/client/core/contents/blimp_contents_impl.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 } | 61 } |
62 | 62 |
63 base::android::ScopedJavaLocalRef<jobject> | 63 base::android::ScopedJavaLocalRef<jobject> |
64 BlimpClientContextImplAndroid::CreateBlimpContentsJava(JNIEnv* env, | 64 BlimpClientContextImplAndroid::CreateBlimpContentsJava(JNIEnv* env, |
65 jobject jobj) { | 65 jobject jobj) { |
66 std::unique_ptr<BlimpContents> blimp_contents = | 66 std::unique_ptr<BlimpContents> blimp_contents = |
67 BlimpClientContextImpl::CreateBlimpContents(); | 67 BlimpClientContextImpl::CreateBlimpContents(); |
68 // This intentionally releases the ownership and gives it to Java. | 68 // This intentionally releases the ownership and gives it to Java. |
69 BlimpContentsImpl* blimp_contents_impl = | 69 BlimpContentsImpl* blimp_contents_impl = |
70 static_cast<BlimpContentsImpl*>(blimp_contents.release()); | 70 static_cast<BlimpContentsImpl*>(blimp_contents.release()); |
71 return blimp_contents_impl->GetJavaBlimpContentsImpl(); | 71 return blimp_contents_impl->GetJavaObject(); |
72 } | 72 } |
73 | 73 |
74 GURL BlimpClientContextImplAndroid::GetAssignerURL() { | 74 GURL BlimpClientContextImplAndroid::GetAssignerURL() { |
75 JNIEnv* env = base::android::AttachCurrentThread(); | 75 JNIEnv* env = base::android::AttachCurrentThread(); |
76 base::android::ScopedJavaLocalRef<jstring> jurl = | 76 base::android::ScopedJavaLocalRef<jstring> jurl = |
77 Java_BlimpClientContextImpl_getAssignerUrl(env, java_obj_); | 77 Java_BlimpClientContextImpl_getAssignerUrl(env, java_obj_); |
78 GURL assigner_url = GURL(ConvertJavaStringToUTF8(env, jurl)); | 78 GURL assigner_url = GURL(ConvertJavaStringToUTF8(env, jurl)); |
79 DCHECK(assigner_url.is_valid()); | 79 DCHECK(assigner_url.is_valid()); |
80 return assigner_url; | 80 return assigner_url; |
81 } | 81 } |
82 | 82 |
83 void BlimpClientContextImplAndroid::ConnectFromJava(JNIEnv* env, jobject jobj) { | 83 void BlimpClientContextImplAndroid::ConnectFromJava(JNIEnv* env, jobject jobj) { |
84 BlimpClientContextImpl::Connect(); | 84 BlimpClientContextImpl::Connect(); |
85 } | 85 } |
86 | 86 |
87 } // namespace client | 87 } // namespace client |
88 } // namespace blimp | 88 } // namespace blimp |
OLD | NEW |