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

Side by Side Diff: remoting/client/jni/chromoting_jni_runtime.cc

Issue 1308363003: Revert of jni_generator: Make all object-returning natives return ScopedJavaLocalRef. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « net/cert/x509_util_android.cc ('k') | sync/android/model_type_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "remoting/client/jni/chromoting_jni_runtime.h" 5 #include "remoting/client/jni/chromoting_jni_runtime.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/library_loader/library_loader_hooks.h" 10 #include "base/android/library_loader/library_loader_hooks.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // The google_apis functions check the command-line arguments to make sure no 46 // The google_apis functions check the command-line arguments to make sure no
47 // runtime API keys have been specified by the environment. Unfortunately, we 47 // runtime API keys have been specified by the environment. Unfortunately, we
48 // neither launch Chromium nor have a command line, so we need to prevent 48 // neither launch Chromium nor have a command line, so we need to prevent
49 // them from DCHECKing out when they go looking. 49 // them from DCHECKing out when they go looking.
50 base::CommandLine::Init(0, nullptr); 50 base::CommandLine::Init(0, nullptr);
51 51
52 // Create the singleton now so that the Chromoting threads will be set up. 52 // Create the singleton now so that the Chromoting threads will be set up.
53 remoting::ChromotingJniRuntime::GetInstance(); 53 remoting::ChromotingJniRuntime::GetInstance();
54 } 54 }
55 55
56 static ScopedJavaLocalRef<jstring> GetApiKey(JNIEnv* env, jclass clazz) { 56 static jstring GetApiKey(JNIEnv* env, jclass clazz) {
57 return ConvertUTF8ToJavaString(env, google_apis::GetAPIKey().c_str()); 57 return ConvertUTF8ToJavaString(
58 env, google_apis::GetAPIKey().c_str()).Release();
58 } 59 }
59 60
60 static ScopedJavaLocalRef<jstring> GetClientId(JNIEnv* env, jclass clazz) { 61 static jstring GetClientId(JNIEnv* env, jclass clazz) {
61 return ConvertUTF8ToJavaString( 62 return ConvertUTF8ToJavaString(
62 env, 63 env, google_apis::GetOAuth2ClientID(
63 google_apis::GetOAuth2ClientID(google_apis::CLIENT_REMOTING).c_str()); 64 google_apis::CLIENT_REMOTING).c_str()).Release();
64 } 65 }
65 66
66 static ScopedJavaLocalRef<jstring> GetClientSecret(JNIEnv* env, jclass clazz) { 67 static jstring GetClientSecret(JNIEnv* env, jclass clazz) {
67 return ConvertUTF8ToJavaString( 68 return ConvertUTF8ToJavaString(
68 env, 69 env, google_apis::GetOAuth2ClientSecret(
69 google_apis::GetOAuth2ClientSecret(google_apis::CLIENT_REMOTING).c_str()); 70 google_apis::CLIENT_REMOTING).c_str()).Release();
70 } 71 }
71 72
72 static void Connect(JNIEnv* env, 73 static void Connect(JNIEnv* env,
73 jclass clazz, 74 jclass clazz,
74 jstring username, 75 jstring username,
75 jstring authToken, 76 jstring authToken,
76 jstring hostJid, 77 jstring hostJid,
77 jstring hostId, 78 jstring hostId,
78 jstring hostPubkey, 79 jstring hostPubkey,
79 jstring pairId, 80 jstring pairId,
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 364
364 JNIEnv* env = base::android::AttachCurrentThread(); 365 JNIEnv* env = base::android::AttachCurrentThread();
365 Java_JniInterface_redrawGraphicsInternal(env); 366 Java_JniInterface_redrawGraphicsInternal(env);
366 } 367 }
367 368
368 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) { 369 void ChromotingJniRuntime::DetachFromVmAndSignal(base::WaitableEvent* waiter) {
369 base::android::DetachFromVM(); 370 base::android::DetachFromVM();
370 waiter->Signal(); 371 waiter->Signal();
371 } 372 }
372 } // namespace remoting 373 } // namespace remoting
OLDNEW
« no previous file with comments | « net/cert/x509_util_android.cc ('k') | sync/android/model_type_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698