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

Side by Side Diff: chrome/browser/metrics/desktop_session_duration/chrome_visibility_observer.h

Issue 2333113002: Rename DesktopEngagement* to DesktopSessionDuration*. (Closed)
Patch Set: Change name Created 4 years, 3 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_METRICS_DESKTOP_ENGAGEMENT_CHROME_VISIBILITY_OBSERVER_H_ 5 #ifndef CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_CHROME_VISIBILITY_OBSERV ER_H_
6 #define CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_CHROME_VISIBILITY_OBSERVER_H_ 6 #define CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_CHROME_VISIBILITY_OBSERV ER_H_
7 7
8 #include "base/memory/weak_ptr.h" 8 #include "base/memory/weak_ptr.h"
9 #include "chrome/browser/ui/browser_list_observer.h" 9 #include "chrome/browser/ui/browser_list_observer.h"
10 10
11 namespace metrics { 11 namespace metrics {
12
13 // Observer for tracking browser visibility events. 12 // Observer for tracking browser visibility events.
14 class ChromeVisibilityObserver : public chrome::BrowserListObserver { 13 class ChromeVisibilityObserver : public chrome::BrowserListObserver {
15 public: 14 public:
16 ChromeVisibilityObserver(); 15 ChromeVisibilityObserver();
17 ~ChromeVisibilityObserver() override; 16 ~ChromeVisibilityObserver() override;
18 17
19 protected: 18 protected:
20 // Notifies |DesktopEngagementService| of visibility changes. Overridden by 19 // Notifies |DesktopSessionDurationTracker| of visibility changes. Overridden
21 // tests. 20 // by tests.
22 virtual void SendVisibilityChangeEvent(bool active); 21 virtual void SendVisibilityChangeEvent(bool active);
23 22
24 private: 23 private:
25 // Cancels visibility change in case when the browser becomes visible after a 24 // Cancels visibility change in case when the browser becomes visible after a
26 // short gap. 25 // short gap.
27 void CancelVisibilityChange(); 26 void CancelVisibilityChange();
28 27
29 // chrome::BrowserListObserver: 28 // chrome::BrowserListObserver:
30 void OnBrowserSetLastActive(Browser* browser) override; 29 void OnBrowserSetLastActive(Browser* browser) override;
31 void OnBrowserNoLongerActive(Browser* browser) override; 30 void OnBrowserNoLongerActive(Browser* browser) override;
32 void OnBrowserRemoved(Browser* browser) override; 31 void OnBrowserRemoved(Browser* browser) override;
33 32
34 // Sets |visibility_gap_timeout_| based on variation params. 33 // Sets |visibility_gap_timeout_| based on variation params.
35 void InitVisibilityGapTimeout(); 34 void InitVisibilityGapTimeout();
36 35
37 // Timeout interval for waiting after loss of visibility. This allows merging 36 // Timeout interval for waiting after loss of visibility. This allows merging
38 // two visibility session if they happened very shortly after each other, for 37 // two visibility session if they happened very shortly after each other, for
39 // example, when user switching between two browser windows. 38 // example, when user switching between two browser windows.
40 base::TimeDelta visibility_gap_timeout_; 39 base::TimeDelta visibility_gap_timeout_;
41 40
42 base::WeakPtrFactory<ChromeVisibilityObserver> weak_factory_; 41 base::WeakPtrFactory<ChromeVisibilityObserver> weak_factory_;
43 42
44 DISALLOW_COPY_AND_ASSIGN(ChromeVisibilityObserver); 43 DISALLOW_COPY_AND_ASSIGN(ChromeVisibilityObserver);
45 }; 44 };
46 45
47 } // namespace metrics 46 } // namespace metrics
48 47
49 #endif // CHROME_BROWSER_METRICS_DESKTOP_ENGAGEMENT_CHROME_VISIBILITY_OBSERVER_ H_ 48 #endif // CHROME_BROWSER_METRICS_DESKTOP_SESSION_DURATION_CHROME_VISIBILITY_OBS ERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698