| 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 "chrome/browser/android/vr_shell/vr_controller_model.h" | 17 #include "chrome/browser/android/vr_shell/vr_controller_model.h" |
| 18 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h" | 18 #include "chrome/browser/ui/toolbar/chrome_toolbar_model_delegate.h" |
| 19 #include "chrome/browser/vr/ui_interface.h" | 19 #include "chrome/browser/vr/ui_interface.h" |
| 20 #include "chrome/browser/vr/ui_unsupported_mode.h" | 20 #include "chrome/browser/vr/ui_unsupported_mode.h" |
| 21 #include "content/public/browser/web_contents_observer.h" | 21 #include "content/public/browser/web_contents_observer.h" |
| 22 #include "device/geolocation/public/interfaces/geolocation_config.mojom.h" |
| 22 #include "device/vr/android/gvr/cardboard_gamepad_data_provider.h" | 23 #include "device/vr/android/gvr/cardboard_gamepad_data_provider.h" |
| 23 #include "device/vr/android/gvr/gvr_delegate.h" | 24 #include "device/vr/android/gvr/gvr_delegate.h" |
| 24 #include "device/vr/android/gvr/gvr_gamepad_data_provider.h" | 25 #include "device/vr/android/gvr/gvr_gamepad_data_provider.h" |
| 25 #include "device/vr/vr_service.mojom.h" | 26 #include "device/vr/vr_service.mojom.h" |
| 26 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" | 27 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 27 | 28 |
| 28 namespace blink { | 29 namespace blink { |
| 29 class WebInputEvent; | 30 class WebInputEvent; |
| 30 } // namespace blink | 31 } // namespace blink |
| 31 | 32 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 JNIEnv* env, | 155 JNIEnv* env, |
| 155 const base::android::JavaParamRef<jobject>& object, | 156 const base::android::JavaParamRef<jobject>& object, |
| 156 jint width, | 157 jint width, |
| 157 jint height, | 158 jint height, |
| 158 jfloat dpr); | 159 jfloat dpr); |
| 159 | 160 |
| 160 // Perform a UI action triggered by the javascript API. | 161 // Perform a UI action triggered by the javascript API. |
| 161 void DoUiAction(const UiAction action, | 162 void DoUiAction(const UiAction action, |
| 162 const base::DictionaryValue* arguments); | 163 const base::DictionaryValue* arguments); |
| 163 | 164 |
| 165 void SetHighAccuracyLocation(bool high_accuracy_location); |
| 164 void SetContentCssSize(float width, float height, float dpr); | 166 void SetContentCssSize(float width, float height, float dpr); |
| 165 | 167 |
| 166 void ContentFrameWasResized(bool width_changed); | 168 void ContentFrameWasResized(bool width_changed); |
| 167 | 169 |
| 168 void ForceExitVr(); | 170 void ForceExitVr(); |
| 169 void ExitPresent(); | 171 void ExitPresent(); |
| 170 void ExitFullscreen(); | 172 void ExitFullscreen(); |
| 171 void ExitVrDueToUnsupportedMode(vr::UiUnsupportedMode mode); | 173 void ExitVrDueToUnsupportedMode(vr::UiUnsupportedMode mode); |
| 172 | 174 |
| 173 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); | 175 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 std::unique_ptr<VrMetricsHelper> metrics_helper_; | 230 std::unique_ptr<VrMetricsHelper> metrics_helper_; |
| 229 | 231 |
| 230 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; | 232 scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_; |
| 231 std::unique_ptr<VrGLThread> gl_thread_; | 233 std::unique_ptr<VrGLThread> gl_thread_; |
| 232 bool thread_started_ = false; | 234 bool thread_started_ = false; |
| 233 bool reprojected_rendering_; | 235 bool reprojected_rendering_; |
| 234 | 236 |
| 235 vr::UiInterface* ui_; | 237 vr::UiInterface* ui_; |
| 236 std::unique_ptr<vr::ToolbarHelper> toolbar_; | 238 std::unique_ptr<vr::ToolbarHelper> toolbar_; |
| 237 | 239 |
| 240 device::mojom::GeolocationConfigPtr geolocation_config_; |
| 241 |
| 238 jobject content_surface_ = nullptr; | 242 jobject content_surface_ = nullptr; |
| 239 bool taken_surface_ = false; | 243 bool taken_surface_ = false; |
| 240 base::CancelableClosure poll_capturing_media_task_; | 244 base::CancelableClosure poll_capturing_media_task_; |
| 241 bool is_capturing_audio_ = false; | 245 bool is_capturing_audio_ = false; |
| 242 bool is_capturing_video_ = false; | 246 bool is_capturing_video_ = false; |
| 243 bool is_capturing_screen_ = false; | 247 bool is_capturing_screen_ = false; |
| 244 bool is_bluetooth_connected_ = false; | 248 bool is_bluetooth_connected_ = false; |
| 249 bool high_accuracy_location_ = false; |
| 245 | 250 |
| 246 // Are we currently providing a gamepad factory to the gamepad manager? | 251 // Are we currently providing a gamepad factory to the gamepad manager? |
| 247 bool gvr_gamepad_source_active_ = false; | 252 bool gvr_gamepad_source_active_ = false; |
| 248 bool cardboard_gamepad_source_active_ = false; | 253 bool cardboard_gamepad_source_active_ = false; |
| 249 | 254 |
| 250 // Registered fetchers, must remain alive for UpdateGamepadData calls. | 255 // Registered fetchers, must remain alive for UpdateGamepadData calls. |
| 251 // That's ok since the fetcher is only destroyed from VrShell's destructor. | 256 // That's ok since the fetcher is only destroyed from VrShell's destructor. |
| 252 device::GvrGamepadDataFetcher* gvr_gamepad_data_fetcher_ = nullptr; | 257 device::GvrGamepadDataFetcher* gvr_gamepad_data_fetcher_ = nullptr; |
| 253 device::CardboardGamepadDataFetcher* cardboard_gamepad_data_fetcher_ = | 258 device::CardboardGamepadDataFetcher* cardboard_gamepad_data_fetcher_ = |
| 254 nullptr; | 259 nullptr; |
| 255 int64_t cardboard_gamepad_timer_ = 0; | 260 int64_t cardboard_gamepad_timer_ = 0; |
| 256 | 261 |
| 257 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 262 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 258 | 263 |
| 259 DISALLOW_COPY_AND_ASSIGN(VrShell); | 264 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 260 }; | 265 }; |
| 261 | 266 |
| 262 bool RegisterVrShell(JNIEnv* env); | 267 bool RegisterVrShell(JNIEnv* env); |
| 263 | 268 |
| 264 } // namespace vr_shell | 269 } // namespace vr_shell |
| 265 | 270 |
| 266 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 271 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |