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

Unified Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2773903003: Add way to get native VR UI information from Java (Closed)
Patch Set: Remove comment Created 3 years, 9 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 | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_shell_gl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 904c41ab5931df6aaaee0b74396c96a55f7df0b4..1580024d0155dfd68120ae9f48b696293a329887 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"
@@ -419,6 +421,19 @@ 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) {
+ 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,
+ base::Bind(&VrShell::OnUiElementInfoCreated,
+ weak_ptr_factory_.GetWeakPtr())));
+}
+
void VrShell::UiSurfaceChanged(jobject surface) {
ui_compositor_->SurfaceChanged(surface);
}
@@ -561,6 +576,16 @@ void VrShell::DoUiAction(const UiAction action,
}
}
+void VrShell::OnUiElementInfoCreated(
+ 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));
+}
+
void VrShell::RenderViewHostChanged(content::RenderViewHost* old_host,
content::RenderViewHost* new_host) {
content::RenderWidgetHostView* view = new_host->GetWidget()->GetView();
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_shell_gl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698