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

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

Issue 2775283004: Rendering Daydream controller in a fixed position. (Closed)
Patch Set: Moving code to more appropriate locations. 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 edcbb68f0fe05e2c0f75e96229e281b9e33a5b32..b22af010adc85ea1ca710460f091dcebe3c6805e 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -19,13 +19,16 @@
#include "base/values.h"
#include "chrome/browser/android/tab_android.h"
#include "chrome/browser/android/vr_shell/android_ui_gesture_target.h"
+#include "chrome/browser/android/vr_shell/ui_interface.h"
#include "chrome/browser/android/vr_shell/vr_compositor.h"
+#include "chrome/browser/android/vr_shell/vr_controller_model.h"
#include "chrome/browser/android/vr_shell/vr_gl_thread.h"
#include "chrome/browser/android/vr_shell/vr_input_manager.h"
#include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
#include "chrome/browser/android/vr_shell/vr_shell_gl.h"
#include "chrome/browser/android/vr_shell/vr_usage_monitor.h"
#include "chrome/browser/android/vr_shell/vr_web_contents_observer.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/render_widget_host.h"
@@ -44,6 +47,7 @@
#include "ui/base/page_transition_types.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
+#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/transform.h"
#include "ui/gfx/transform_util.h"
@@ -69,6 +73,17 @@ void SetIsInVR(content::WebContents* contents, bool is_in_vr) {
contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr);
}
+void LoadControllerModelTask(
+ base::WeakPtr<VrShell> weak_vr_shell,
+ scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner) {
+ auto controller_model = VrControllerModel::LoadFromComponent();
+ if (controller_model) {
+ main_thread_task_runner->PostTask(
+ FROM_HERE, base::Bind(&VrShell::SubmitControllerModel, weak_vr_shell,
+ base::Passed(&controller_model)));
+ }
+}
+
} // namespace
VrShell::VrShell(JNIEnv* env,
@@ -110,6 +125,11 @@ VrShell::VrShell(JNIEnv* env,
html_interface_ = base::MakeUnique<UiInterface>(
for_web_vr ? UiInterface::Mode::WEB_VR : UiInterface::Mode::STANDARD);
+
+ content::BrowserThread::PostTask(
+ content::BrowserThread::FILE, FROM_HERE,
+ base::Bind(LoadControllerModelTask, weak_ptr_factory_.GetWeakPtr(),
+ main_thread_task_runner_));
}
void VrShell::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) {
@@ -349,6 +369,12 @@ void VrShell::SubmitWebVRFrame(int16_t frame_index,
mailbox));
}
+void VrShell::SubmitControllerModel(std::unique_ptr<VrControllerModel> model) {
+ PostToGlThreadWhenReady(base::Bind(&VrShellGl::SetControllerModel,
+ gl_thread_->GetVrShellGl(),
+ base::Passed(&model)));
+}
+
void VrShell::UpdateWebVRTextureBounds(int16_t frame_index,
const gvr::Rectf& left_bounds,
const gvr::Rectf& right_bounds,
« 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