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

Side by Side Diff: chrome/browser/android/vr_shell/vr_shell_delegate.h

Issue 2727873002: Implement lazy initialization for VrShellDelegate (Closed)
Patch Set: Fix FindBugs errors - neat! Created 3 years, 9 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 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_
7 7
8 #include <jni.h> 8 #include <jni.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/android/jni_weak_ref.h" 12 #include "base/android/jni_weak_ref.h"
13 #include "base/callback.h" 13 #include "base/callback.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "device/vr/android/gvr/gvr_delegate.h" 15 #include "device/vr/android/gvr/gvr_delegate.h"
16 16
17 namespace device { 17 namespace device {
18 class GvrDeviceProvider; 18 class GvrDeviceProvider;
19 } 19 }
20 20
21 namespace vr_shell { 21 namespace vr_shell {
22 22
23 class NonPresentingGvrDelegate; 23 class NonPresentingGvrDelegate;
24 24
25 class VrShellDelegate : public device::GvrDelegateProvider { 25 class VrShellDelegate : public device::GvrDelegateProvider {
26 public: 26 public:
27 VrShellDelegate(JNIEnv* env, jobject obj); 27 VrShellDelegate(JNIEnv* env, jobject obj);
28 ~VrShellDelegate() override; 28 ~VrShellDelegate() override;
29 29
30 static device::GvrDelegateProvider* CreateVrShellDelegate();
31
30 static VrShellDelegate* GetNativeVrShellDelegate(JNIEnv* env, 32 static VrShellDelegate* GetNativeVrShellDelegate(JNIEnv* env,
31 jobject jdelegate); 33 jobject jdelegate);
32 34
33 void SetDelegate(device::GvrDelegate* delegate, gvr_context* context); 35 void SetDelegate(device::GvrDelegate* delegate, gvr_context* context);
34 void RemoveDelegate(); 36 void RemoveDelegate();
35 37
36 void SetPresentResult(JNIEnv* env, 38 void SetPresentResult(JNIEnv* env,
37 const base::android::JavaParamRef<jobject>& obj, 39 const base::android::JavaParamRef<jobject>& obj,
38 jboolean result); 40 jboolean result);
39 void DisplayActivate(JNIEnv* env, 41 void DisplayActivate(JNIEnv* env,
40 const base::android::JavaParamRef<jobject>& obj); 42 const base::android::JavaParamRef<jobject>& obj);
41 void UpdateVSyncInterval(JNIEnv* env, 43 void UpdateVSyncInterval(JNIEnv* env,
42 const base::android::JavaParamRef<jobject>& obj, 44 const base::android::JavaParamRef<jobject>& obj,
43 jlong timebase_nanos, 45 jlong timebase_nanos,
44 jdouble interval_seconds); 46 jdouble interval_seconds);
45 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 47 void OnPause(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
46 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj); 48 void OnResume(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
49 void Destroy(JNIEnv* env, const base::android::JavaParamRef<jobject>& obj);
47 void ShowTab(int id); 50 void ShowTab(int id);
48 void OpenNewTab(bool incognito); 51 void OpenNewTab(bool incognito);
49 52
50 device::GvrDeviceProvider* device_provider() { return device_provider_; } 53 device::GvrDeviceProvider* device_provider() { return device_provider_; }
51 void OnVRVsyncProviderRequest(device::mojom::VRVSyncProviderRequest request); 54 void OnVRVsyncProviderRequest(device::mojom::VRVSyncProviderRequest request);
52 base::WeakPtr<VrShellDelegate> GetWeakPtr(); 55 base::WeakPtr<VrShellDelegate> GetWeakPtr();
53 56
54 private: 57 private:
55 // device::GvrDelegateProvider implementation 58 // device::GvrDelegateProvider implementation
56 void SetDeviceProvider(device::GvrDeviceProvider* device_provider) override; 59 void SetDeviceProvider(device::GvrDeviceProvider* device_provider) override;
(...skipping 20 matching lines...) Expand all
77 base::WeakPtrFactory<VrShellDelegate> weak_ptr_factory_; 80 base::WeakPtrFactory<VrShellDelegate> weak_ptr_factory_;
78 81
79 DISALLOW_COPY_AND_ASSIGN(VrShellDelegate); 82 DISALLOW_COPY_AND_ASSIGN(VrShellDelegate);
80 }; 83 };
81 84
82 bool RegisterVrShellDelegate(JNIEnv* env); 85 bool RegisterVrShellDelegate(JNIEnv* env);
83 86
84 } // namespace vr_shell 87 } // namespace vr_shell
85 88
86 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_ 89 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_SHELL_DELEGATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698