| 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 CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 6 #define CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| 7 | 7 |
| 8 #include <jni.h> | 8 #include <jni.h> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 class RendererMediaPlayerManager; | 63 class RendererMediaPlayerManager; |
| 64 class WebContentDecryptionModuleImpl; | 64 class WebContentDecryptionModuleImpl; |
| 65 class WebMediaPlayerDelegate; | 65 class WebMediaPlayerDelegate; |
| 66 | 66 |
| 67 // This class implements blink::WebMediaPlayer by keeping the android | 67 // This class implements blink::WebMediaPlayer by keeping the android |
| 68 // media player in the browser process. It listens to all the status changes | 68 // media player in the browser process. It listens to all the status changes |
| 69 // sent from the browser process and sends playback controls to the media | 69 // sent from the browser process and sends playback controls to the media |
| 70 // player. | 70 // player. |
| 71 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, | 71 class WebMediaPlayerAndroid : public blink::WebMediaPlayer, |
| 72 public cc::VideoFrameProvider, | 72 public cc::VideoFrameProvider, |
| 73 public RenderFrameObserver { | 73 public RenderFrameObserver, |
| 74 public StreamTextureFactoryContextObserver { |
| 74 public: | 75 public: |
| 75 // Construct a WebMediaPlayerAndroid object. This class communicates with the | 76 // Construct a WebMediaPlayerAndroid object. This class communicates with the |
| 76 // MediaPlayerAndroid object in the browser process through |proxy|. | 77 // MediaPlayerAndroid object in the browser process through |proxy|. |
| 77 // TODO(qinmin): |frame| argument is used to determine whether the current | 78 // TODO(qinmin): |frame| argument is used to determine whether the current |
| 78 // player can enter fullscreen. This logic should probably be moved into | 79 // player can enter fullscreen. This logic should probably be moved into |
| 79 // blink, so that enterFullscreen() will not be called if another video is | 80 // blink, so that enterFullscreen() will not be called if another video is |
| 80 // already in fullscreen. | 81 // already in fullscreen. |
| 81 WebMediaPlayerAndroid( | 82 WebMediaPlayerAndroid( |
| 82 blink::WebFrame* frame, | 83 blink::WebFrame* frame, |
| 83 blink::WebMediaPlayerClient* client, | 84 blink::WebMediaPlayerClient* client, |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 190 |
| 190 // Functions called when media player status changes. | 191 // Functions called when media player status changes. |
| 191 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); | 192 void OnConnectedToRemoteDevice(const std::string& remote_playback_message); |
| 192 void OnDisconnectedFromRemoteDevice(); | 193 void OnDisconnectedFromRemoteDevice(); |
| 193 void OnDidEnterFullscreen(); | 194 void OnDidEnterFullscreen(); |
| 194 void OnDidExitFullscreen(); | 195 void OnDidExitFullscreen(); |
| 195 void OnMediaPlayerPlay(); | 196 void OnMediaPlayerPlay(); |
| 196 void OnMediaPlayerPause(); | 197 void OnMediaPlayerPause(); |
| 197 void OnRequestFullscreen(); | 198 void OnRequestFullscreen(); |
| 198 | 199 |
| 200 // StreamTextureFactoryContextObserver implementation. |
| 201 virtual void OnContextLost() OVERRIDE; |
| 202 virtual void OnContextRestored() OVERRIDE; |
| 203 |
| 199 // Called when the player is released. | 204 // Called when the player is released. |
| 200 virtual void OnPlayerReleased(); | 205 virtual void OnPlayerReleased(); |
| 201 | 206 |
| 202 // This function is called by the RendererMediaPlayerManager to pause the | 207 // This function is called by the RendererMediaPlayerManager to pause the |
| 203 // video and release the media player and surface texture when we switch tabs. | 208 // video and release the media player and surface texture when we switch tabs. |
| 204 // However, the actual GlTexture is not released to keep the video screenshot. | 209 // However, the actual GlTexture is not released to keep the video screenshot. |
| 205 virtual void ReleaseMediaResources(); | 210 virtual void ReleaseMediaResources(); |
| 206 | 211 |
| 207 // RenderFrameObserver implementation. | 212 // RenderFrameObserver implementation. |
| 208 virtual void OnDestruct() OVERRIDE; | 213 virtual void OnDestruct() OVERRIDE; |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 | 500 |
| 496 // NOTE: Weak pointers must be invalidated before all other member variables. | 501 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 497 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; | 502 base::WeakPtrFactory<WebMediaPlayerAndroid> weak_factory_; |
| 498 | 503 |
| 499 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); | 504 DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerAndroid); |
| 500 }; | 505 }; |
| 501 | 506 |
| 502 } // namespace content | 507 } // namespace content |
| 503 | 508 |
| 504 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ | 509 #endif // CONTENT_RENDERER_MEDIA_ANDROID_WEBMEDIAPLAYER_ANDROID_H_ |
| OLD | NEW |