| Index: chrome/browser/android/vr_shell/vr_shell_delegate.cc | 
| diff --git a/chrome/browser/android/vr_shell/vr_shell_delegate.cc b/chrome/browser/android/vr_shell/vr_shell_delegate.cc | 
| index 17a7ea3f9c603694d09864451bed19822a4e59aa..4563d1a04fbeab6197f542c9d37eea07f992f740 100644 | 
| --- a/chrome/browser/android/vr_shell/vr_shell_delegate.cc | 
| +++ b/chrome/browser/android/vr_shell/vr_shell_delegate.cc | 
| @@ -46,14 +46,9 @@ VrShellDelegate* VrShellDelegate::GetNativeVrShellDelegate(JNIEnv* env, | 
|  | 
| void VrShellDelegate::SetDelegate(device::GvrDelegate* delegate, | 
| gvr_context* context) { | 
| -  context_ = context; | 
| delegate_ = delegate; | 
| // Clean up the non-presenting delegate. | 
| -  if (non_presenting_delegate_) { | 
| -    device::mojom::VRVSyncProviderRequest request = | 
| -        non_presenting_delegate_->OnSwitchToPresentingDelegate(); | 
| -    if (request.is_pending()) | 
| -      delegate->OnVRVsyncProviderRequest(std::move(request)); | 
| +  if (delegate_ && non_presenting_delegate_) { | 
| non_presenting_delegate_ = nullptr; | 
| JNIEnv* env = AttachCurrentThread(); | 
| Java_VrShellDelegate_shutdownNonPresentingNativeContext( | 
| @@ -136,8 +131,16 @@ void VrShellDelegate::OpenNewTab(bool incognito) { | 
| Java_VrShellDelegate_openNewTab(env, j_vr_shell_delegate_.obj(), incognito); | 
| } | 
|  | 
| +device::mojom::VRSubmitFrameClientPtr VrShellDelegate::TakeSubmitFrameClient() { | 
| +  return std::move(submit_client_); | 
| +} | 
| + | 
| void VrShellDelegate::SetDeviceProvider( | 
| device::GvrDeviceProvider* device_provider) { | 
| +  if (device_provider_ == device_provider) | 
| +    return; | 
| +  if (device_provider_) | 
| +    ClearDeviceProvider(); | 
| CHECK(!device_provider_); | 
| device_provider_ = device_provider; | 
| if (!delegate_) | 
| @@ -154,6 +157,7 @@ void VrShellDelegate::ClearDeviceProvider() { | 
| } | 
|  | 
| void VrShellDelegate::RequestWebVRPresent( | 
| +    device::mojom::VRSubmitFrameClientPtr submit_client, | 
| const base::Callback<void(bool)>& callback) { | 
| if (!present_callback_.is_null()) { | 
| // Can only handle one request at a time. This is also extremely unlikely to | 
| @@ -163,6 +167,7 @@ void VrShellDelegate::RequestWebVRPresent( | 
| } | 
|  | 
| present_callback_ = std::move(callback); | 
| +  submit_client_ = std::move(submit_client); | 
|  | 
| // If/When VRShell is ready for use it will call SetPresentResult. | 
| JNIEnv* env = AttachCurrentThread(); | 
| @@ -180,19 +185,11 @@ base::WeakPtr<VrShellDelegate> VrShellDelegate::GetWeakPtr() { | 
| return weak_ptr_factory_.GetWeakPtr(); | 
| } | 
|  | 
| -void VrShellDelegate::OnVRVsyncProviderRequest( | 
| -    device::mojom::VRVSyncProviderRequest request) { | 
| -  GetDelegate()->OnVRVsyncProviderRequest(std::move(request)); | 
| -} | 
| - | 
| void VrShellDelegate::CreateNonPresentingDelegate() { | 
| JNIEnv* env = AttachCurrentThread(); | 
| gvr_context* context = reinterpret_cast<gvr_context*>( | 
| Java_VrShellDelegate_createNonPresentingNativeContext( | 
| env, j_vr_shell_delegate_.obj())); | 
| -  if (!context) | 
| -    return; | 
| -  context_ = context; | 
| non_presenting_delegate_ = | 
| base::MakeUnique<NonPresentingGvrDelegate>(context); | 
| non_presenting_delegate_->UpdateVSyncInterval(timebase_nanos_, | 
|  |