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

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

Issue 2874103003: Revert 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;
428 default: 431 default:
429 break; 432 break;
430 } 433 }
431 // Actions that are handled in java. 434 // Actions that are handled in java.
432 JNIEnv* env = base::android::AttachCurrentThread(); 435 JNIEnv* env = base::android::AttachCurrentThread();
433 switch (action) { 436 switch (action) {
434 case SHOW_TAB: { 437 case SHOW_TAB: {
435 int id; 438 int id;
436 CHECK(arguments->GetInteger("id", &id)); 439 CHECK(arguments->GetInteger("id", &id));
437 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id); 440 Java_VrShellImpl_showTab(env, j_vr_shell_.obj(), id);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 void VrShell::ContentWasShown() { 480 void VrShell::ContentWasShown() {
478 if (web_contents_) 481 if (web_contents_)
479 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_); 482 input_manager_ = base::MakeUnique<VrInputManager>(web_contents_);
480 } 483 }
481 484
482 void VrShell::ForceExitVr() { 485 void VrShell::ForceExitVr() {
483 JNIEnv* env = base::android::AttachCurrentThread(); 486 JNIEnv* env = base::android::AttachCurrentThread();
484 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj()); 487 Java_VrShellImpl_forceExitVr(env, j_vr_shell_.obj());
485 } 488 }
486 489
487 void VrShell::ExitPresent() {
488 delegate_provider_->ExitWebVRPresent();
489 }
490
491 void VrShell::OnVRVsyncProviderRequest( 490 void VrShell::OnVRVsyncProviderRequest(
492 device::mojom::VRVSyncProviderRequest request) { 491 device::mojom::VRVSyncProviderRequest request) {
493 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest, 492 PostToGlThreadWhenReady(base::Bind(&VrShellGl::OnRequest,
494 gl_thread_->GetVrShellGl(), 493 gl_thread_->GetVrShellGl(),
495 base::Passed(&request))); 494 base::Passed(&request)));
496 } 495 }
497 496
498 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos, 497 void VrShell::UpdateVSyncInterval(int64_t timebase_nanos,
499 double interval_seconds) { 498 double interval_seconds) {
500 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval, 499 PostToGlThreadWhenReady(base::Bind(&VrShellGl::UpdateVSyncInterval,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 jlong gvr_api, 551 jlong gvr_api,
553 jboolean reprojected_rendering) { 552 jboolean reprojected_rendering) {
554 return reinterpret_cast<intptr_t>(new VrShell( 553 return reinterpret_cast<intptr_t>(new VrShell(
555 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 554 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
556 for_web_vr, in_cct, 555 for_web_vr, in_cct,
557 VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 556 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
558 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 557 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
559 } 558 }
560 559
561 } // namespace vr_shell 560 } // 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