Chromium Code Reviews| 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 // An interface to allow a WebMediaPlayerImpl to communicate changes of state | 13 // An interface to allow a WebMediaPlayerImpl to communicate changes of state |
| 14 // to objects that need to know. | 14 // to objects that need to know. |
| 15 class WebMediaPlayerDelegate { | 15 class WebMediaPlayerDelegate { |
| 16 public: | 16 public: |
| 17 class Observer { | 17 class Observer { |
| 18 public: | 18 public: |
| 19 virtual void OnHidden() = 0; | 19 virtual void OnHidden() = 0; |
| 20 virtual void OnShown() = 0; | 20 virtual void OnShown() = 0; |
| 21 virtual void OnPlay() = 0; | |
| 22 virtual void OnPause() = 0; | |
| 23 virtual void OnVolumeMultiplierUpdate(double multiplier) = 0; | |
| 21 }; | 24 }; |
| 22 | 25 |
| 23 WebMediaPlayerDelegate() {} | 26 WebMediaPlayerDelegate() {} |
| 24 | 27 |
| 28 // Subscribe or unsubscribe from observer callbacks respectively. A client | |
| 29 // must use the delegate id returned by AddObserver() for all other calls. | |
| 30 virtual int AddObserver(Observer* observer) = 0; | |
| 31 virtual void RemoveObserver(int delegate_id) = 0; | |
| 32 | |
| 25 // The specified player started playing media. | 33 // The specified player started playing media. |
| 26 virtual void DidPlay(blink::WebMediaPlayer* player) = 0; | 34 virtual void DidPlay(int delegate_id, |
| 35 bool has_video, | |
| 36 bool has_audio, | |
| 37 bool is_remote, | |
| 38 base::TimeDelta duration) = 0; | |
| 27 | 39 |
| 28 // The specified player stopped playing media. | 40 // The specified player stopped playing media. |
| 29 virtual void DidPause(blink::WebMediaPlayer* player) = 0; | 41 virtual void DidPause(int delegate_id, bool reached_end_of_stream) = 0; |
| 30 | 42 |
| 31 // The specified player was destroyed. Do not call any methods on it. | 43 // The specified player was destroyed or suspended. Note: Clients must still |
| 32 // (RemoveObserver() is still necessary if the player is also an observer.) | 44 // call RemoveObserver() to unsubscribe from callbacks. |
|
sandersd (OOO until July 31)
2016/01/25 19:10:59
Nit: Should document that this can be called multi
DaleCurtis
2016/01/25 21:49:47
Done.
| |
| 33 virtual void PlayerGone(blink::WebMediaPlayer* player) = 0; | 45 virtual void PlayerGone(int delegate_id) = 0; |
| 34 | |
| 35 // Subscribe to observer callbacks. | |
| 36 virtual void AddObserver(Observer* observer) = 0; | |
| 37 | |
| 38 // Unsubscribe from observer callbacks. | |
| 39 virtual void RemoveObserver(Observer* observer) = 0; | |
| 40 | 46 |
| 41 // Returns whether the render frame is currently hidden. | 47 // Returns whether the render frame is currently hidden. |
| 42 virtual bool IsHidden() = 0; | 48 virtual bool IsHidden() = 0; |
| 43 | 49 |
| 44 protected: | 50 protected: |
| 45 virtual ~WebMediaPlayerDelegate() {} | 51 virtual ~WebMediaPlayerDelegate() {} |
| 46 }; | 52 }; |
| 47 | 53 |
| 48 } // namespace media | 54 } // namespace media |
| 49 | 55 |
| 50 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ | 56 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
| OLD | NEW |