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 blink::WebMediaPlayer* GetPlayer() = 0; |
19 virtual void OnHidden() = 0; | 20 virtual void OnHidden() = 0; |
20 virtual void OnShown() = 0; | 21 virtual void OnShown() = 0; |
| 22 virtual void OnPlay() = 0; |
| 23 virtual void OnPause() = 0; |
21 }; | 24 }; |
22 | 25 |
23 WebMediaPlayerDelegate() {} | 26 WebMediaPlayerDelegate() {} |
24 | 27 |
25 // The specified player started playing media. | |
26 virtual void DidPlay(blink::WebMediaPlayer* player) = 0; | |
27 | |
28 // The specified player stopped playing media. | |
29 virtual void DidPause(blink::WebMediaPlayer* player) = 0; | |
30 | |
31 // The specified player was destroyed. Do not call any methods on it. | |
32 // (RemoveObserver() is still necessary if the player is also an observer.) | |
33 virtual void PlayerGone(blink::WebMediaPlayer* player) = 0; | |
34 | |
35 // Subscribe to observer callbacks. | 28 // Subscribe to observer callbacks. |
36 virtual void AddObserver(Observer* observer) = 0; | 29 virtual void AddObserver(Observer* observer) = 0; |
37 | 30 |
38 // Unsubscribe from observer callbacks. | 31 // The specified player started playing media. |
39 virtual void RemoveObserver(Observer* observer) = 0; | 32 virtual void DidPlay(Observer* observer) = 0; |
| 33 |
| 34 // The specified player stopped playing media. |
| 35 virtual void DidPause(Observer* observer) = 0; |
| 36 |
| 37 // The specified player was destroyed. Do not call any methods on it. |
| 38 virtual void PlayerGone(Observer* observer) = 0; |
40 | 39 |
41 // Returns whether the render frame is currently hidden. | 40 // Returns whether the render frame is currently hidden. |
42 virtual bool IsHidden() = 0; | 41 virtual bool IsHidden() = 0; |
43 | 42 |
44 protected: | 43 protected: |
45 virtual ~WebMediaPlayerDelegate() {} | 44 virtual ~WebMediaPlayerDelegate() {} |
46 }; | 45 }; |
47 | 46 |
48 } // namespace media | 47 } // namespace media |
49 | 48 |
50 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ | 49 #endif // MEDIA_BLINK_WEBMEDIAPLAYER_DELEGATE_H_ |
OLD | NEW |