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

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

Issue 2774933003: Fixes WebVR presentation from within VRShell. (Closed)
Patch Set: Created 3 years, 9 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 #include "chrome/browser/android/vr_shell/vr_shell.h" 5 #include "chrome/browser/android/vr_shell/vr_shell.h"
6 6
7 #include <android/native_window_jni.h> 7 #include <android/native_window_jni.h>
8 8
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 364 }
365 365
366 void VrShell::CreateVRDisplayInfo( 366 void VrShell::CreateVRDisplayInfo(
367 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 367 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
368 uint32_t device_id) { 368 uint32_t device_id) {
369 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, 369 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo,
370 gl_thread_->GetVrShellGl(), callback, 370 gl_thread_->GetVrShellGl(), callback,
371 device_id)); 371 device_id));
372 } 372 }
373 373
374 void VrShell::SetSubmitClient(
375 device::mojom::VRSubmitFrameClientPtr submit_client) {
376 PostToGlThreadWhenReady(
377 base::Bind(&VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(),
378 base::Passed(submit_client.PassInterface())));
379 }
380
374 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( 381 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface(
375 JNIEnv* env, 382 JNIEnv* env,
376 const JavaParamRef<jobject>& obj) { 383 const JavaParamRef<jobject>& obj) {
377 content_compositor_->SurfaceChanged(nullptr); 384 content_compositor_->SurfaceChanged(nullptr);
378 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_); 385 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_);
379 content_surface_ = nullptr; 386 content_surface_ = nullptr;
380 return surface; 387 return surface;
381 } 388 }
382 389
383 void VrShell::RestoreContentSurface(JNIEnv* env, 390 void VrShell::RestoreContentSurface(JNIEnv* env,
(...skipping 14 matching lines...) Expand all
398 } 405 }
399 406
400 void VrShell::ContentSurfaceChanged(jobject surface) { 407 void VrShell::ContentSurfaceChanged(jobject surface) {
401 content_surface_ = surface; 408 content_surface_ = surface;
402 content_compositor_->SurfaceChanged(surface); 409 content_compositor_->SurfaceChanged(surface);
403 JNIEnv* env = base::android::AttachCurrentThread(); 410 JNIEnv* env = base::android::AttachCurrentThread();
404 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj()); 411 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj());
405 } 412 }
406 413
407 void VrShell::GvrDelegateReady() { 414 void VrShell::GvrDelegateReady() {
408 PostToGlThreadWhenReady(base::Bind(
409 &VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(),
410 base::Passed(
411 delegate_provider_->TakeSubmitFrameClient().PassInterface())));
412 delegate_provider_->SetPresentingDelegate(this, gvr_api_); 415 delegate_provider_->SetPresentingDelegate(this, gvr_api_);
tiborg 2017/03/24 21:58:51 It would be helpful if this call was made in the c
mthiesse 2017/03/30 15:29:46 What do you mean by the rendering doesn't start? H
tiborg 2017/03/30 22:19:57 It goes into the binocular view but it does not re
413 } 416 }
414 417
415 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) { 418 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) {
416 if (vr_shell_enabled_) 419 if (vr_shell_enabled_)
417 html_interface_->HandleAppButtonGesturePerformed(direction); 420 html_interface_->HandleAppButtonGesturePerformed(direction);
418 } 421 }
419 422
420 void VrShell::AppButtonPressed() { 423 void VrShell::AppButtonPressed() {
421 if (vr_shell_enabled_) 424 if (vr_shell_enabled_)
422 html_interface_->HandleAppButtonClicked(); 425 html_interface_->HandleAppButtonClicked();
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 jboolean reprojected_rendering) { 778 jboolean reprojected_rendering) {
776 return reinterpret_cast<intptr_t>(new VrShell( 779 return reinterpret_cast<intptr_t>(new VrShell(
777 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), 780 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android),
778 content::WebContents::FromJavaWebContents(ui_web_contents), 781 content::WebContents::FromJavaWebContents(ui_web_contents),
779 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, 782 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr,
780 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 783 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
781 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 784 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
782 } 785 }
783 786
784 } // namespace vr_shell 787 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698