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

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

Issue 2861003003: VR: Enable browsing for CCT and make ui_scene_manager aware of whether we're in CCT. (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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 base::Passed(&controller_model))); 76 base::Passed(&controller_model)));
77 } 77 }
78 } 78 }
79 79
80 } // namespace 80 } // namespace
81 81
82 VrShell::VrShell(JNIEnv* env, 82 VrShell::VrShell(JNIEnv* env,
83 jobject obj, 83 jobject obj,
84 ui::WindowAndroid* window, 84 ui::WindowAndroid* window,
85 bool for_web_vr, 85 bool for_web_vr,
86 bool in_cct,
cjgrant 2017/05/05 14:21:56 General observation (discussed offline). We have
mthiesse 2017/05/05 14:25:57 Agreed in general, but for cct state in particular
86 VrShellDelegate* delegate, 87 VrShellDelegate* delegate,
87 gvr_context* gvr_api, 88 gvr_context* gvr_api,
88 bool reprojected_rendering) 89 bool reprojected_rendering)
89 : vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)), 90 : vr_shell_enabled_(base::FeatureList::IsEnabled(features::kVrShell)),
90 window_(window), 91 window_(window),
91 compositor_(base::MakeUnique<VrCompositor>(window_)), 92 compositor_(base::MakeUnique<VrCompositor>(window_)),
92 delegate_provider_(delegate), 93 delegate_provider_(delegate),
93 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), 94 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
94 reprojected_rendering_(reprojected_rendering), 95 reprojected_rendering_(reprojected_rendering),
95 gvr_api_(gvr_api), 96 gvr_api_(gvr_api),
96 weak_ptr_factory_(this) { 97 weak_ptr_factory_(this) {
97 DVLOG(1) << __FUNCTION__ << "=" << this; 98 DVLOG(1) << __FUNCTION__ << "=" << this;
98 DCHECK(g_instance == nullptr); 99 DCHECK(g_instance == nullptr);
99 g_instance = this; 100 g_instance = this;
100 j_vr_shell_.Reset(env, obj); 101 j_vr_shell_.Reset(env, obj);
101 102
102 gl_thread_ = base::MakeUnique<VrGLThread>(weak_ptr_factory_.GetWeakPtr(), 103 gl_thread_ = base::MakeUnique<VrGLThread>(
103 main_thread_task_runner_, gvr_api, 104 weak_ptr_factory_.GetWeakPtr(), main_thread_task_runner_, gvr_api,
104 for_web_vr, reprojected_rendering_); 105 for_web_vr, in_cct, reprojected_rendering_);
105 106
106 base::Thread::Options options(base::MessageLoop::TYPE_DEFAULT, 0); 107 base::Thread::Options options(base::MessageLoop::TYPE_DEFAULT, 0);
107 options.priority = base::ThreadPriority::DISPLAY; 108 options.priority = base::ThreadPriority::DISPLAY;
108 gl_thread_->StartWithOptions(options); 109 gl_thread_->StartWithOptions(options);
109 110
110 ui_ = base::MakeUnique<UiInterface>(for_web_vr ? UiInterface::Mode::WEB_VR 111 ui_ = base::MakeUnique<UiInterface>(for_web_vr ? UiInterface::Mode::WEB_VR
111 : UiInterface::Mode::STANDARD); 112 : UiInterface::Mode::STANDARD);
112 113
113 content::BrowserThread::PostTask( 114 content::BrowserThread::PostTask(
114 content::BrowserThread::FILE, FROM_HERE, 115 content::BrowserThread::FILE, FROM_HERE,
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 557
557 // ---------------------------------------------------------------------------- 558 // ----------------------------------------------------------------------------
558 // Native JNI methods 559 // Native JNI methods
559 // ---------------------------------------------------------------------------- 560 // ----------------------------------------------------------------------------
560 561
561 jlong Init(JNIEnv* env, 562 jlong Init(JNIEnv* env,
562 const JavaParamRef<jobject>& obj, 563 const JavaParamRef<jobject>& obj,
563 const base::android::JavaParamRef<jobject>& delegate, 564 const base::android::JavaParamRef<jobject>& delegate,
564 jlong window_android, 565 jlong window_android,
565 jboolean for_web_vr, 566 jboolean for_web_vr,
567 jboolean in_cct,
566 jlong gvr_api, 568 jlong gvr_api,
567 jboolean reprojected_rendering) { 569 jboolean reprojected_rendering) {
568 return reinterpret_cast<intptr_t>(new VrShell( 570 return reinterpret_cast<intptr_t>(new VrShell(
569 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android), 571 env, obj, reinterpret_cast<ui::WindowAndroid*>(window_android),
570 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 572 for_web_vr, in_cct,
573 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
571 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 574 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
572 } 575 }
573 576
574 } // namespace vr_shell 577 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698