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

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

Issue 2876743002: Reland of App button click exits WebVR presentation. (Closed)
Patch Set: Created 3 years, 7 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 height)); 418 height));
419 compositor_->SetWindowBounds(gfx::Size(width, height)); 419 compositor_->SetWindowBounds(gfx::Size(width, height));
420 } 420 }
421 421
422 // Note that the following code is obsolete and is here as reference for the 422 // Note that the following code is obsolete and is here as reference for the
423 // actions that need to be implemented natively. 423 // actions that need to be implemented natively.
424 void VrShell::DoUiAction(const UiAction action, 424 void VrShell::DoUiAction(const UiAction action,
425 const base::DictionaryValue* arguments) { 425 const base::DictionaryValue* arguments) {
426 // Actions that can be handled natively. 426 // Actions that can be handled natively.
427 switch (action) { 427 switch (action) {
428 case EXIT_PRESENT:
429 delegate_provider_->ExitWebVRPresent();
430 return;
431 default: 428 default:
432 break; 429 break;
433 } 430 }
434 // Actions that are handled in java. 431 // Actions that are handled in java.
435 JNIEnv* env = base::android::AttachCurrentThread(); 432 JNIEnv* env = base::android::AttachCurrentThread();
436 switch (action) { 433 switch (action) {
437 case SHOW_TAB: { 434 case SHOW_TAB: {
438 int id; 435 int id;
439 CHECK(arguments->GetInteger("id", &id)); 436 CHECK(arguments->GetInteger("id", &id));
440 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id); 437 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 void VrShell::ContentWasShown() { 477 void VrShell::ContentWasShown() {
481 if (web_contents_) 478 if (web_contents_)
482 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_); 479 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_);
483 } 480 }
484 481
485 void VrShell::ForceExitVr() { 482 void VrShell::ForceExitVr() {
486 JNIEnv* env = base::android::AttachCurrentThread(); 483 JNIEnv* env = base::android::AttachCurrentThread();
487 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj()); 484 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj());
488 } 485 }
489 486
487 void VrShell::ExitPresent() {
488 delegate_provider_->ExitWebVRPresent();
489 }
490
490 void VrShell::OnVRVsyncProviderRequest( 491 void VrShell::OnVRVsyncProviderRequest(
491 device::mojom::VRVSyncProviderRequest request) { 492 device::mojom::VRVSyncProviderRequest request) {
492 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest, 493 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest,
493 gl_thread_->GetVrShellGl(), 494 gl_thread_->GetVrShellGl(),
494 base::Passed(&request))); 495 base::Passed(&request)));
495 } 496 }
496 497
497 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos, 498 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos,
498 double interval_seconds) { 499 double interval_seconds) {
499 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval, 500 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 jlong gvr_api, 552 jlong gvr_api,
552 jboolean reprojected_rendering) { 553 jboolean reprojected_rendering) {
553 return reinterpret_cast<intptr_t>(new VrShell( 554 return reinterpret_cast<intptr_t>(new VrShell(
554 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 555 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
555 for_web_vr, in_cct, 556 for_web_vr, in_cct,
556 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 557 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
557 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 558 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
558 } 559 }
559 560
560 } // namespace vr_shell 561 } // 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.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698