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

Unified Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 319273003: Third Party Authentication for Android Part II - Java Native Interface plumbing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: JNI plumbing Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/jni/chromoting_jni_runtime.cc
diff --git a/remoting/client/jni/chromoting_jni_runtime.cc b/remoting/client/jni/chromoting_jni_runtime.cc
index 8384d679994407fd4c825ff4c718e740c0e93d24..5fc586f54b483f6fa44e3f59c0d76e346fd2ac7e 100644
--- a/remoting/client/jni/chromoting_jni_runtime.cc
+++ b/remoting/client/jni/chromoting_jni_runtime.cc
@@ -144,6 +144,18 @@ static void SendTextEvent(JNIEnv* env,
ConvertJavaStringToUTF8(env, text));
}
+static void OnThirdPartyTokenFetched(JNIEnv* env,
+ jclass clazz,
+ jstring token,
+ jstring shared_secret) {
+ ChromotingJniRuntime* runtime = remoting::ChromotingJniRuntime::GetInstance();
+ runtime->network_task_runner()->PostTask(FROM_HERE, base::Bind(
+ &ChromotingJniInstance::HandleOnThirdPartyTokenFetched,
+ runtime->session(),
+ ConvertJavaStringToUTF8(env, token),
+ ConvertJavaStringToUTF8(env, shared_secret)));
+}
+
// ChromotingJniRuntime implementation.
// static
@@ -303,4 +315,19 @@ void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) {
waiter->Signal();
}
+void ChromotingJniRuntime::FetchThirdPartyToken(const GURL& token_url,
+ const std::string& client_id,
+ const std::string& scope) {
+ DCHECK(ui_task_runner_->BelongsToCurrentThread());
+ JNIEnv* env = base::android::AttachCurrentThread();
+
+ ScopedJavaLocalRef<jstring> j_url =
+ ConvertUTF8ToJavaString(env, token_url.spec());
+ ScopedJavaLocalRef<jstring> j_client_id =
+ ConvertUTF8ToJavaString(env, client_id);
+ ScopedJavaLocalRef<jstring> j_scope = ConvertUTF8ToJavaString(env, scope);
+
+ Java_JniInterface_fetchThirdPartyToken(
+ env, j_url.obj(), j_client_id.obj(), j_scope.obj());
+}
} // namespace remoting
« remoting/client/jni/chromoting_jni_runtime.h ('K') | « remoting/client/jni/chromoting_jni_runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698