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

Side by Side Diff: chrome/browser/metrics/desktop_engagement_service.h

Issue 2101743002: Observe input metrics from web content area. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update service logic for visibility stuff; add debug logging Created 4 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
6 #define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h"
14 #include "base/timer/timer.h"
15
16 class DesktopEngagementService {
17 public:
18 static void Initialize();
19 static DesktopEngagementService* Get();
20
21 void OnUserEvent();
22
23 void OnVisibilityChanged(bool visible);
24
25 void OnAudioStart();
26 void OnAudioEnd();
27
28 private:
29 DesktopEngagementService();
30 ~DesktopEngagementService();
31
32 void StartTimer(base::TimeDelta duration);
33 void OnTimerFired();
34
35 void StartSession();
36 void EndSession();
37
38 base::TimeTicks session_start_;
39 base::TimeTicks last_user_event_;
40
41 bool is_visible_ = false;
42 bool in_session_ = false;
43 bool is_audio_playing_ = false;
44
45 base::OneShotTimer timer_;
46
47 base::WeakPtrFactory<DesktopEngagementService> weak_factory_;
48
49 DISALLOW_COPY_AND_ASSIGN(DesktopEngagementService);
50 };
51
52 #endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/metrics/desktop_engagement_observer.cc ('k') | chrome/browser/metrics/desktop_engagement_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698