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

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

Issue 2524423002: VR: Disable Overscroll Glow in VrShell (Closed)
Patch Set: VR: Disable Overscroll Glow in VrShell Created 4 years 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 "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "chrome/browser/android/vr_shell/ui_elements.h" 8 #include "chrome/browser/android/vr_shell/ui_elements.h"
9 #include "chrome/browser/android/vr_shell/ui_interface.h" 9 #include "chrome/browser/android/vr_shell/ui_interface.h"
10 #include "chrome/browser/android/vr_shell/ui_scene.h" 10 #include "chrome/browser/android/vr_shell/ui_scene.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 181
182 gvr::Mat4f identity; 182 gvr::Mat4f identity;
183 SetIdentityM(identity); 183 SetIdentityM(identity);
184 webvr_head_pose_.resize(kPoseRingBufferSize, identity); 184 webvr_head_pose_.resize(kPoseRingBufferSize, identity);
185 webvr_head_pose_valid_.resize(kPoseRingBufferSize, false); 185 webvr_head_pose_valid_.resize(kPoseRingBufferSize, false);
186 186
187 content_input_manager_.reset(new VrInputManager(main_contents_)); 187 content_input_manager_.reset(new VrInputManager(main_contents_));
188 ui_input_manager_.reset(new VrInputManager(ui_contents_)); 188 ui_input_manager_.reset(new VrInputManager(ui_contents_));
189 weak_content_input_manager_ = content_input_manager_->GetWeakPtr(); 189 weak_content_input_manager_ = content_input_manager_->GetWeakPtr();
190 weak_ui_input_manager_ = ui_input_manager_->GetWeakPtr(); 190 weak_ui_input_manager_ = ui_input_manager_->GetWeakPtr();
191
192 SetShowingOverscrollGlow(false);
191 } 193 }
192 194
193 void VrShell::UpdateCompositorLayers(JNIEnv* env, 195 void VrShell::UpdateCompositorLayers(JNIEnv* env,
194 const JavaParamRef<jobject>& obj) { 196 const JavaParamRef<jobject>& obj) {
195 content_compositor_->SetLayer(main_contents_); 197 content_compositor_->SetLayer(main_contents_);
196 ui_compositor_->SetLayer(ui_contents_); 198 ui_compositor_->SetLayer(ui_contents_);
197 } 199 }
198 200
199 void VrShell::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) { 201 void VrShell::Destroy(JNIEnv* env, const JavaParamRef<jobject>& obj) {
200 delete this; 202 delete this;
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) { 932 void VrShell::OnTriggerEvent(JNIEnv* env, const JavaParamRef<jobject>& obj) {
931 // Set a flag to handle this on the render thread at the next frame. 933 // Set a flag to handle this on the render thread at the next frame.
932 touch_pending_ = true; 934 touch_pending_ = true;
933 } 935 }
934 936
935 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { 937 void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) {
936 if (gvr_api_ == nullptr) 938 if (gvr_api_ == nullptr)
937 return; 939 return;
938 controller_->OnPause(); 940 controller_->OnPause();
939 gvr_api_->PauseTracking(); 941 gvr_api_->PauseTracking();
942 SetShowingOverscrollGlow(true);
940 943
941 // exit vr session 944 // exit vr session
942 metrics_helper_->SetVRActive(false); 945 metrics_helper_->SetVRActive(false);
943 } 946 }
944 947
945 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { 948 void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) {
946 if (gvr_api_ == nullptr) 949 if (gvr_api_ == nullptr)
947 return; 950 return;
948 951
949 gvr_api_->RefreshViewerProfile(); 952 gvr_api_->RefreshViewerProfile();
950 gvr_api_->ResumeTracking(); 953 gvr_api_->ResumeTracking();
951 controller_->OnResume(); 954 controller_->OnResume();
955 SetShowingOverscrollGlow(false);
952 956
953 // exit vr session 957 // exit vr session
954 metrics_helper_->SetVRActive(true); 958 metrics_helper_->SetVRActive(true);
955 } 959 }
956 960
961 void VrShell::SetShowingOverscrollGlow(bool showing_glow) {
962 main_contents_->GetRenderWidgetHostView()->SetShowingOverscrollGlow(
963 showing_glow);
964 }
965
957 base::WeakPtr<VrShell> VrShell::GetWeakPtr( 966 base::WeakPtr<VrShell> VrShell::GetWeakPtr(
958 const content::WebContents* web_contents) { 967 const content::WebContents* web_contents) {
959 // Ensure that the WebContents requesting the VrShell instance is the one 968 // Ensure that the WebContents requesting the VrShell instance is the one
960 // we created. 969 // we created.
961 if (g_instance != nullptr && g_instance->ui_contents_ == web_contents) 970 if (g_instance != nullptr && g_instance->ui_contents_ == web_contents)
962 return g_instance->weak_ptr_factory_.GetWeakPtr(); 971 return g_instance->weak_ptr_factory_.GetWeakPtr();
963 return base::WeakPtr<VrShell>(nullptr); 972 return base::WeakPtr<VrShell>(nullptr);
964 } 973 }
965 974
966 void VrShell::OnDomContentsLoaded() { 975 void VrShell::OnDomContentsLoaded() {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 jboolean for_web_vr) { 1154 jboolean for_web_vr) {
1146 return reinterpret_cast<intptr_t>(new VrShell( 1155 return reinterpret_cast<intptr_t>(new VrShell(
1147 env, obj, content::WebContents::FromJavaWebContents(content_web_contents), 1156 env, obj, content::WebContents::FromJavaWebContents(content_web_contents),
1148 reinterpret_cast<ui::WindowAndroid*>(content_window_android), 1157 reinterpret_cast<ui::WindowAndroid*>(content_window_android),
1149 content::WebContents::FromJavaWebContents(ui_web_contents), 1158 content::WebContents::FromJavaWebContents(ui_web_contents),
1150 reinterpret_cast<ui::WindowAndroid*>(ui_window_android), 1159 reinterpret_cast<ui::WindowAndroid*>(ui_window_android),
1151 for_web_vr)); 1160 for_web_vr));
1152 } 1161 }
1153 1162
1154 } // namespace vr_shell 1163 } // namespace vr_shell
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698