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

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

Issue 2867783002: 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 const base::DictionaryValue* arguments) { 424 const base::DictionaryValue* arguments) {
425 // Actions that can be handled natively. 425 // Actions that can be handled natively.
426 switch (action) { 426 switch (action) {
427 case HISTORY_BACK: 427 case HISTORY_BACK:
428 if (web_contents_ && web_contents_->IsFullscreen()) { 428 if (web_contents_ && web_contents_->IsFullscreen()) {
429 web_contents_->ExitFullscreen(false); 429 web_contents_->ExitFullscreen(false);
430 return; 430 return;
431 } 431 }
432 // Otherwise handle in java. 432 // Otherwise handle in java.
433 break; 433 break;
434 case EXIT_PRESENT:
435 delegate_provider_->ExitWebVRPresent();
436 return;
437 default: 434 default:
438 break; 435 break;
439 } 436 }
440 // Actions that are handled in java. 437 // Actions that are handled in java.
441 JNIEnv* env = base::android::AttachCurrentThread(); 438 JNIEnv* env = base::android::AttachCurrentThread();
442 switch (action) { 439 switch (action) {
443 case SHOW_TAB: { 440 case SHOW_TAB: {
444 int id; 441 int id;
445 CHECK(arguments->GetInteger("id", &id)); 442 CHECK(arguments->GetInteger("id", &id));
446 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id); 443 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 void VrShell::ContentWasShown() { 486 void VrShell::ContentWasShown() {
490 if (web_contents_) 487 if (web_contents_)
491 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_); 488 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_);
492 } 489 }
493 490
494 void VrShell::ForceExitVr() { 491 void VrShell::ForceExitVr() {
495 JNIEnv* env = base::android::AttachCurrentThread(); 492 JNIEnv* env = base::android::AttachCurrentThread();
496 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj()); 493 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj());
497 } 494 }
498 495
496 void VrShell::ExitPresent() {
497 delegate_provider_->ExitWebVRPresent();
498 }
499
499 void VrShell::OnVRVsyncProviderRequest( 500 void VrShell::OnVRVsyncProviderRequest(
500 device::mojom::VRVSyncProviderRequest request) { 501 device::mojom::VRVSyncProviderRequest request) {
501 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest, 502 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest,
502 gl_thread_->GetVrShellGl(), 503 gl_thread_->GetVrShellGl(),
503 base::Passed(&request))); 504 base::Passed(&request)));
504 } 505 }
505 506
506 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos, 507 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos,
507 double interval_seconds) { 508 double interval_seconds) {
508 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval, 509 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 jboolean for_web_vr, 559 jboolean for_web_vr,
559 jlong gvr_api, 560 jlong gvr_api,
560 jboolean reprojected_rendering) { 561 jboolean reprojected_rendering) {
561 return reinterpret_cast<intptr_t>(new VrShell( 562 return reinterpret_cast<intptr_t>(new VrShell(
562 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 563 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
563 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 564 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
564 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 565 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
565 } 566 }
566 567
567 } // namespace vr_shell 568 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698