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 WebMediaPlayer to communicate changes of state to | 13 // An interface to allow a WebMediaPlayer to communicate changes of state to |
| 14 // objects that need to know. | 14 // 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 // Called when the WebMediaPlayer is no longer in the foreground. Audio may | 19 // Called when the WebMediaPlayer enters the background or foreground |
| 20 // continue in the background unless |must_suspend| is true. | 20 // respectively. |
| 21 virtual void OnHidden(bool must_suspend) = 0; | 21 virtual void OnHidden() = 0; |
| 22 virtual void OnShown() = 0; | |
| 22 | 23 |
| 23 virtual void OnShown() = 0; | 24 // Called when a WebMediaPlayer instance is asked to release any held |
| 25 // resources. If |must_suspend| is false, the player may continue to play | |
| 26 // background audio. If |must_suspend| is true, after releasing resources, | |
| 27 // players must call WebMediaPlayerDelegate::PlayerGone(). | |
|
xhwang
2016/03/07 19:13:58
It seems PlayerGone() may also be called in OnHidd
DaleCurtis
2016/03/09 02:56:13
Done.
| |
| 28 virtual void OnSuspend(bool must_suspend) = 0; | |
|
xhwang
2016/03/07 19:13:58
It seems there's some overlap between OnHidden() a
DaleCurtis
2016/03/07 19:23:07
With this change OnHidden() should only ever be ca
| |
| 29 | |
| 24 virtual void OnPlay() = 0; | 30 virtual void OnPlay() = 0; |
| 25 virtual void OnPause() = 0; | 31 virtual void OnPause() = 0; |
| 26 | 32 |
| 27 // Playout volume should be set to current_volume * multiplier. The range | 33 // Playout volume should be set to current_volume * multiplier. The range |
| 28 // is [0, 1] and is typically 1. | 34 // is [0, 1] and is typically 1. |
| 29 virtual void OnVolumeMultiplierUpdate(double multiplier) = 0; | 35 virtual void OnVolumeMultiplierUpdate(double multiplier) = 0; |
| 30 }; | 36 }; |
| 31 | 37 |
| 32 WebMediaPlayerDelegate() {} | 38 WebMediaPlayerDelegate() {} |
| 33 | 39 |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 54 // Returns whether the render frame is currently hidden. | 60 // Returns whether the render frame is currently hidden. |
| 55 virtual bool IsHidden() = 0; | 61 virtual bool IsHidden() = 0; |
| 56 | 62 |
| 57 protected: | 63 protected: |
| 58 virtual ~WebMediaPlayerDelegate() {} | 64 virtual ~WebMediaPlayerDelegate() {} |
| 59 }; | 65 }; |
| 60 | 66 |
| 61 } // namespace media | 67 } // namespace media |
| 62 | 68 |
| 63 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ | 69 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
| OLD | NEW |