summaryrefslogtreecommitdiffstats
path: root/content/browser/android
diff options
context:
space:
mode:
Diffstat (limited to 'content/browser/android')
-rw-r--r--content/browser/android/browser_media_player_manager.cc23
-rw-r--r--content/browser/android/browser_media_player_manager.h13
-rw-r--r--content/browser/android/child_process_launcher_android.cc2
-rw-r--r--content/browser/android/content_view_core_impl.cc16
-rw-r--r--content/browser/android/surface_texture_peer_browser_impl.cc2
5 files changed, 23 insertions, 33 deletions
diff --git a/content/browser/android/browser_media_player_manager.cc b/content/browser/android/browser_media_player_manager.cc
index cd4f764..31457f0 100644
--- a/content/browser/android/browser_media_player_manager.cc
+++ b/content/browser/android/browser_media_player_manager.cc
@@ -22,28 +22,23 @@ using media::MediaPlayerAndroid;
// attempting to release inactive media players.
static const int kMediaPlayerThreshold = 1;
-namespace media {
+namespace content {
-static MediaPlayerManager::FactoryFunction g_factory_function = NULL;
+static BrowserMediaPlayerManager::Factory g_factory = NULL;
// static
-CONTENT_EXPORT void MediaPlayerManager::RegisterFactoryFunction(
- FactoryFunction factory_function) {
- g_factory_function = factory_function;
+void BrowserMediaPlayerManager::RegisterFactory(Factory factory) {
+ g_factory = factory;
}
// static
-media::MediaPlayerManager* MediaPlayerManager::Create(
- content::RenderViewHost* render_view_host) {
- if (g_factory_function)
- return g_factory_function(render_view_host);
- return new content::BrowserMediaPlayerManager(render_view_host);
+BrowserMediaPlayerManager* BrowserMediaPlayerManager::Create(
+ RenderViewHost* rvh) {
+ if (g_factory)
+ return g_factory(rvh);
+ return new BrowserMediaPlayerManager(rvh);
}
-} // namespace media
-
-namespace content {
-
BrowserMediaPlayerManager::BrowserMediaPlayerManager(
RenderViewHost* render_view_host)
: RenderViewHostObserver(render_view_host),
diff --git a/content/browser/android/browser_media_player_manager.h b/content/browser/android/browser_media_player_manager.h
index 2685806..e7c227a 100644
--- a/content/browser/android/browser_media_player_manager.h
+++ b/content/browser/android/browser_media_player_manager.h
@@ -39,6 +39,13 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
: public RenderViewHostObserver,
public media::MediaPlayerManager {
public:
+ // Permits embedders to provide an extended version of the class.
+ typedef BrowserMediaPlayerManager* (*Factory)(RenderViewHost*);
+ static void RegisterFactory(Factory factory);
+
+ // Returns a new instance using the registered factory if available.
+ static BrowserMediaPlayerManager* Create(RenderViewHost* rvh);
+
virtual ~BrowserMediaPlayerManager();
// RenderViewHostObserver overrides.
@@ -98,11 +105,7 @@ class CONTENT_EXPORT BrowserMediaPlayerManager
#endif
protected:
- friend MediaPlayerManager* MediaPlayerManager::Create(
- content::RenderViewHost*);
-
- // The instance of this class is supposed to be created by either Create()
- // method of MediaPlayerManager or the derived classes constructors.
+ // Clients must use Create() or subclass constructor.
explicit BrowserMediaPlayerManager(RenderViewHost* render_view_host);
// Message handlers.
diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc
index d73e299..ad1a018 100644
--- a/content/browser/android/child_process_launcher_android.cc
+++ b/content/browser/android/child_process_launcher_android.cc
@@ -8,6 +8,7 @@
#include "base/android/jni_array.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
+#include "content/browser/android/browser_media_player_manager.h"
#include "content/browser/renderer_host/compositor_impl_android.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/public/browser/browser_thread.h"
@@ -15,7 +16,6 @@
#include "content/public/common/content_switches.h"
#include "jni/ChildProcessLauncher_jni.h"
#include "media/base/android/media_player_android.h"
-#include "media/base/android/media_player_manager.h"
#include "ui/gl/android/scoped_java_surface.h"
using base::android::AttachCurrentThread;
diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc
index 41f0b94..24c3cbf 100644
--- a/content/browser/android/content_view_core_impl.cc
+++ b/content/browser/android/content_view_core_impl.cc
@@ -1301,12 +1301,8 @@ void ContentViewCoreImpl::AttachExternalVideoSurface(JNIEnv* env,
#if defined(GOOGLE_TV)
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());
- BrowserMediaPlayerManager* browser_media_player_manager =
- rvhi ? static_cast<BrowserMediaPlayerManager*>(
- rvhi->media_player_manager())
- : NULL;
- if (browser_media_player_manager) {
- browser_media_player_manager->AttachExternalVideoSurface(
+ if (rvhi && rvhi->media_player_manager()) {
+ rvhi->media_player_manager()->AttachExternalVideoSurface(
static_cast<int>(player_id), jsurface);
}
#endif
@@ -1318,12 +1314,8 @@ void ContentViewCoreImpl::DetachExternalVideoSurface(JNIEnv* env,
#if defined(GOOGLE_TV)
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
web_contents_->GetRenderViewHost());
- BrowserMediaPlayerManager* browser_media_player_manager =
- rvhi ? static_cast<BrowserMediaPlayerManager*>(
- rvhi->media_player_manager())
- : NULL;
- if (browser_media_player_manager) {
- browser_media_player_manager->DetachExternalVideoSurface(
+ if (rvhi && rvhi->media_player_manager()) {
+ rvhi->media_player_manager()->DetachExternalVideoSurface(
static_cast<int>(player_id));
}
#endif
diff --git a/content/browser/android/surface_texture_peer_browser_impl.cc b/content/browser/android/surface_texture_peer_browser_impl.cc
index de110db..622c2d0 100644
--- a/content/browser/android/surface_texture_peer_browser_impl.cc
+++ b/content/browser/android/surface_texture_peer_browser_impl.cc
@@ -4,11 +4,11 @@
#include "content/browser/android/surface_texture_peer_browser_impl.h"
+#include "content/browser/android/browser_media_player_manager.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "media/base/android/media_player_android.h"
-#include "media/base/android/media_player_manager.h"
#include "ui/gl/android/scoped_java_surface.h"
namespace content {