OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 6 #define MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 MediaPlayerAndroid(int player_id, | 95 MediaPlayerAndroid(int player_id, |
96 MediaPlayerManager* manager, | 96 MediaPlayerManager* manager, |
97 const RequestMediaResourcesCB& request_media_resources_cb, | 97 const RequestMediaResourcesCB& request_media_resources_cb, |
98 const GURL& frame_url); | 98 const GURL& frame_url); |
99 | 99 |
100 // Attach/Detaches |listener_| for listening to all the media events. If | 100 // Attach/Detaches |listener_| for listening to all the media events. If |
101 // |j_media_player| is NULL, |listener_| only listens to the system media | 101 // |j_media_player| is NULL, |listener_| only listens to the system media |
102 // events. Otherwise, it also listens to the events from |j_media_player|. | 102 // events. Otherwise, it also listens to the events from |j_media_player|. |
103 void AttachListener(jobject j_media_player); | 103 void AttachListener(jobject j_media_player); |
104 void DetachListener(); | 104 void DetachListener(); |
| 105 void SetAudible(bool is_audible); |
105 | 106 |
106 MediaPlayerManager* manager() { return manager_; } | 107 MediaPlayerManager* manager() { return manager_; } |
107 | 108 |
108 RequestMediaResourcesCB request_media_resources_cb_; | 109 RequestMediaResourcesCB request_media_resources_cb_; |
109 | 110 |
110 private: | 111 private: |
111 // Player ID assigned to this player. | 112 // Player ID assigned to this player. |
112 int player_id_; | 113 int player_id_; |
113 | 114 |
114 // Resource manager for all the media players. | 115 // Resource manager for all the media players. |
115 MediaPlayerManager* manager_; | 116 MediaPlayerManager* manager_; |
116 | 117 |
117 // Url for the frame that contains this player. | 118 // Url for the frame that contains this player. |
118 GURL frame_url_; | 119 GURL frame_url_; |
119 | 120 |
120 // Listener object that listens to all the media player events. | 121 // Listener object that listens to all the media player events. |
121 scoped_ptr<MediaPlayerListener> listener_; | 122 scoped_ptr<MediaPlayerListener> listener_; |
122 | 123 |
123 // Weak pointer passed to |listener_| for callbacks. | 124 // Weak pointer passed to |listener_| for callbacks. |
124 // NOTE: Weak pointers must be invalidated before all other member variables. | 125 // NOTE: Weak pointers must be invalidated before all other member variables. |
125 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 126 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
126 | 127 |
| 128 // Maintains the audible state of the player, true if it is playing sound. |
| 129 bool is_audible_; |
| 130 |
127 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 131 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
128 }; | 132 }; |
129 | 133 |
130 } // namespace media | 134 } // namespace media |
131 | 135 |
132 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 136 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
OLD | NEW |