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

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

Issue 2526643002: Re-enable rappor for vrshell (Closed)
Patch Set: CR feedback Created 4 years 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
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "vr_usage_monitor.h" 5 #include "vr_usage_monitor.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/metrics/histogram_macros.h" 7 #include "base/metrics/histogram_macros.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "components/rappor/rappor_utils.h" 9 #include "components/rappor/rappor_utils.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
11 11
12 // There is a dependency cycle between chrome/brower and
13 // chrome/browser/android/vr_shell. To temporarily fix and unblock tests,
14 // don't send rappor events.
15 #define ALLOW_SENDING_RAPPOR_EVENTS 0
16
17 namespace vr_shell { 12 namespace vr_shell {
18 13
19 // minimum duration: 7 seconds for video, no minimum for headset/vr modes 14 // minimum duration: 7 seconds for video, no minimum for headset/vr modes
20 // maximum gap: 7 seconds between videos. no gap for headset/vr-modes 15 // maximum gap: 7 seconds between videos. no gap for headset/vr-modes
21 namespace { 16 namespace {
22 base::TimeDelta minimumVideoSessionDuration(base::TimeDelta::FromSecondsD(7)); 17 base::TimeDelta minimumVideoSessionDuration(base::TimeDelta::FromSecondsD(7));
23 base::TimeDelta maximumVideoSessionGap(base::TimeDelta::FromSecondsD(7)); 18 base::TimeDelta maximumVideoSessionGap(base::TimeDelta::FromSecondsD(7));
24 19
25 base::TimeDelta maximumHeadsetSessionGap(base::TimeDelta::FromSecondsD(0)); 20 base::TimeDelta maximumHeadsetSessionGap(base::TimeDelta::FromSecondsD(0));
26 base::TimeDelta minimumHeadsetSessionDuration(base::TimeDelta::FromSecondsD(0)); 21 base::TimeDelta minimumHeadsetSessionDuration(base::TimeDelta::FromSecondsD(0));
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return VrSessionVideo; 72 return VrSessionVideo;
78 default: 73 default:
79 NOTREACHED(); 74 NOTREACHED();
80 return nullptr; 75 return nullptr;
81 } 76 }
82 } 77 }
83 78
84 void SendRapporEnteredMode(const GURL& origin, VRMode mode) { 79 void SendRapporEnteredMode(const GURL& origin, VRMode mode) {
85 switch (mode) { 80 switch (mode) {
86 case VRMode::VR_FULLSCREEN: 81 case VRMode::VR_FULLSCREEN:
87 #if ALLOW_SENDING_RAPPOR_EVENTS 82 rappor::SampleDomainAndRegistryFromGURL(rappor::GetDefaultService(),
88 rappor::SampleDomainAndRegistryFromGURL( 83 "VR.FullScreenMode", origin);
89 g_browser_process->rappor_service(), "VR.FullScreenMode", origin);
90 #endif
91 default: 84 default:
92 break; 85 break;
93 } 86 }
94 } 87 }
95 88
96 void SendRapporEnteredVideoMode(const GURL& origin, VRMode mode) { 89 void SendRapporEnteredVideoMode(const GURL& origin, VRMode mode) {
97 #if ALLOW_SENDING_RAPPOR_EVENTS
98 switch (mode) { 90 switch (mode) {
99 case VRMode::VR_BROWSER: 91 case VRMode::VR_BROWSER:
100 rappor::SampleDomainAndRegistryFromGURL( 92 rappor::SampleDomainAndRegistryFromGURL(rappor::GetDefaultService(),
101 g_browser_process->rappor_service(), "VR.Video.Browser", origin); 93 "VR.Video.Browser", origin);
102 case VRMode::WEBVR: 94 case VRMode::WEBVR:
103 rappor::SampleDomainAndRegistryFromGURL( 95 rappor::SampleDomainAndRegistryFromGURL(rappor::GetDefaultService(),
104 g_browser_process->rappor_service(), "VR.Video.WebVR", origin); 96 "VR.Video.WebVR", origin);
105 case VRMode::VR_FULLSCREEN: 97 case VRMode::VR_FULLSCREEN:
106 rappor::SampleDomainAndRegistryFromGURL( 98 rappor::SampleDomainAndRegistryFromGURL(
107 g_browser_process->rappor_service(), "VR.Video.FullScreenMode", 99 rappor::GetDefaultService(), "VR.Video.FullScreenMode", origin);
108 origin);
109 default: 100 default:
110 break; 101 break;
111 } 102 }
112 #endif
113 } 103 }
114 } // namespace 104 } // namespace
115 105
116 template <SessionEventName sessionType> 106 template <SessionEventName sessionType>
117 class SessionTimerImpl : public SessionTimer { 107 class SessionTimerImpl : public SessionTimer {
118 public: 108 public:
119 SessionTimerImpl(base::TimeDelta gap_time, base::TimeDelta minimum_duration) { 109 SessionTimerImpl(base::TimeDelta gap_time, base::TimeDelta minimum_duration) {
120 maximum_session_gap_time_ = gap_time; 110 maximum_session_gap_time_ = gap_time;
121 minimum_duration_ = minimum_duration; 111 minimum_duration_ = minimum_duration;
122 } 112 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 } 351 }
362 352
363 void VrMetricsHelper::DidToggleFullscreenModeForTab(bool entered_fullscreen, 353 void VrMetricsHelper::DidToggleFullscreenModeForTab(bool entered_fullscreen,
364 bool will_cause_resize) { 354 bool will_cause_resize) {
365 DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId()); 355 DCHECK_EQ(thread_id_, base::PlatformThread::CurrentId());
366 is_fullscreen_ = entered_fullscreen; 356 is_fullscreen_ = entered_fullscreen;
367 UpdateMode(); 357 UpdateMode();
368 } 358 }
369 359
370 } // namespace vr_shell 360 } // namespace vr_shell
OLDNEW
« no previous file with comments | « chrome/browser/android/vr_shell/BUILD.gn ('k') | chrome/browser/browser_process_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698