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

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

Issue 2688113002: Make ViewRoot the top of the ViewAndroid tree (Closed)
Patch Set: - Created 3 years, 10 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 void SetIsInVR(content::WebContents* contents, bool is_in_vr) { 57 void SetIsInVR(content::WebContents* contents, bool is_in_vr) {
58 if (contents->GetRenderWidgetHostView()) 58 if (contents->GetRenderWidgetHostView())
59 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr); 59 contents->GetRenderWidgetHostView()->SetIsInVR(is_in_vr);
60 } 60 }
61 61
62 } // namespace 62 } // namespace
63 63
64 VrShell::VrShell(JNIEnv* env, 64 VrShell::VrShell(JNIEnv* env,
65 jobject obj, 65 jobject obj,
66 content::WebContents* main_contents, 66 content::WebContents* main_contents,
67 ui::WindowAndroid* content_window, 67 ui::ViewRoot* content_view_root,
68 content::WebContents* ui_contents, 68 content::WebContents* ui_contents,
69 ui::WindowAndroid* ui_window, 69 ui::ViewRoot* ui_view_root,
70 bool for_web_vr, 70 bool for_web_vr,
71 VrShellDelegate* delegate, 71 VrShellDelegate* delegate,
72 gvr_context* gvr_api, 72 gvr_context* gvr_api,
73 bool reprojected_rendering) 73 bool reprojected_rendering)
74 : WebContentsObserver(ui_contents), 74 : WebContentsObserver(ui_contents),
75 main_contents_(main_contents), 75 main_contents_(main_contents),
76 content_compositor_( 76 content_compositor_(
77 base::MakeUnique<VrCompositor>(content_window, false)), 77 base::MakeUnique<VrCompositor>(content_view_root, false)),
78 ui_contents_(ui_contents), 78 ui_contents_(ui_contents),
79 ui_compositor_(base::MakeUnique<VrCompositor>(ui_window, true)), 79 ui_compositor_(base::MakeUnique<VrCompositor>(ui_view_root, true)),
80 delegate_provider_(delegate), 80 delegate_provider_(delegate),
81 metrics_helper_(base::MakeUnique<VrMetricsHelper>(main_contents_)), 81 metrics_helper_(base::MakeUnique<VrMetricsHelper>(main_contents_)),
82 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), 82 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
83 reprojected_rendering_(reprojected_rendering), 83 reprojected_rendering_(reprojected_rendering),
84 gvr_api_(gvr_api), 84 gvr_api_(gvr_api),
85 weak_ptr_factory_(this) { 85 weak_ptr_factory_(this) {
86 DCHECK(g_instance == nullptr); 86 DCHECK(g_instance == nullptr);
87 g_instance = this; 87 g_instance = this;
88 j_vr_shell_.Reset(env, obj); 88 j_vr_shell_.Reset(env, obj);
89 89
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 eye_params->offset[2] = -eye_mat.m[2][3]; 588 eye_params->offset[2] = -eye_mat.m[2][3];
589 } 589 }
590 590
591 return device; 591 return device;
592 } 592 }
593 593
594 // ---------------------------------------------------------------------------- 594 // ----------------------------------------------------------------------------
595 // Native JNI methods 595 // Native JNI methods
596 // ---------------------------------------------------------------------------- 596 // ----------------------------------------------------------------------------
597 597
598 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj, 598 jlong Init(JNIEnv* env,
599 const JavaParamRef<jobject>& obj,
599 const JavaParamRef<jobject>& content_web_contents, 600 const JavaParamRef<jobject>& content_web_contents,
600 jlong content_window_android, 601 jlong content_view_root,
601 const JavaParamRef<jobject>& ui_web_contents, 602 const JavaParamRef<jobject>& ui_web_contents,
602 jlong ui_window_android, jboolean for_web_vr, 603 jlong ui_view_root,
604 jboolean for_web_vr,
603 const base::android::JavaParamRef<jobject>& delegate, 605 const base::android::JavaParamRef<jobject>& delegate,
604 jlong gvr_api, jboolean reprojected_rendering) { 606 jlong gvr_api,
607 jboolean reprojected_rendering) {
605 return reinterpret_cast<intptr_t>(new VrShell( 608 return reinterpret_cast<intptr_t>(new VrShell(
606 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), 609 env, obj, content::WebContents::FromJavaWebContents(content_web_contents),
607 reinterpret_cast<ui::WindowAndroid*>(content_window_android), 610 reinterpret_cast<ui::ViewRoot*>(content_view_root),
608 content::WebContents::FromJavaWebContents(ui_web_contents), 611 content::WebContents::FromJavaWebContents(ui_web_contents),
609 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), 612 reinterpret_cast<ui::ViewRoot*>(ui_view_root), for_web_vr,
610 for_web_vr, VrShellDelegate::GetNativeVrShellDelegate(env, delegate), 613 VrShellDelegate::GetNativeVrShellDelegate(env, delegate),
611 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 614 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
612 } 615 }
613 616
614 } // namespace vr_shell 617 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698