| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 | 11 |
| 12 #include "base/android/jni_weak_ref.h" | 12 #include "base/android/jni_weak_ref.h" |
| 13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "content/public/browser/web_contents_observer.h" | 17 #include "content/public/browser/web_contents_observer.h" |
| 18 #include "device/vr/android/gvr/gvr_delegate.h" | 18 #include "device/vr/android/gvr/gvr_delegate.h" |
| 19 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" | 19 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr.h" |
| 20 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 20 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class ListValue; | 23 class ListValue; |
| 24 class Thread; | 24 class Thread; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace blink { |
| 28 class WebInputEvent; |
| 29 } |
| 30 |
| 27 namespace content { | 31 namespace content { |
| 28 class WebContents; | 32 class WebContents; |
| 29 } | 33 } |
| 30 | 34 |
| 31 namespace ui { | 35 namespace ui { |
| 32 class WindowAndroid; | 36 class WindowAndroid; |
| 33 } | 37 } |
| 34 | 38 |
| 35 namespace vr_shell { | 39 namespace vr_shell { |
| 36 | 40 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 58 public: | 62 public: |
| 59 VrShell(JNIEnv* env, jobject obj, | 63 VrShell(JNIEnv* env, jobject obj, |
| 60 content::WebContents* main_contents, | 64 content::WebContents* main_contents, |
| 61 ui::WindowAndroid* content_window, | 65 ui::WindowAndroid* content_window, |
| 62 content::WebContents* ui_contents, | 66 content::WebContents* ui_contents, |
| 63 ui::WindowAndroid* ui_window, | 67 ui::WindowAndroid* ui_window, |
| 64 bool for_web_vr, | 68 bool for_web_vr, |
| 65 VrShellDelegate* delegate, | 69 VrShellDelegate* delegate, |
| 66 gvr_context* gvr_api, | 70 gvr_context* gvr_api, |
| 67 bool reprojected_rendering); | 71 bool reprojected_rendering); |
| 68 | 72 void SwapContents(JNIEnv* env, |
| 73 const base::android::JavaParamRef<jobject>& obj, |
| 74 const base::android::JavaParamRef<jobject>& web_contents); |
| 69 void LoadUIContent(JNIEnv* env, | 75 void LoadUIContent(JNIEnv* env, |
| 70 const base::android::JavaParamRef<jobject>& obj); | 76 const base::android::JavaParamRef<jobject>& obj); |
| 71 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); | 77 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); |
| 72 void OnTriggerEvent(JNIEnv* env, | 78 void OnTriggerEvent(JNIEnv* env, |
| 73 const base::android::JavaParamRef<jobject>& obj); | 79 const base::android::JavaParamRef<jobject>& obj); |
| 74 void OnPause(JNIEnv* env, | 80 void OnPause(JNIEnv* env, |
| 75 const base::android::JavaParamRef<jobject>& obj); | 81 const base::android::JavaParamRef<jobject>& obj); |
| 76 void OnResume(JNIEnv* env, | 82 void OnResume(JNIEnv* env, |
| 77 const base::android::JavaParamRef<jobject>& obj); | 83 const base::android::JavaParamRef<jobject>& obj); |
| 78 void SetSurface(JNIEnv* env, | 84 void SetSurface(JNIEnv* env, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // Perform a UI action triggered by the javascript API. | 135 // Perform a UI action triggered by the javascript API. |
| 130 void DoUiAction(const UiAction action); | 136 void DoUiAction(const UiAction action); |
| 131 | 137 |
| 132 void SetContentCssSize(float width, float height, float dpr); | 138 void SetContentCssSize(float width, float height, float dpr); |
| 133 void SetUiCssSize(float width, float height, float dpr); | 139 void SetUiCssSize(float width, float height, float dpr); |
| 134 | 140 |
| 135 void ContentFrameWasResized(bool width_changed); | 141 void ContentFrameWasResized(bool width_changed); |
| 136 | 142 |
| 137 void ForceExitVr(); | 143 void ForceExitVr(); |
| 138 | 144 |
| 145 void ProcessUIGesture(std::unique_ptr<blink::WebInputEvent> event); |
| 146 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); |
| 147 |
| 139 private: | 148 private: |
| 140 ~VrShell() override; | 149 ~VrShell() override; |
| 141 void SetIsInVR(bool is_in_vr); | |
| 142 void PostToGlThreadWhenReady(const base::Closure& task); | 150 void PostToGlThreadWhenReady(const base::Closure& task); |
| 143 | 151 |
| 144 // content::WebContentsObserver implementation. All called on UI thread. | 152 // content::WebContentsObserver implementation. All called on UI thread. |
| 145 void RenderViewHostChanged(content::RenderViewHost* old_host, | 153 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 146 content::RenderViewHost* new_host) override; | 154 content::RenderViewHost* new_host) override; |
| 147 void MainFrameWasResized(bool width_changed) override; | 155 void MainFrameWasResized(bool width_changed) override; |
| 148 void WebContentsDestroyed() override; | 156 void WebContentsDestroyed() override; |
| 149 | 157 |
| 150 std::unique_ptr<UiInterface> html_interface_; | 158 std::unique_ptr<UiInterface> html_interface_; |
| 151 | 159 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 170 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 178 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 171 | 179 |
| 172 DISALLOW_COPY_AND_ASSIGN(VrShell); | 180 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 173 }; | 181 }; |
| 174 | 182 |
| 175 bool RegisterVrShell(JNIEnv* env); | 183 bool RegisterVrShell(JNIEnv* env); |
| 176 | 184 |
| 177 } // namespace vr_shell | 185 } // namespace vr_shell |
| 178 | 186 |
| 179 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 187 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |