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

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: Address Feedbacks 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
« no previous file with comments | « remoting/client/jni/chromoting_jni_runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..cc84d4e7918ccb5193c22544fe3d5c1a35721645 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
@@ -255,6 +267,22 @@ void ChromotingJniRuntime::CommitPairingCredentials(const std::string& host,
env, j_host.obj(), j_id.obj(), j_secret.obj());
}
+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());
+}
+
base::android::ScopedJavaLocalRef<jobject> ChromotingJniRuntime::NewBitmap(
webrtc::DesktopSize size) {
JNIEnv* env = base::android::AttachCurrentThread();
@@ -302,5 +330,4 @@ void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) {
base::android::DetachFromVM();
waiter->Signal();
}
-
} // namespace remoting
« no previous file with comments | « 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