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

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

Issue 2595263002: Introduce ViewRoot forwarding input/view events to native (Closed)
Patch Set: rebased & ViewAndroud::Bounds Created 3 years, 11 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 "base/metrics/histogram_macros.h" 9 #include "base/metrics/histogram_macros.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 gvr_context* gvr_api_; 95 gvr_context* gvr_api_;
96 bool initially_web_vr_; 96 bool initially_web_vr_;
97 bool reprojected_rendering_; 97 bool reprojected_rendering_;
98 }; 98 };
99 99
100 } // namespace 100 } // namespace
101 101
102 VrShell::VrShell(JNIEnv* env, 102 VrShell::VrShell(JNIEnv* env,
103 jobject obj, 103 jobject obj,
104 content::WebContents* main_contents, 104 content::WebContents* main_contents,
105 ui::WindowAndroid* content_window, 105 ui::ViewRoot* content_view_root,
106 content::WebContents* ui_contents, 106 content::WebContents* ui_contents,
107 ui::WindowAndroid* ui_window, 107 ui::ViewRoot* ui_view_root,
108 bool for_web_vr, 108 bool for_web_vr,
109 VrShellDelegate* delegate, 109 VrShellDelegate* delegate,
110 gvr_context* gvr_api, 110 gvr_context* gvr_api,
111 bool reprojected_rendering) 111 bool reprojected_rendering)
112 : WebContentsObserver(ui_contents), 112 : WebContentsObserver(ui_contents),
113 main_contents_(main_contents), 113 main_contents_(main_contents),
114 content_compositor_(new VrCompositor(content_window, false)), 114 content_compositor_(new VrCompositor(content_view_root, false)),
115 ui_contents_(ui_contents), 115 ui_contents_(ui_contents),
116 ui_compositor_(new VrCompositor(ui_window, true)), 116 ui_compositor_(new VrCompositor(ui_view_root, true)),
117 delegate_(delegate), 117 delegate_(delegate),
118 metrics_helper_(new VrMetricsHelper(main_contents_)), 118 metrics_helper_(new VrMetricsHelper(main_contents_)),
119 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()), 119 main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
120 reprojected_rendering_(reprojected_rendering), 120 reprojected_rendering_(reprojected_rendering),
121 weak_ptr_factory_(this) { 121 weak_ptr_factory_(this) {
122 DCHECK(g_instance == nullptr); 122 DCHECK(g_instance == nullptr);
123 g_instance = this; 123 g_instance = this;
124 j_vr_shell_.Reset(env, obj); 124 j_vr_shell_.Reset(env, obj);
125 125
126 content_input_manager_.reset(new VrInputManager(main_contents_)); 126 content_input_manager_.reset(new VrInputManager(main_contents_));
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 JNIEnv* env = base::android::AttachCurrentThread(); 469 JNIEnv* env = base::android::AttachCurrentThread();
470 Java_VrShellImpl_setUiCssSize(env, j_vr_shell_.obj(), width, height, dpr); 470 Java_VrShellImpl_setUiCssSize(env, j_vr_shell_.obj(), width, height, dpr);
471 } 471 }
472 472
473 // ---------------------------------------------------------------------------- 473 // ----------------------------------------------------------------------------
474 // Native JNI methods 474 // Native JNI methods
475 // ---------------------------------------------------------------------------- 475 // ----------------------------------------------------------------------------
476 476
477 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj, 477 jlong Init(JNIEnv* env, const JavaParamRef<jobject>& obj,
478 const JavaParamRef<jobject>& content_web_contents, 478 const JavaParamRef<jobject>& content_web_contents,
479 jlong content_window_android, 479 jlong content_view_root,
480 const JavaParamRef<jobject>& ui_web_contents, 480 const JavaParamRef<jobject>& ui_web_contents,
481 jlong ui_window_android, jboolean for_web_vr, 481 jlong ui_view_root, jboolean for_web_vr,
482 const base::android::JavaParamRef<jobject>& delegate, 482 const base::android::JavaParamRef<jobject>& delegate,
483 jlong gvr_api, jboolean reprojected_rendering) { 483 jlong gvr_api, jboolean reprojected_rendering) {
484 return reinterpret_cast<intptr_t>(new VrShell( 484 return reinterpret_cast<intptr_t>(new VrShell(
485 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), 485 env, obj, content::WebContents::FromJavaWebContents(content_web_contents),
486 reinterpret_cast<ui::WindowAndroid*>(content_window_android), 486 reinterpret_cast<ui::ViewRoot*>(content_view_root),
487 content::WebContents::FromJavaWebContents(ui_web_contents), 487 content::WebContents::FromJavaWebContents(ui_web_contents),
488 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), 488 reinterpret_cast<ui::ViewRoot*>(ui_view_root),
489 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate), 489 for_web_vr, VrShellDelegate::GetNativeDelegate(env, delegate),
490 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering)); 490 reinterpret_cast<gvr_context*>(gvr_api), reprojected_rendering));
491 } 491 }
492 492
493 } // namespace vr_shell 493 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698