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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_delegate.cc

Issue 2499793002: Refactoring how WebVR eye bounds are handled (Closed)
Patch Set: Rebase Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/android/vr_shell/vr_shell_delegate.h" 5 #include "chrome/browser/android/vr_shell/vr_shell_delegate.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "chrome/browser/android/vr_shell/vr_shell.h" 8 #include "chrome/browser/android/vr_shell/vr_shell.h"
9 #include "device/vr/android/gvr/gvr_device_provider.h" 9 #include "device/vr/android/gvr/gvr_device_provider.h"
10 #include "jni/VrShellDelegate_jni.h" 10 #include "jni/VrShellDelegate_jni.h"
11 11
12 using base::android::JavaParamRef; 12 using base::android::JavaParamRef;
13 using base::android::AttachCurrentThread; 13 using base::android::AttachCurrentThread;
14 14
15 namespace vr_shell { 15 namespace vr_shell {
16 16
17 // A non presenting delegate for magic window mode. 17 // A non presenting delegate for magic window mode.
18 class GvrNonPresentingDelegate : public device::GvrDelegate { 18 class GvrNonPresentingDelegate : public device::GvrDelegate {
19 public: 19 public:
20 explicit GvrNonPresentingDelegate(jlong context) : weak_ptr_factory_(this) { 20 explicit GvrNonPresentingDelegate(jlong context) : weak_ptr_factory_(this) {
21 gvr_api_ = 21 gvr_api_ =
22 gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context)); 22 gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(context));
23 } 23 }
24 24
25 virtual ~GvrNonPresentingDelegate() = default; 25 virtual ~GvrNonPresentingDelegate() = default;
26 26
27 // GvrDelegate implementation 27 // GvrDelegate implementation
28 void SetWebVRSecureOrigin(bool secure_origin) override {} 28 void SetWebVRSecureOrigin(bool secure_origin) override {}
29 void SubmitWebVRFrame() override {} 29 void SubmitWebVRFrame() override {}
30 void UpdateWebVRTextureBounds(int eye, 30 void UpdateWebVRTextureBounds(const gvr::Rectf& left_bounds,
31 float left, 31 const gvr::Rectf& right_bounds) override {}
32 float top,
33 float width,
34 float height) override {}
35 void SetGvrPoseForWebVr(const gvr::Mat4f& pose, 32 void SetGvrPoseForWebVr(const gvr::Mat4f& pose,
36 uint32_t pose_index) override {} 33 uint32_t pose_index) override {}
37 gvr::GvrApi* gvr_api() override { return gvr_api_.get(); } 34 gvr::GvrApi* gvr_api() override { return gvr_api_.get(); }
38 base::WeakPtr<GvrNonPresentingDelegate> GetWeakPtr() { 35 base::WeakPtr<GvrNonPresentingDelegate> GetWeakPtr() {
39 return weak_ptr_factory_.GetWeakPtr(); 36 return weak_ptr_factory_.GetWeakPtr();
40 } 37 }
41 private: 38 private:
42 std::unique_ptr<gvr::GvrApi> gvr_api_; 39 std::unique_ptr<gvr::GvrApi> gvr_api_;
43 base::WeakPtrFactory<GvrNonPresentingDelegate> weak_ptr_factory_; 40 base::WeakPtrFactory<GvrNonPresentingDelegate> weak_ptr_factory_;
44 }; 41 };
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 116
120 bool RegisterVrShellDelegate(JNIEnv* env) { 117 bool RegisterVrShellDelegate(JNIEnv* env) {
121 return RegisterNativesImpl(env); 118 return RegisterNativesImpl(env);
122 } 119 }
123 120
124 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) { 121 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj) {
125 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj)); 122 return reinterpret_cast<intptr_t>(new VrShellDelegate(env, obj));
126 } 123 }
127 124
128 } // namespace vr_shell 125 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.cc ('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