OLD | NEW |
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.h" | 5 #include "remoting/client/jni/chromoting_jni.h" |
6 | 6 |
7 #include "base/android/base_jni_registrar.h" | 7 #include "base/android/base_jni_registrar.h" |
8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "net/android/net_jni_registrar.h" | 10 #include "net/android/net_jni_registrar.h" |
11 #include "remoting/base/url_request_context.h" | 11 #include "remoting/base/url_request_context.h" |
12 #include "remoting/client/jni/chromoting_jni_instance.h" | |
13 | 12 |
14 namespace remoting { | 13 namespace remoting { |
15 | 14 |
16 // static | 15 // static |
17 ChromotingJni* ChromotingJni::GetInstance() { | 16 ChromotingJni* ChromotingJni::GetInstance() { |
18 return Singleton<ChromotingJni>::get(); | 17 return Singleton<ChromotingJni>::get(); |
19 } | 18 } |
20 | 19 |
21 ChromotingJni::ChromotingJni() { | 20 ChromotingJni::ChromotingJni() { |
22 JNIEnv* env = base::android::AttachCurrentThread(); | 21 JNIEnv* env = base::android::AttachCurrentThread(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 98 |
100 void ChromotingJni::DisplayAuthenticationPrompt() { | 99 void ChromotingJni::DisplayAuthenticationPrompt() { |
101 DCHECK(ui_task_runner_->BelongsToCurrentThread()); | 100 DCHECK(ui_task_runner_->BelongsToCurrentThread()); |
102 | 101 |
103 JNIEnv* env = base::android::AttachCurrentThread(); | 102 JNIEnv* env = base::android::AttachCurrentThread(); |
104 env->CallStaticVoidMethod( | 103 env->CallStaticVoidMethod( |
105 class_, | 104 class_, |
106 env->GetStaticMethodID(class_, "displayAuthenticationPrompt", "()V")); | 105 env->GetStaticMethodID(class_, "displayAuthenticationPrompt", "()V")); |
107 } | 106 } |
108 | 107 |
| 108 void ChromotingJni::UpdateImageBuffer(int width, int height, jobject buffer) { |
| 109 DCHECK(display_task_runner_->BelongsToCurrentThread()); |
| 110 |
| 111 JNIEnv* env = base::android::AttachCurrentThread(); |
| 112 env->SetStaticIntField( |
| 113 class_, |
| 114 env->GetStaticFieldID(class_, "width", "I"), |
| 115 width); |
| 116 env->SetStaticIntField( |
| 117 class_, |
| 118 env->GetStaticFieldID(class_, "height", "I"), |
| 119 height); |
| 120 env->SetStaticObjectField( |
| 121 class_, |
| 122 env->GetStaticFieldID(class_, "buffer", "Ljava/nio/ByteBuffer;"), |
| 123 buffer); |
| 124 } |
| 125 |
| 126 void ChromotingJni::RedrawCanvas() { |
| 127 DCHECK(display_task_runner_->BelongsToCurrentThread()); |
| 128 |
| 129 JNIEnv* env = base::android::AttachCurrentThread(); |
| 130 env->CallStaticVoidMethod( |
| 131 class_, |
| 132 env->GetStaticMethodID(class_, "redrawGraphicsInternal", "()V")); |
| 133 } |
| 134 |
109 } // namespace remoting | 135 } // namespace remoting |
OLD | NEW |