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

Unified Diff: chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h

Issue 2385103003: [DesktopSessionDurationTracker] Remove visibility-switch timeout from session length. (Closed)
Patch Set: Address nits. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h
diff --git a/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h b/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h
index 4c6b87d7650125f0fd67be24cefd4c90c65489fa..53776789a316262919cc773c8efd1b0c6cf1adc4 100644
--- a/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h
+++ b/chrome/browser/metrics/desktop_session_duration/desktop_session_duration_tracker.h
@@ -32,8 +32,10 @@ class DesktopSessionDurationTracker : public AudibleContentsTracker::Observer {
// Called when user interaction with the browser is caught.
void OnUserEvent();
- // Called when visibility of the browser changes.
- void OnVisibilityChanged(bool visible);
+ // Called when visibility of the browser changes. These events can be delayed
+ // due to timeout logic, the extent of which can be communicated via
+ // |time_ago|. This time is used to correct the session duration.
+ void OnVisibilityChanged(bool visible, base::TimeDelta time_ago);
bool is_visible() const { return is_visible_; }
bool in_session() const { return in_session_; }
@@ -63,7 +65,9 @@ class DesktopSessionDurationTracker : public AudibleContentsTracker::Observer {
void StartSession();
// Ends the session and saves session information into histograms.
- void EndSession();
+ // |time_to_discount| contains the amount of time that should be removed from
+ // the apparent session length due to timeout logic.
+ void EndSession(base::TimeDelta time_to_discount);
// Sets |inactivity_timeout_| based on variation params.
void InitInactivityTimeout();

Powered by Google App Engine
This is Rietveld 408576698