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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell.h

Issue 2833773005: Pause drawing webvr when the App button is pressed (Closed)
Patch Set: nit Created 3 years, 8 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 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 #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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(); 130 void AppButtonPressed(bool content_paused);
131 131
132 void ContentPhysicalBoundsChanged( 132 void ContentPhysicalBoundsChanged(
133 JNIEnv* env, 133 JNIEnv* env,
134 const base::android::JavaParamRef<jobject>& object, 134 const base::android::JavaParamRef<jobject>& object,
135 jint width, 135 jint width,
136 jint height, 136 jint height,
137 jfloat dpr); 137 jfloat dpr);
138 138
139 // Perform a UI action triggered by the javascript API. 139 // Perform a UI action triggered by the javascript API.
140 void DoUiAction(const UiAction action, 140 void DoUiAction(const UiAction action,
141 const base::DictionaryValue* arguments); 141 const base::DictionaryValue* arguments);
142 142
143 void SetContentCssSize(float width, float height, float dpr); 143 void SetContentCssSize(float width, float height, float dpr);
144 144
145 void ContentFrameWasResized(bool width_changed); 145 void ContentFrameWasResized(bool width_changed);
146 146
147 void ForceExitVr(); 147 void ForceExitVr();
148 148
149 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event); 149 void ProcessContentGesture(std::unique_ptr<blink::WebInputEvent> event);
150 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model); 150 void SubmitControllerModel(std::unique_ptr<VrControllerModel> model);
151 151
152 // device::GvrGamepadDataProvider implementation. 152 // device::GvrGamepadDataProvider implementation.
153 void UpdateGamepadData(device::GvrGamepadData) override; 153 void UpdateGamepadData(device::GvrGamepadData) override;
154 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override; 154 void RegisterGamepadDataFetcher(device::GvrGamepadDataFetcher*) override;
155 155
156 private: 156 private:
157 ~VrShell() override; 157 ~VrShell() override;
158 void PostToGlThreadWhenReady(const base::Closure& task); 158 void PostToGlThreadWhenReady(const base::Closure& task);
159 void SetContentPaused(bool paused); 159 void OnContentPaused(bool paused);
160 void SetUiState(); 160 void SetUiState();
161 161
162 // device::GvrDelegate implementation. 162 // device::GvrDelegate implementation.
163 void SetWebVRSecureOrigin(bool secure_origin) override; 163 void SetWebVRSecureOrigin(bool secure_origin) override;
164 void SubmitWebVRFrame(int16_t frame_index, 164 void SubmitWebVRFrame(int16_t frame_index,
165 const gpu::MailboxHolder& mailbox) override; 165 const gpu::MailboxHolder& mailbox) override;
166 void UpdateWebVRTextureBounds(int16_t frame_index, 166 void UpdateWebVRTextureBounds(int16_t frame_index,
167 const gfx::RectF& left_bounds, 167 const gfx::RectF& left_bounds,
168 const gfx::RectF& right_bounds, 168 const gfx::RectF& right_bounds,
169 const gfx::Size& source_size) override; 169 const gfx::Size& source_size) override;
170 void OnVRVsyncProviderRequest( 170 void OnVRVsyncProviderRequest(
171 device::mojom::VRVSyncProviderRequest request) override; 171 device::mojom::VRVSyncProviderRequest request) override;
172 void UpdateVSyncInterval(int64_t timebase_nanos, 172 void UpdateVSyncInterval(int64_t timebase_nanos,
173 double interval_seconds) override; 173 double interval_seconds) override;
174 void CreateVRDisplayInfo( 174 void CreateVRDisplayInfo(
175 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 175 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
176 uint32_t device_id) override; 176 uint32_t device_id) override;
177 177
178 // device::PresentingGvrDelegate implementation. 178 // device::PresentingGvrDelegate implementation.
179 void SetSubmitClient( 179 void SetSubmitClient(
180 device::mojom::VRSubmitFrameClientPtr submit_client) override; 180 device::mojom::VRSubmitFrameClientPtr submit_client) override;
181 181
182 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito); 182 void ProcessTabArray(JNIEnv* env, jobjectArray tabs, bool incognito);
183 183
184 bool vr_shell_enabled_; 184 bool vr_shell_enabled_;
185 185
186 std::unique_ptr<UiInterface> ui_; 186 std::unique_ptr<UiInterface> ui_;
187 bool content_paused_ = false; 187 bool content_paused_ = false;
bshe 2017/04/21 21:08:42 nit: remove this too?
ymalik 2017/04/28 00:12:04 Done.
188 bool webvr_mode_ = false; 188 bool webvr_mode_ = false;
189 189
190 content::WebContents* web_contents_ = nullptr; 190 content::WebContents* web_contents_ = nullptr;
191 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_; 191 base::android::ScopedJavaGlobalRef<jobject> j_motion_event_synthesizer_;
192 ui::WindowAndroid* window_; 192 ui::WindowAndroid* window_;
193 std::unique_ptr<VrCompositor> compositor_; 193 std::unique_ptr<VrCompositor> compositor_;
194 194
195 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_; 195 std::unique_ptr<VrWebContentsObserver> vr_web_contents_observer_;
196 196
197 VrShellDelegate* delegate_provider_ = nullptr; 197 VrShellDelegate* delegate_provider_ = nullptr;
(...skipping 22 matching lines...) Expand all
220 base::WeakPtrFactory<VrShell> weak_ptr_factory_; 220 base::WeakPtrFactory<VrShell> weak_ptr_factory_;
221 221
222 DISALLOW_COPY_AND_ASSIGN(VrShell); 222 DISALLOW_COPY_AND_ASSIGN(VrShell);
223 }; 223 };
224 224
225 bool RegisterVrShell(JNIEnv* env); 225 bool RegisterVrShell(JNIEnv* env);
226 226
227 } // namespace vr_shell 227 } // namespace vr_shell
228 228
229 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_ 229 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698