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

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

Issue 2865463003: Tracks GVR version crossed with headset type using UMA. (Closed)
Patch Set: Rebased on ToT, changed logging to UMA_HISTOGRAM_SPARSE_SLOWLY Created 3 years, 7 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_USAGE_MONITOR_H_ 5 #ifndef CHROME_BROWSER_ANDROID_VR_SHELL_VR_USAGE_MONITOR_H_
6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_USAGE_MONITOR_H_ 6 #define CHROME_BROWSER_ANDROID_VR_SHELL_VR_USAGE_MONITOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/public/browser/navigation_handle.h" 12 #include "content/public/browser/navigation_handle.h"
13 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
14 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
15 #ifdef ANDROID
16 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr.h"
ddorwin 2017/05/16 00:15:51 We should avoid adding GVR dependencies to more fi
tiborg 2017/05/23 15:47:25 Ok, moved it to a separate file.
17 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/ gvr_types.h"
18 #endif // ANDROID
15 19
16 namespace vr_shell { 20 namespace vr_shell {
17 21
18 enum class VRMode { 22 enum class VRMode {
19 NO_VR = 0, 23 NO_VR = 0,
20 VR_BROWSER = 1, // VR Shell. 24 VR_BROWSER = 1, // VR Shell.
21 VR_FULLSCREEN = 2, // Cinema mode. 25 VR_FULLSCREEN = 2, // Cinema mode.
22 WEBVR = 3, 26 WEBVR = 3,
23 }; 27 };
24 28
(...skipping 21 matching lines...) Expand all
46 // config members: 50 // config members:
47 // time between stop and start to count as same session 51 // time between stop and start to count as same session
48 base::TimeDelta maximum_session_gap_time_; 52 base::TimeDelta maximum_session_gap_time_;
49 53
50 // minimum time between start and stop to add to duration 54 // minimum time between start and stop to add to duration
51 base::TimeDelta minimum_duration_; 55 base::TimeDelta minimum_duration_;
52 56
53 DISALLOW_COPY_AND_ASSIGN(SessionTimer); 57 DISALLOW_COPY_AND_ASSIGN(SessionTimer);
54 }; 58 };
55 59
60 enum class ViewerType {
61 UNKNOWN_TYPE = 0,
62 CARDBOARD = 1,
63 DAYDREAM = 2,
64 VIEWER_TYPE_MAX,
65 };
66
67 enum GvrVersionStatus { OLDER, UNKNOWN, PRECISE };
68
69 class VrMetricsUtil {
70 public:
71 #ifdef ANDROID
72 static void LogGvrVersionForVrViewerType(gvr_context* context,
73 GvrVersionStatus version_status,
74 gvr_version version);
75 static void LogVrViewerType(gvr_context* context);
76 #endif // ANDROID
77
78 private:
79 #ifdef ANDROID
80 static ViewerType GetVrViewerType(gvr_context* context);
81
82 static bool logged_gvr_version_;
ddorwin 2017/05/16 00:15:51 has_...
tiborg 2017/05/23 15:47:25 Done.
83 #endif // ANDROID
84
85 DISALLOW_IMPLICIT_CONSTRUCTORS(VrMetricsUtil);
86 };
87
56 // This class is not threadsafe and must only be used from the main thread. 88 // This class is not threadsafe and must only be used from the main thread.
57 class VrMetricsHelper : public content::WebContentsObserver { 89 class VrMetricsHelper : public content::WebContentsObserver {
58 public: 90 public:
59 explicit VrMetricsHelper(content::WebContents*); 91 explicit VrMetricsHelper(content::WebContents*);
60 ~VrMetricsHelper() override; 92 ~VrMetricsHelper() override;
61 void SetWebVREnabled(bool is_webvr_presenting); 93 void SetWebVREnabled(bool is_webvr_presenting);
62 void SetVRActive(bool is_vr_enabled); 94 void SetVRActive(bool is_vr_enabled);
63 95
64 private: 96 private:
65 // WebContentObserver 97 // WebContentObserver
(...skipping 23 matching lines...) Expand all
89 int num_videos_playing_ = 0; 121 int num_videos_playing_ = 0;
90 int num_session_navigation_ = 0; 122 int num_session_navigation_ = 0;
91 int num_session_video_playback_ = 0; 123 int num_session_video_playback_ = 0;
92 124
93 GURL origin_; 125 GURL origin_;
94 }; 126 };
95 127
96 } // namespace vr_shell 128 } // namespace vr_shell
97 129
98 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_USAGE_MONITOR_H_ 130 #endif // CHROME_BROWSER_ANDROID_VR_SHELL_VR_USAGE_MONITOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698