Chromium Code Reviews| Index: chrome/browser/android/vr_shell/vr_shell.cc |
| diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc |
| index a649757d1fa4bf7b6a466cbc35e1883bab7bf3bf..aaf62f9edbf667b4a54134370c032e03ca82da57 100644 |
| --- a/chrome/browser/android/vr_shell/vr_shell.cc |
| +++ b/chrome/browser/android/vr_shell/vr_shell.cc |
| @@ -18,6 +18,7 @@ |
| #include "chrome/browser/android/vr_shell/vr_web_contents_observer.h" |
| #include "chrome/browser/browser_process.h" |
| #include "components/rappor/rappor_utils.h" |
| +#include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/render_view_host.h" |
| #include "content/public/browser/render_widget_host.h" |
| @@ -235,6 +236,8 @@ void VrShell::GvrInit(JNIEnv* env, |
| metrics_helper_->SetWebVREnabled(webvr_mode_); |
| metrics_helper_->SetVRActive(true); |
| + SetShowingOverscrollGlow(false); |
|
bshe
2016/11/25 14:55:00
I am assuming this is the place that calling SetSh
asimjour1
2016/12/01 20:17:45
ctor of VrShell is called on UI thread, but Render
bshe
2016/12/01 20:43:41
Is it possible to call it once RVH is ready on UI
mthiesse
2016/12/01 22:15:39
Yes, please add RenderViewHostChanged to vr_web_co
asimjour1
2016/12/05 18:57:08
Done.
asimjour1
2016/12/05 18:57:08
Done.
|
| + |
| gvr_api_ = |
| gvr::GvrApi::WrapNonOwned(reinterpret_cast<gvr_context*>(native_gvr_api)); |
| // TODO(klausw,crbug.com/655722): should report OnGvrDelegateReady here once |
| @@ -870,6 +873,7 @@ void VrShell::OnPause(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| return; |
| controller_->OnPause(); |
| gvr_api_->PauseTracking(); |
| + SetShowingOverscrollGlow(true); |
| // exit vr session |
| metrics_helper_->SetVRActive(false); |
| @@ -882,11 +886,24 @@ void VrShell::OnResume(JNIEnv* env, const JavaParamRef<jobject>& obj) { |
| gvr_api_->RefreshViewerProfile(); |
| gvr_api_->ResumeTracking(); |
| controller_->OnResume(); |
| + SetShowingOverscrollGlow(false); |
| // exit vr session |
| metrics_helper_->SetVRActive(true); |
| } |
| +void VrShell::SetShowingOverscrollGlow(bool showing_glow) { |
| + if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) { |
| + content::BrowserThread::PostTask( |
| + content::BrowserThread::UI, FROM_HERE, |
| + base::Bind(&VrShell::SetShowingOverscrollGlow, |
| + weak_ptr_factory_.GetWeakPtr(), showing_glow)); |
| + } else { |
| + main_contents_->GetRenderWidgetHostView()->SetShowingOverscrollGlow( |
| + showing_glow); |
| + } |
| +} |
| + |
| base::WeakPtr<VrShell> VrShell::GetWeakPtr( |
| const content::WebContents* web_contents) { |
| // Ensure that the WebContents requesting the VrShell instance is the one |