| Index: chrome/browser/android/vr_shell/vr_shell.cc
|
| diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
|
| index edcbb68f0fe05e2c0f75e96229e281b9e33a5b32..6541fce24df73088ed8d53c4500ee11be9f53c45 100644
|
| --- a/chrome/browser/android/vr_shell/vr_shell.cc
|
| +++ b/chrome/browser/android/vr_shell/vr_shell.cc
|
| @@ -9,7 +9,9 @@
|
| #include <string>
|
| #include <utility>
|
|
|
| +#include "base/android/jni_array.h"
|
| #include "base/android/jni_string.h"
|
| +#include "base/json/json_writer.h"
|
| #include "base/memory/ptr_util.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/threading/platform_thread.h"
|
| @@ -397,6 +399,20 @@ void VrShell::SetHistoryButtonsEnabled(JNIEnv* env,
|
| html_interface_->SetHistoryButtonsEnabled(can_go_back, can_go_forward);
|
| }
|
|
|
| +void VrShell::RequestUiElementInfoForTesting(JNIEnv* env,
|
| + const JavaParamRef<jobject>& obj,
|
| + jobjectArray element_names,
|
| + jint callback_id) {
|
| + std::vector<std::string> element_names_vector;
|
| + base::android::AppendJavaStringArrayToStringVector(env, element_names,
|
| + &element_names_vector);
|
| + PostToGlThreadWhenReady(
|
| + base::Bind(&VrShellGl::CreateUiElementInfos, gl_thread_->GetVrShellGl(),
|
| + element_names_vector, callback_id,
|
| + base::Bind(&VrShell::OnUiElementInfoCreated,
|
| + weak_ptr_factory_.GetWeakPtr())));
|
| +}
|
| +
|
| void VrShell::UiSurfaceChanged(jobject surface) {
|
| ui_compositor_->SurfaceChanged(surface);
|
| }
|
| @@ -539,6 +555,17 @@ void VrShell::DoUiAction(const UiAction action,
|
| }
|
| }
|
|
|
| +void VrShell::OnUiElementInfoCreated(
|
| + int callback_id,
|
| + std::unique_ptr<base::DictionaryValue> info) {
|
| + std::string json_reply;
|
| + base::JSONWriter::Write(*info, &json_reply);
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_VrShellImpl_replyToUiElementInfoRequestForTesting(
|
| + env, j_vr_shell_.obj(),
|
| + base::android::ConvertUTF8ToJavaString(env, json_reply), callback_id);
|
| +}
|
| +
|
| void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host,
|
| content::RenderViewHost* new_host) {
|
| content::RenderWidgetHostView* view = new_host->GetWidget()->GetView();
|
|
|