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

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

Issue 2248183002: VR Shell Experimental work master (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup Created 4 years, 2 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_renderer.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 b8e905c54b031b67f5dfcf52816416821b05361c..55b298580190b34006d341e83f49dc9c24e8772f 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -7,6 +7,7 @@
#include "chrome/browser/android/vr_shell/ui_scene.h"
#include "chrome/browser/android/vr_shell/vr_compositor.h"
#include "chrome/browser/android/vr_shell/vr_controller.h"
+#include "chrome/browser/android/vr_shell/vr_gesture.h"
#include "chrome/browser/android/vr_shell/vr_gl_util.h"
#include "chrome/browser/android/vr_shell/vr_input_manager.h"
#include "chrome/browser/android/vr_shell/vr_math.h"
@@ -20,6 +21,7 @@
#include "content/public/common/referrer.h"
#include "content/public/common/screen_info.h"
#include "jni/VrShell_jni.h"
+#include "third_party/WebKit/public/web/WebInputEvent.h"
#include "ui/android/view_android.h"
#include "ui/android/window_android.h"
#include "ui/base/page_transition_types.h"
@@ -153,8 +155,6 @@ VrShell::VrShell(JNIEnv* env,
rect->translation = kDesktopPositionDefault;
scene_.AddUiElement(rect);
- desktop_plane_ = scene_.GetUiElementById(kBrowserUiElementId);
-
LoadUIContent();
}
@@ -180,6 +180,7 @@ bool RegisterVrShell(JNIEnv* env) {
}
VrShell::~VrShell() {
+ DCHECK(g_instance == this);
g_instance = nullptr;
gl::init::ClearGLBindings();
}
@@ -252,8 +253,11 @@ void VrShell::UpdateController(const gvr::Vec3f& forward_vector) {
gvr::Vec3f origin = kHandPosition;
target_element_ = nullptr;
- float distance = scene_.GetUiElementById(kBrowserUiElementId)
- ->GetRayDistance(origin, forward);
+
+ ContentRectangle* content_plane =
+ scene_.GetUiElementById(kBrowserUiElementId);
+
+ float distance = content_plane->GetRayDistance(origin, forward);
// If we place the reticle based on elements intersecting the controller beam,
// we can end up with the reticle hiding behind elements, or jumping laterally
@@ -273,7 +277,7 @@ void VrShell::UpdateController(const gvr::Vec3f& forward_vector) {
// rather than eye, for simplicity. This will make the sphere slightly
// off-center.
gvr::Vec3f corner = {0.5f, 0.5f, 0.0f};
- corner = MatrixVectorMul(desktop_plane_->transform.to_world, corner);
+ corner = MatrixVectorMul(content_plane->transform.to_world, corner);
float max_distance = Distance(origin, corner) * kReticleDistanceMultiplier;
if (distance > max_distance || distance <= 0.0f) {
distance = max_distance;
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_shell_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698