| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 virtual void OnBufferingUpdate(int percent); | 113 virtual void OnBufferingUpdate(int percent); |
| 114 virtual void OnPlaybackComplete(); | 114 virtual void OnPlaybackComplete(); |
| 115 virtual void OnMediaInterrupted(); | 115 virtual void OnMediaInterrupted(); |
| 116 virtual void OnSeekComplete(); | 116 virtual void OnSeekComplete(); |
| 117 virtual void OnMediaPrepared(); | 117 virtual void OnMediaPrepared(); |
| 118 | 118 |
| 119 // When destroying a subclassed object on a non-UI thread | 119 // When destroying a subclassed object on a non-UI thread |
| 120 // it is still required to destroy the |listener_| related stuff | 120 // it is still required to destroy the |listener_| related stuff |
| 121 // on the UI thread. | 121 // on the UI thread. |
| 122 void DestroyListenerOnUIThread(); | 122 void DestroyListenerOnUIThread(); |
| 123 void SetAudible(bool is_audible); | |
| 124 | 123 |
| 125 MediaPlayerManager* manager() { return manager_; } | 124 MediaPlayerManager* manager() { return manager_; } |
| 126 | 125 |
| 127 base::WeakPtr<MediaPlayerAndroid> WeakPtrForUIThread(); | 126 base::WeakPtr<MediaPlayerAndroid> WeakPtrForUIThread(); |
| 128 | 127 |
| 129 RequestMediaResourcesCB request_media_resources_cb_; | 128 RequestMediaResourcesCB request_media_resources_cb_; |
| 130 | 129 |
| 131 private: | 130 private: |
| 132 friend class MediaPlayerListener; | 131 friend class MediaPlayerListener; |
| 133 | 132 |
| 134 // Player ID assigned to this player. | 133 // Player ID assigned to this player. |
| 135 int player_id_; | 134 int player_id_; |
| 136 | 135 |
| 137 // Resource manager for all the media players. | 136 // Resource manager for all the media players. |
| 138 MediaPlayerManager* manager_; | 137 MediaPlayerManager* manager_; |
| 139 | 138 |
| 140 // Url for the frame that contains this player. | 139 // Url for the frame that contains this player. |
| 141 GURL frame_url_; | 140 GURL frame_url_; |
| 142 | 141 |
| 143 // Listener object that listens to all the media player events. | 142 // Listener object that listens to all the media player events. |
| 144 scoped_ptr<MediaPlayerListener> listener_; | 143 scoped_ptr<MediaPlayerListener> listener_; |
| 145 | 144 |
| 146 // Maintains the audible state of the player, true if it is playing sound. | |
| 147 bool is_audible_; | |
| 148 | |
| 149 // Weak pointer passed to |listener_| for callbacks. | 145 // Weak pointer passed to |listener_| for callbacks. |
| 150 // NOTE: Weak pointers must be invalidated before all other member variables. | 146 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 151 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; | 147 base::WeakPtrFactory<MediaPlayerAndroid> weak_factory_; |
| 152 | 148 |
| 153 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); | 149 DISALLOW_COPY_AND_ASSIGN(MediaPlayerAndroid); |
| 154 }; | 150 }; |
| 155 | 151 |
| 156 } // namespace media | 152 } // namespace media |
| 157 | 153 |
| 158 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ | 154 #endif // MEDIA_BASE_ANDROID_MEDIA_PLAYER_ANDROID_H_ |
| OLD | NEW |