summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsolb@chromium.org <solb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-11 18:34:48 +0000
committersolb@chromium.org <solb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-11 18:34:48 +0000
commitcf0ad82733d64d450f300726ed93d770253a98f5 (patch)
tree6be8f2be4dc8ada11559f734e224becbcbef6704 /remoting
parent9fdf92ab33a67c4d54d90491979a0438fe16ab3a (diff)
downloadchromium_src-cf0ad82733d64d450f300726ed93d770253a98f5.zip
chromium_src-cf0ad82733d64d450f300726ed93d770253a98f5.tar.gz
chromium_src-cf0ad82733d64d450f300726ed93d770253a98f5.tar.bz2
Enable fetching of API keys and OAuth client details via JNI
Review URL: https://chromiumcodereview.appspot.com/19030005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@211167 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/client/jni/jni_interface.cc25
-rw-r--r--remoting/remoting.gyp1
2 files changed, 26 insertions, 0 deletions
diff --git a/remoting/client/jni/jni_interface.cc b/remoting/client/jni/jni_interface.cc
index cb7f6c2..22b7f02 100644
--- a/remoting/client/jni/jni_interface.cc
+++ b/remoting/client/jni/jni_interface.cc
@@ -12,7 +12,9 @@
#include <jni.h>
#include "base/android/jni_android.h"
+#include "base/command_line.h"
#include "base/memory/ref_counted.h"
+#include "google_apis/google_api_keys.h"
#include "remoting/client/jni/chromoting_jni_instance.h"
// Class and package name of the Java class that declares this file's functions.
@@ -32,9 +34,32 @@ JNIEXPORT void JNICALL JNI_IMPLEMENTATION(loadNative)(JNIEnv* env,
base::android::ScopedJavaLocalRef<jobject> context_activity(env, context);
base::android::InitApplicationContext(context_activity);
+ // The google_apis functions check the command-line arguments to make sure no
+ // runtime API keys have been specified by the environment. Unfortunately, we
+ // neither launch Chromium nor have a command line, so we need to prevent
+ // them from DCHECKing out when they go looking.
+ CommandLine::Init(0, NULL);
+
remoting::ChromotingJNIInstance::GetInstance(); // Initialize threads now.
}
+JNIEXPORT jstring JNICALL JNI_IMPLEMENTATION(getApiKey)(JNIEnv* env,
+ jobject that) {
+ return env->NewStringUTF(google_apis::GetAPIKey().c_str());
+}
+
+JNIEXPORT jstring JNICALL JNI_IMPLEMENTATION(getClientId)(JNIEnv* env,
+ jobject that) {
+ return env->NewStringUTF(
+ google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING).c_str());
+}
+
+JNIEXPORT jstring JNICALL JNI_IMPLEMENTATION(getClientSecret)(JNIEnv* env,
+ jobject that) {
+ return env->NewStringUTF(
+ google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING).c_str());
+}
+
JNIEXPORT void JNICALL JNI_IMPLEMENTATION(connectNative)(JNIEnv* env,
jobject that,
jstring username,
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index 375f562..97d9980 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -1890,6 +1890,7 @@
'remoting_client',
'remoting_jingle_glue',
'remoting_protocol',
+ '../google_apis/google_apis.gyp:google_apis',
],
'sources': [
'client/jni/chromoting_jni_instance.cc',