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

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

Issue 2774933003: Fixes WebVR presentation from within VRShell. (Closed)
Patch Set: Rebased on ToT, nits 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 #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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 } 390 }
391 391
392 void VrShell::CreateVRDisplayInfo( 392 void VrShell::CreateVRDisplayInfo(
393 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback, 393 const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
394 uint32_t device_id) { 394 uint32_t device_id) {
395 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo, 395 PostToGlThreadWhenReady(base::Bind(&VrShellGl::CreateVRDisplayInfo,
396 gl_thread_->GetVrShellGl(), callback, 396 gl_thread_->GetVrShellGl(), callback,
397 device_id)); 397 device_id));
398 } 398 }
399 399
400 void VrShell::SetSubmitClient(
401 device::mojom::VRSubmitFrameClientPtr submit_client) {
402 PostToGlThreadWhenReady(
403 base::Bind(&VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(),
404 base::Passed(submit_client.PassInterface())));
405 }
406
400 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface( 407 base::android::ScopedJavaGlobalRef<jobject> VrShell::TakeContentSurface(
401 JNIEnv* env, 408 JNIEnv* env,
402 const JavaParamRef<jobject>& obj) { 409 const JavaParamRef<jobject>& obj) {
403 content_compositor_->SurfaceChanged(nullptr); 410 content_compositor_->SurfaceChanged(nullptr);
404 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_); 411 base::android::ScopedJavaGlobalRef<jobject> surface(env, content_surface_);
405 content_surface_ = nullptr; 412 content_surface_ = nullptr;
406 return surface; 413 return surface;
407 } 414 }
408 415
409 void VrShell::RestoreContentSurface(JNIEnv* env, 416 void VrShell::RestoreContentSurface(JNIEnv* env,
(...skipping 14 matching lines...) Expand all
424 } 431 }
425 432
426 void VrShell::ContentSurfaceChanged(jobject surface) { 433 void VrShell::ContentSurfaceChanged(jobject surface) {
427 content_surface_ = surface; 434 content_surface_ = surface;
428 content_compositor_->SurfaceChanged(surface); 435 content_compositor_->SurfaceChanged(surface);
429 JNIEnv* env = base::android::AttachCurrentThread(); 436 JNIEnv* env = base::android::AttachCurrentThread();
430 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj()); 437 Java_VrShellImpl_contentSurfaceChanged(env, j_vr_shell_.obj());
431 } 438 }
432 439
433 void VrShell::GvrDelegateReady() { 440 void VrShell::GvrDelegateReady() {
434 PostToGlThreadWhenReady(base::Bind(
435 &VrShellGl::SetSubmitClient, gl_thread_->GetVrShellGl(),
436 base::Passed(
437 delegate_provider_->TakeSubmitFrameClient().PassInterface())));
438 delegate_provider_->SetPresentingDelegate(this, gvr_api_); 441 delegate_provider_->SetPresentingDelegate(this, gvr_api_);
439 } 442 }
440 443
441 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) { 444 void VrShell::AppButtonGesturePerformed(UiInterface::Direction direction) {
442 if (vr_shell_enabled_) 445 if (vr_shell_enabled_)
443 html_interface_->HandleAppButtonGesturePerformed(direction); 446 html_interface_->HandleAppButtonGesturePerformed(direction);
444 } 447 }
445 448
446 void VrShell::AppButtonPressed() { 449 void VrShell::AppButtonPressed() {
447 if (vr_shell_enabled_) 450 if (vr_shell_enabled_)
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 jboolean reprojected_rendering) { 804 jboolean reprojected_rendering) {
802 return reinterpret_cast<intptr_t>(new VrShell( 805 return reinterpret_cast<intptr_t>(new VrShell(
803 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android), 806 env, obj, reinterpret_cast<ui::WindowAndroid*>(content_window_android),
804 content::WebContents::FromJavaWebContents(ui_web_contents), 807 content::WebContents::FromJavaWebContents(ui_web_contents),
805 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr, 808 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), for_web_vr,
806 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 809 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
807 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 810 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
808 } 811 }
809 812
810 } // namespace vr_shell 813 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell.h ('k') | chrome/browser/android/vr_shell/vr_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698