OLD | NEW |
(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 CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |
| 7 |
| 8 #include <set> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/tick_clock.h" |
| 12 #include "content/common/content_export.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class WebContents; |
| 17 |
| 18 // This class handles metrics regarding audible WebContents. |
| 19 // It does register three different information: |
| 20 // - how many WebContents are audible when a WebContents become audible. |
| 21 // - how long multiple WebContents are audible at the same time. |
| 22 // - for a browsing session, how often and how many WebContents get audible at |
| 23 // the same time. |
| 24 class CONTENT_EXPORT AudibleMetrics { |
| 25 public: |
| 26 AudibleMetrics(); |
| 27 ~AudibleMetrics(); |
| 28 |
| 29 void UpdateAudibleWebContentsState(const WebContents* web_contents, |
| 30 bool audible); |
| 31 |
| 32 void SetClockForTest(scoped_ptr<base::TickClock> test_clock); |
| 33 |
| 34 private: |
| 35 void AddAudibleWebContents(const WebContents* web_contents); |
| 36 void RemoveAudibleWebContents(const WebContents* web_contents); |
| 37 |
| 38 base::TimeTicks concurrent_web_contents_start_time_; |
| 39 size_t max_concurrent_audible_web_contents_in_session_; |
| 40 scoped_ptr<base::TickClock> clock_; |
| 41 |
| 42 std::set<const WebContents*> audible_web_contents_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(AudibleMetrics); |
| 45 }; |
| 46 |
| 47 } // namespace content |
| 48 |
| 49 #endif // CONTENT_BROWSER_MEDIA_AUDIBLE_METRICS_H_ |
OLD | NEW |