| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WEBMEDIAPLAYER_DELEGATE_H_ | 5 #ifndef MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
| 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ | 6 #define MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
| 7 | 7 |
| 8 namespace blink { | 8 namespace blink { |
| 9 class WebMediaPlayer; | 9 class WebMediaPlayer; |
| 10 } | 10 } |
| 11 namespace media { | 11 namespace media { |
| 12 | 12 |
| 13 enum class MediaContentType; |
| 14 |
| 13 // An interface to allow a WebMediaPlayer to communicate changes of state to | 15 // An interface to allow a WebMediaPlayer to communicate changes of state to |
| 14 // objects that need to know. | 16 // objects that need to know. |
| 15 class WebMediaPlayerDelegate { | 17 class WebMediaPlayerDelegate { |
| 16 public: | 18 public: |
| 17 class Observer { | 19 class Observer { |
| 18 public: | 20 public: |
| 19 // Called when the WebMediaPlayer enters the background or foreground | 21 // Called when the WebMediaPlayer enters the background or foreground |
| 20 // respectively. Note: Some implementations will stop playback when hidden, | 22 // respectively. Note: Some implementations will stop playback when hidden, |
| 21 // and thus subsequently call WebMediaPlayerDelegate::PlayerGone(). | 23 // and thus subsequently call WebMediaPlayerDelegate::PlayerGone(). |
| 22 virtual void OnHidden() = 0; | 24 virtual void OnHidden() = 0; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 // Subscribe or unsubscribe from observer callbacks respectively. A client | 46 // Subscribe or unsubscribe from observer callbacks respectively. A client |
| 45 // must use the delegate id returned by AddObserver() for all other calls. | 47 // must use the delegate id returned by AddObserver() for all other calls. |
| 46 virtual int AddObserver(Observer* observer) = 0; | 48 virtual int AddObserver(Observer* observer) = 0; |
| 47 virtual void RemoveObserver(int delegate_id) = 0; | 49 virtual void RemoveObserver(int delegate_id) = 0; |
| 48 | 50 |
| 49 // The specified player started playing media. | 51 // The specified player started playing media. |
| 50 virtual void DidPlay(int delegate_id, | 52 virtual void DidPlay(int delegate_id, |
| 51 bool has_video, | 53 bool has_video, |
| 52 bool has_audio, | 54 bool has_audio, |
| 53 bool is_remote, | 55 bool is_remote, |
| 54 base::TimeDelta duration) = 0; | 56 media::MediaContentType media_content_type) = 0; |
| 55 | 57 |
| 56 // The specified player stopped playing media. This may be called at any time | 58 // The specified player stopped playing media. This may be called at any time |
| 57 // with or without a DidPlay() having previously occurred. Calling this will | 59 // with or without a DidPlay() having previously occurred. Calling this will |
| 58 // cause the delegate to be registered for idle suspension. I.e., after some | 60 // cause the delegate to be registered for idle suspension. I.e., after some |
| 59 // time elapses without a DidPlay(), OnSuspendRequested() will be issued. | 61 // time elapses without a DidPlay(), OnSuspendRequested() will be issued. |
| 60 virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0; | 62 virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0; |
| 61 | 63 |
| 62 // The specified player was destroyed or suspended and will no longer accept | 64 // The specified player was destroyed or suspended and will no longer accept |
| 63 // Observer::OnPlay() or Observer::OnPause() calls. This may be called | 65 // Observer::OnPlay() or Observer::OnPause() calls. This may be called |
| 64 // multiple times in row. Note: Clients must still call RemoveObserver() to | 66 // multiple times in row. Note: Clients must still call RemoveObserver() to |
| 65 // unsubscribe from callbacks. | 67 // unsubscribe from callbacks. |
| 66 virtual void PlayerGone(int delegate_id) = 0; | 68 virtual void PlayerGone(int delegate_id) = 0; |
| 67 | 69 |
| 68 // Returns whether the render frame is currently hidden. | 70 // Returns whether the render frame is currently hidden. |
| 69 virtual bool IsHidden() = 0; | 71 virtual bool IsHidden() = 0; |
| 70 | 72 |
| 71 protected: | 73 protected: |
| 72 virtual ~WebMediaPlayerDelegate() {} | 74 virtual ~WebMediaPlayerDelegate() {} |
| 73 }; | 75 }; |
| 74 | 76 |
| 75 } // namespace media | 77 } // namespace media |
| 76 | 78 |
| 77 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ | 79 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
| OLD | NEW |