| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 5 #ifndef CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 6 #define CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 bool has_audio_power_save_blocker_for_testing() const { | 42 bool has_audio_power_save_blocker_for_testing() const { |
| 43 return audio_power_save_blocker_; | 43 return audio_power_save_blocker_; |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool has_video_power_save_blocker_for_testing() const { | 46 bool has_video_power_save_blocker_for_testing() const { |
| 47 return video_power_save_blocker_; | 47 return video_power_save_blocker_; |
| 48 } | 48 } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 void OnMediaDestroyedNotification(RenderFrameHost* render_frame_host, |
| 52 int64_t player_cookie); |
| 51 void OnMediaPlayingNotification(RenderFrameHost* render_frame_host, | 53 void OnMediaPlayingNotification(RenderFrameHost* render_frame_host, |
| 52 int64_t player_cookie, | 54 int64_t player_cookie, |
| 53 bool has_video, | 55 bool has_video, |
| 54 bool has_audio, | 56 bool has_audio, |
| 55 bool is_remote); | 57 bool is_remote, |
| 58 base::TimeDelta duration); |
| 56 void OnMediaPausedNotification(RenderFrameHost* render_frame_host, | 59 void OnMediaPausedNotification(RenderFrameHost* render_frame_host, |
| 57 int64_t player_cookie); | 60 int64_t player_cookie, |
| 61 bool reached_end_of_stream); |
| 58 | 62 |
| 59 // Clear |render_frame_host|'s tracking entry for its power save blockers. | 63 // Clear |render_frame_host|'s tracking entry for its power save blockers. |
| 60 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); | 64 void ClearPowerSaveBlockers(RenderFrameHost* render_frame_host); |
| 61 | 65 |
| 62 // Creates an audio or video power save blocker respectively. | 66 // Creates an audio or video power save blocker respectively. |
| 63 void CreateAudioPowerSaveBlocker(); | 67 void CreateAudioPowerSaveBlocker(); |
| 64 void CreateVideoPowerSaveBlocker(); | 68 void CreateVideoPowerSaveBlocker(); |
| 65 | 69 |
| 66 // Releases the audio power save blockers if |active_audio_players_| is empty. | 70 // Releases the audio power save blockers if |active_audio_players_| is empty. |
| 67 // Likewise, releases the video power save blockers if |active_video_players_| | 71 // Likewise, releases the video power save blockers if |active_video_players_| |
| (...skipping 19 matching lines...) Expand all Loading... |
| 87 ActiveMediaPlayerMap active_video_players_; | 91 ActiveMediaPlayerMap active_video_players_; |
| 88 scoped_ptr<PowerSaveBlocker> audio_power_save_blocker_; | 92 scoped_ptr<PowerSaveBlocker> audio_power_save_blocker_; |
| 89 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; | 93 scoped_ptr<PowerSaveBlocker> video_power_save_blocker_; |
| 90 | 94 |
| 91 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); | 95 DISALLOW_COPY_AND_ASSIGN(MediaWebContentsObserver); |
| 92 }; | 96 }; |
| 93 | 97 |
| 94 } // namespace content | 98 } // namespace content |
| 95 | 99 |
| 96 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ | 100 #endif // CONTENT_BROWSER_MEDIA_MEDIA_WEB_CONTENTS_OBSERVER_H_ |
| OLD | NEW |