OLD | NEW |
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 "device/vr/android/gvr/gvr_device_provider.h" | 5 #include "device/vr/android/gvr/gvr_device_provider.h" |
6 | 6 |
7 #include <jni.h> | 7 #include <jni.h> |
8 | 8 |
9 #include "base/android/context_utils.h" | 9 #include "base/android/context_utils.h" |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 if (!vr_device_) | 85 if (!vr_device_) |
86 return; | 86 return; |
87 | 87 |
88 SwitchToNonPresentingDelegate(); | 88 SwitchToNonPresentingDelegate(); |
89 vr_device_->OnExitPresent(); | 89 vr_device_->OnExitPresent(); |
90 } | 90 } |
91 | 91 |
92 void GvrDeviceProvider::OnDisplayBlur() { | 92 void GvrDeviceProvider::OnDisplayBlur() { |
93 if (!vr_device_) | 93 if (!vr_device_) |
94 return; | 94 return; |
95 vr_device_->OnDisplayBlur(); | 95 vr_device_->OnBlur(); |
96 } | 96 } |
97 | 97 |
98 void GvrDeviceProvider::OnDisplayFocus() { | 98 void GvrDeviceProvider::OnDisplayFocus() { |
99 if (!vr_device_) | 99 if (!vr_device_) |
100 return; | 100 return; |
101 vr_device_->OnDisplayFocus(); | 101 vr_device_->OnFocus(); |
102 } | 102 } |
103 | 103 |
104 void GvrDeviceProvider::SwitchToNonPresentingDelegate() { | 104 void GvrDeviceProvider::SwitchToNonPresentingDelegate() { |
105 GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance(); | 105 GvrDelegateProvider* delegate_provider = GvrDelegateProvider::GetInstance(); |
106 if (!vr_device_ || !delegate_provider) | 106 if (!vr_device_ || !delegate_provider) |
107 return; | 107 return; |
108 | 108 |
109 vr_device_->SetDelegate(delegate_provider->GetNonPresentingDelegate()); | 109 vr_device_->SetDelegate(delegate_provider->GetNonPresentingDelegate()); |
110 | 110 |
111 // Remove GVR gamepad polling. | 111 // Remove GVR gamepad polling. |
112 GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( | 112 GamepadDataFetcherManager::GetInstance()->RemoveSourceFactory( |
113 GAMEPAD_SOURCE_GVR); | 113 GAMEPAD_SOURCE_GVR); |
114 | 114 |
115 // If we're presenting currently stop. | 115 // If we're presenting currently stop. |
116 delegate_provider->ExitWebVRPresent(); | 116 delegate_provider->ExitWebVRPresent(); |
117 } | 117 } |
118 | 118 |
119 } // namespace device | 119 } // namespace device |
OLD | NEW |