OLD | NEW |
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 MEDIA_BLINK_WATCH_TIME_REPORTER_H_ | 5 #ifndef MEDIA_BLINK_WATCH_TIME_REPORTER_H_ |
6 #define MEDIA_BLINK_WATCH_TIME_REPORTER_H_ | 6 #define MEDIA_BLINK_WATCH_TIME_REPORTER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/power_monitor/power_observer.h" | 9 #include "base/power_monitor/power_observer.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // the video is shown or hidden respectively. OnHidden() will start background | 96 // the video is shown or hidden respectively. OnHidden() will start background |
97 // watch time reporting if the media is audio+video. | 97 // watch time reporting if the media is audio+video. |
98 // | 98 // |
99 // TODO(dalecurtis): At present, this is only called when the entire content | 99 // TODO(dalecurtis): At present, this is only called when the entire content |
100 // window goes into the foreground or background respectively; i.e. it does | 100 // window goes into the foreground or background respectively; i.e. it does |
101 // not catch cases where the video is in the foreground but out of the view | 101 // not catch cases where the video is in the foreground but out of the view |
102 // port. We need a method for rejecting out of view port videos. | 102 // port. We need a method for rejecting out of view port videos. |
103 void OnShown(); | 103 void OnShown(); |
104 void OnHidden(); | 104 void OnHidden(); |
105 | 105 |
| 106 // Returns true if the current size is large enough that watch time will be |
| 107 // recorded for playback. |
| 108 bool IsSizeLargeEnoughToReportWatchTime() const; |
| 109 |
106 // Setup the reporting interval to be immediate to avoid spinning real time | 110 // Setup the reporting interval to be immediate to avoid spinning real time |
107 // within the unit test. | 111 // within the unit test. |
108 void set_reporting_interval_for_testing() { | 112 void set_reporting_interval_for_testing() { |
109 reporting_interval_ = base::TimeDelta(); | 113 reporting_interval_ = base::TimeDelta(); |
110 } | 114 } |
111 | 115 |
112 void set_is_on_battery_power_for_testing(bool on_battery_power) { | 116 void set_is_on_battery_power_for_testing(bool on_battery_power) { |
113 is_on_battery_power_ = on_battery_power; | 117 is_on_battery_power_ = on_battery_power; |
114 } | 118 } |
115 | 119 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // Special case reporter for handling background video watch time. Configured | 188 // Special case reporter for handling background video watch time. Configured |
185 // as an audio only WatchTimeReporter with |is_background_| set to true. | 189 // as an audio only WatchTimeReporter with |is_background_| set to true. |
186 std::unique_ptr<WatchTimeReporter> background_reporter_; | 190 std::unique_ptr<WatchTimeReporter> background_reporter_; |
187 | 191 |
188 DISALLOW_COPY_AND_ASSIGN(WatchTimeReporter); | 192 DISALLOW_COPY_AND_ASSIGN(WatchTimeReporter); |
189 }; | 193 }; |
190 | 194 |
191 } // namespace media | 195 } // namespace media |
192 | 196 |
193 #endif // MEDIA_BLINK_WATCH_TIME_REPORTER_H_ | 197 #endif // MEDIA_BLINK_WATCH_TIME_REPORTER_H_ |
OLD | NEW |