| 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> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 class VrGLThread; | 47 class VrGLThread; |
| 48 class VrInputManager; | 48 class VrInputManager; |
| 49 class VrMetricsHelper; | 49 class VrMetricsHelper; |
| 50 class VrShellDelegate; | 50 class VrShellDelegate; |
| 51 class VrWebContentsObserver; | 51 class VrWebContentsObserver; |
| 52 | 52 |
| 53 enum UiAction { | 53 enum UiAction { |
| 54 HISTORY_BACK = 0, | 54 HISTORY_BACK = 0, |
| 55 HISTORY_FORWARD, | 55 HISTORY_FORWARD, |
| 56 RELOAD, | 56 RELOAD, |
| 57 SET_CONTENT_PAUSED, | |
| 58 SHOW_TAB, | 57 SHOW_TAB, |
| 59 OPEN_NEW_TAB, | 58 OPEN_NEW_TAB, |
| 60 EXIT_PRESENT, | 59 EXIT_PRESENT, |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 class VrMetricsHelper; | 62 class VrMetricsHelper; |
| 64 | 63 |
| 65 // The native instance of the Java VrShell. This class is not threadsafe and | 64 // The native instance of the Java VrShell. This class is not threadsafe and |
| 66 // must only be used on the UI thread. | 65 // must only be used on the UI thread. |
| 67 class VrShell : public device::PresentingGvrDelegate, | 66 class VrShell : public device::PresentingGvrDelegate, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 jobjectArray incognito_tabs); | 100 jobjectArray incognito_tabs); |
| 102 void OnTabUpdated(JNIEnv* env, | 101 void OnTabUpdated(JNIEnv* env, |
| 103 const base::android::JavaParamRef<jobject>& obj, | 102 const base::android::JavaParamRef<jobject>& obj, |
| 104 jboolean incognito, | 103 jboolean incognito, |
| 105 jint id, | 104 jint id, |
| 106 jstring jtitle); | 105 jstring jtitle); |
| 107 void OnTabRemoved(JNIEnv* env, | 106 void OnTabRemoved(JNIEnv* env, |
| 108 const base::android::JavaParamRef<jobject>& obj, | 107 const base::android::JavaParamRef<jobject>& obj, |
| 109 jboolean incognito, | 108 jboolean incognito, |
| 110 jint id); | 109 jint id); |
| 110 void OnContentPaused(bool paused); |
| 111 base::android::ScopedJavaGlobalRef<jobject> TakeContentSurface( | 111 base::android::ScopedJavaGlobalRef<jobject> TakeContentSurface( |
| 112 JNIEnv* env, | 112 JNIEnv* env, |
| 113 const base::android::JavaParamRef<jobject>& obj); | 113 const base::android::JavaParamRef<jobject>& obj); |
| 114 void RestoreContentSurface(JNIEnv* env, | 114 void RestoreContentSurface(JNIEnv* env, |
| 115 const base::android::JavaParamRef<jobject>& obj); | 115 const base::android::JavaParamRef<jobject>& obj); |
| 116 void SetHistoryButtonsEnabled(JNIEnv* env, | 116 void SetHistoryButtonsEnabled(JNIEnv* env, |
| 117 const base::android::JavaParamRef<jobject>& obj, | 117 const base::android::JavaParamRef<jobject>& obj, |
| 118 jboolean can_go_back, | 118 jboolean can_go_back, |
| 119 jboolean can_go_forward); | 119 jboolean can_go_forward); |
| 120 | 120 |
| 121 void ContentWebContentsDestroyed(); | 121 void ContentWebContentsDestroyed(); |
| 122 // Called when our WebContents have been hidden. Usually a sign that something | 122 // Called when our WebContents have been hidden. Usually a sign that something |
| 123 // like another tab placed in front of it. | 123 // like another tab placed in front of it. |
| 124 void ContentWasHidden(); | 124 void ContentWasHidden(); |
| 125 void ContentWasShown(); | 125 void ContentWasShown(); |
| 126 | 126 |
| 127 void ContentSurfaceChanged(jobject surface); | 127 void ContentSurfaceChanged(jobject surface); |
| 128 void GvrDelegateReady(); | 128 void GvrDelegateReady(); |
| 129 void AppButtonGesturePerformed(UiInterface::Direction direction); | 129 void AppButtonGesturePerformed(UiInterface::Direction direction); |
| 130 void AppButtonPressed(); | |
| 131 | 130 |
| 132 void ContentPhysicalBoundsChanged( | 131 void ContentPhysicalBoundsChanged( |
| 133 JNIEnv* env, | 132 JNIEnv* env, |
| 134 const base::android::JavaParamRef<jobject>& object, | 133 const base::android::JavaParamRef<jobject>& object, |
| 135 jint width, | 134 jint width, |
| 136 jint height, | 135 jint height, |
| 137 jfloat dpr); | 136 jfloat dpr); |
| 138 | 137 |
| 139 // Perform a UI action triggered by the javascript API. | 138 // Perform a UI action triggered by the javascript API. |
| 140 void DoUiAction(const UiAction action, | 139 void DoUiAction(const UiAction action, |
| 141 const base::DictionaryValue* arguments); | 140 const base::DictionaryValue* arguments); |
| 142 | 141 |
| 143 void SetContentCssSize(float width, float height, float dpr); | 142 void SetContentCssSize(float width, float height, float dpr); |
| 144 | 143 |
| 145 void ContentFrameWasResized(bool width_changed); | 144 void ContentFrameWasResized(bool width_changed); |
| 146 | 145 |
| 147 void ForceExitVr(); | 146 void ForceExitVr(); |
| 148 | 147 |
| 149 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); | 148 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); |
| 150 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model); | 149 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model); |
| 151 | 150 |
| 152 // device::GvrGamepadDataProvider implementation. | 151 // device::GvrGamepadDataProvider implementation. |
| 153 void UpdateGamepadData(device::GvrGamepadData) override; | 152 void UpdateGamepadData(device::GvrGamepadData) override; |
| 154 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override; | 153 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override; |
| 155 | 154 |
| 156 private: | 155 private: |
| 157 ~VrShell() override; | 156 ~VrShell() override; |
| 158 void PostToGlThreadWhenReady(const base::Closure& task); | 157 void PostToGlThreadWhenReady(const base::Closure& task); |
| 159 void SetContentPaused(bool paused); | |
| 160 void SetUiState(); | 158 void SetUiState(); |
| 161 | 159 |
| 162 // device::GvrDelegate implementation. | 160 // device::GvrDelegate implementation. |
| 163 void SetWebVRSecureOrigin(bool secure_origin) override; | 161 void SetWebVRSecureOrigin(bool secure_origin) override; |
| 164 void SubmitWebVRFrame(int16_t frame_index, | 162 void SubmitWebVRFrame(int16_t frame_index, |
| 165 const gpu::MailboxHolder& mailbox) override; | 163 const gpu::MailboxHolder& mailbox) override; |
| 166 void UpdateWebVRTextureBounds(int16_t frame_index, | 164 void UpdateWebVRTextureBounds(int16_t frame_index, |
| 167 const gfx::RectF& left_bounds, | 165 const gfx::RectF& left_bounds, |
| 168 const gfx::RectF& right_bounds, | 166 const gfx::RectF& right_bounds, |
| 169 const gfx::Size& source_size) override; | 167 const gfx::Size& source_size) override; |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 base::WeakPtrFactory<VrShell> weak_ptr_factory_; | 218 base::WeakPtrFactory<VrShell> weak_ptr_factory_; |
| 221 | 219 |
| 222 DISALLOW_COPY_AND_ASSIGN(VrShell); | 220 DISALLOW_COPY_AND_ASSIGN(VrShell); |
| 223 }; | 221 }; |
| 224 | 222 |
| 225 bool RegisterVrShell(JNIEnv* env); | 223 bool RegisterVrShell(JNIEnv* env); |
| 226 | 224 |
| 227 } // namespace vr_shell | 225 } // namespace vr_shell |
| 228 | 226 |
| 229 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ | 227 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ |
| OLD | NEW |