OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 27 matching lines...) Expand all Loading... |
38 public: | 38 public: |
39 explicit RendererWebMediaPlayerDelegate(content::RenderFrame* render_frame); | 39 explicit RendererWebMediaPlayerDelegate(content::RenderFrame* render_frame); |
40 ~RendererWebMediaPlayerDelegate() override; | 40 ~RendererWebMediaPlayerDelegate() override; |
41 | 41 |
42 // Returns true if this RenderFrame has ever seen media playback before. | 42 // Returns true if this RenderFrame has ever seen media playback before. |
43 bool has_played_media() const { return has_played_media_; } | 43 bool has_played_media() const { return has_played_media_; } |
44 | 44 |
45 // WebMediaPlayerDelegate implementation. | 45 // WebMediaPlayerDelegate implementation. |
46 bool IsFrameHidden() override; | 46 bool IsFrameHidden() override; |
47 bool IsFrameClosed() override; | 47 bool IsFrameClosed() override; |
48 bool IsBackgroundVideoPlaybackUnlocked() override; | |
49 int AddObserver(Observer* observer) override; | 48 int AddObserver(Observer* observer) override; |
50 void RemoveObserver(int player_id) override; | 49 void RemoveObserver(int player_id) override; |
51 void DidPlay(int player_id, | 50 void DidPlay(int player_id, |
52 bool has_video, | 51 bool has_video, |
53 bool has_audio, | 52 bool has_audio, |
54 MediaContentType media_content_type) override; | 53 MediaContentType media_content_type) override; |
55 void DidPause(int player_id) override; | 54 void DidPause(int player_id) override; |
56 void PlayerGone(int player_id) override; | 55 void PlayerGone(int player_id) override; |
57 void SetIdle(int player_id, bool is_idle) override; | 56 void SetIdle(int player_id, bool is_idle) override; |
58 bool IsIdle(int player_id) override; | 57 bool IsIdle(int player_id) override; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 void RecordBackgroundVideoPlayback(); | 93 void RecordBackgroundVideoPlayback(); |
95 | 94 |
96 // Runs periodically to notify stale players in |idle_player_map_| which | 95 // Runs periodically to notify stale players in |idle_player_map_| which |
97 // have been idle for longer than |timeout|. | 96 // have been idle for longer than |timeout|. |
98 void CleanUpIdlePlayers(base::TimeDelta timeout); | 97 void CleanUpIdlePlayers(base::TimeDelta timeout); |
99 | 98 |
100 // True if any media has ever been played in this render frame. Affects | 99 // True if any media has ever been played in this render frame. Affects |
101 // autoplay logic in RenderFrameImpl. | 100 // autoplay logic in RenderFrameImpl. |
102 bool has_played_media_ = false; | 101 bool has_played_media_ = false; |
103 | 102 |
104 bool background_video_allowed_ = false; | |
105 bool is_frame_closed_ = false; | 103 bool is_frame_closed_ = false; |
106 bool is_frame_hidden_for_testing_ = false; | 104 bool is_frame_hidden_for_testing_ = false; |
107 | 105 |
108 // State related to scheduling UpdateTask(). These are cleared each time | 106 // State related to scheduling UpdateTask(). These are cleared each time |
109 // UpdateTask() runs. | 107 // UpdateTask() runs. |
110 bool has_played_video_ = false; | 108 bool has_played_video_ = false; |
111 bool pending_update_task_ = false; | 109 bool pending_update_task_ = false; |
112 | 110 |
113 IDMap<Observer*> id_map_; | 111 IDMap<Observer*> id_map_; |
114 | 112 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Determined at construction time based on system information; determines | 144 // Determined at construction time based on system information; determines |
147 // when the idle cleanup timer should be fired more aggressively. | 145 // when the idle cleanup timer should be fired more aggressively. |
148 bool is_low_end_device_; | 146 bool is_low_end_device_; |
149 | 147 |
150 DISALLOW_COPY_AND_ASSIGN(RendererWebMediaPlayerDelegate); | 148 DISALLOW_COPY_AND_ASSIGN(RendererWebMediaPlayerDelegate); |
151 }; | 149 }; |
152 | 150 |
153 } // namespace media | 151 } // namespace media |
154 | 152 |
155 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ | 153 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBMEDIAPLAYER_DELEGATE_H_ |
OLD | NEW |