Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Unified Diff: webkit/api/src/WebMediaPlayerClientImpl.cpp

Issue 115482: Move WebMediaPlayerClientImpl files to WebKit API src location.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/media_player_private_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/api/src/WebMediaPlayerClientImpl.cpp
===================================================================
--- webkit/api/src/WebMediaPlayerClientImpl.cpp (revision 16276)
+++ webkit/api/src/WebMediaPlayerClientImpl.cpp (working copy)
@@ -3,23 +3,20 @@
// found in the LICENSE file.
#include "config.h"
-#include "webkit/glue/webmediaplayerclient_impl.h"
+#include "WebMediaPlayerClientImpl.h"
#if ENABLE(VIDEO)
-#include "webkit/api/public/WebCanvas.h"
-#include "webkit/api/public/WebCString.h"
-#include "webkit/api/public/WebKit.h"
-#include "webkit/api/public/WebKitClient.h"
-#include "webkit/api/public/WebMediaPlayer.h"
-#include "webkit/api/public/WebRect.h"
-#include "webkit/api/public/WebSize.h"
-#include "webkit/api/public/WebString.h"
-#include "webkit/api/public/WebURL.h"
-#include "webkit/glue/glue_util.h"
-#include "webkit/glue/webframe_impl.h"
-#include "webkit/glue/webview.h"
-#include "webkit/glue/webview_delegate.h"
+#include "TemporaryGlue.h"
+#include "WebCanvas.h"
+#include "WebCString.h"
+#include "WebKit.h"
+#include "WebKitClient.h"
+#include "WebMediaPlayer.h"
+#include "WebRect.h"
+#include "WebSize.h"
+#include "WebString.h"
+#include "WebURL.h"
#include "CString.h"
#include "Frame.h"
@@ -32,279 +29,320 @@
#include "PlatformContextSkia.h"
using namespace WebCore;
-using namespace WebKit;
-WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
- : m_webMediaPlayer(0) {
-}
+namespace WebKit {
+static bool s_isEnabled = false;
-WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() {
- delete m_webMediaPlayer;
+void WebMediaPlayerClientImpl::setIsEnabled(bool isEnabled)
+{
+ s_isEnabled = isEnabled;
}
-//////////////////////////////////////////////////////////////////////////////
-// WebMediaPlayerClientImpl, WebMediaPlayerClient implementations
-void WebMediaPlayerClientImpl::networkStateChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->networkStateChanged();
+void WebMediaPlayerClientImpl::registerSelf(MediaEngineRegistrar registrar)
+{
+ if (s_isEnabled) {
+ registrar(WebMediaPlayerClientImpl::create,
+ WebMediaPlayerClientImpl::getSupportedTypes,
+ WebMediaPlayerClientImpl::supportsType);
+ }
}
-void WebMediaPlayerClientImpl::readyStateChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->readyStateChanged();
+
+// WebMediaPlayerClient --------------------------------------------------------
+
+void WebMediaPlayerClientImpl::networkStateChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->networkStateChanged();
}
-void WebMediaPlayerClientImpl::volumeChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->volumeChanged();
+void WebMediaPlayerClientImpl::readyStateChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->readyStateChanged();
}
-void WebMediaPlayerClientImpl::timeChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->timeChanged();
+void WebMediaPlayerClientImpl::volumeChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->volumeChanged();
}
-void WebMediaPlayerClientImpl::repaint() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->repaint();
+void WebMediaPlayerClientImpl::timeChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->timeChanged();
}
-void WebMediaPlayerClientImpl::durationChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->durationChanged();
+void WebMediaPlayerClientImpl::repaint()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->repaint();
}
-void WebMediaPlayerClientImpl::rateChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->rateChanged();
+void WebMediaPlayerClientImpl::durationChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->durationChanged();
}
-void WebMediaPlayerClientImpl::sizeChanged() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->sizeChanged();
+void WebMediaPlayerClientImpl::rateChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->rateChanged();
}
-void WebMediaPlayerClientImpl::sawUnsupportedTracks() {
- ASSERT(m_mediaPlayer);
- m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(
- m_mediaPlayer);
+void WebMediaPlayerClientImpl::sizeChanged()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->sizeChanged();
}
-//////////////////////////////////////////////////////////////////////////////
-// WebMediaPlayerClientImpl, MediaPlayerPrivateInterface implementations
-void WebMediaPlayerClientImpl::load(const String& url) {
- delete m_webMediaPlayer;
+void WebMediaPlayerClientImpl::sawUnsupportedTracks()
+{
+ ASSERT(m_mediaPlayer);
+ m_mediaPlayer->mediaPlayerClient()->mediaPlayerSawUnsupportedTracks(m_mediaPlayer);
+}
- WebCore::Frame* frame = static_cast<HTMLMediaElement*>(
- m_mediaPlayer->mediaPlayerClient())->document()->frame();
- WebFrame* webFrame = WebFrameImpl::FromFrame(frame);
- WebViewDelegate* d = webFrame->GetView()->GetDelegate();
- m_webMediaPlayer = d->CreateWebMediaPlayer(this);
- m_webMediaPlayer->load(webkit_glue::KURLToWebURL(KURL(url)));
+// MediaPlayerPrivateInterface -------------------------------------------------
+
+void WebMediaPlayerClientImpl::load(const String& url)
+{
+ Frame* frame = static_cast<HTMLMediaElement*>(
+ m_mediaPlayer->mediaPlayerClient())->document()->frame();
+ m_webMediaPlayer.set(TemporaryGlue::createWebMediaPlayer(this, frame));
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->load(KURL(url));
}
-void WebMediaPlayerClientImpl::cancelLoad() {
- if (m_webMediaPlayer)
- m_webMediaPlayer->cancelLoad();
+void WebMediaPlayerClientImpl::cancelLoad()
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->cancelLoad();
}
-void WebMediaPlayerClientImpl::play() {
- if (m_webMediaPlayer)
- m_webMediaPlayer->play();
+void WebMediaPlayerClientImpl::play()
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->play();
}
-void WebMediaPlayerClientImpl::pause() {
- if (m_webMediaPlayer)
- m_webMediaPlayer->pause();
+void WebMediaPlayerClientImpl::pause()
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->pause();
}
-IntSize WebMediaPlayerClientImpl::naturalSize() const {
- if (m_webMediaPlayer) {
- const WebSize& size = m_webMediaPlayer->naturalSize();
- return IntSize(size.width, size.height);
- }
- return IntSize(0, 0);
+IntSize WebMediaPlayerClientImpl::naturalSize() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->naturalSize();
+ return IntSize();
}
-bool WebMediaPlayerClientImpl::hasVideo() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->hasVideo();
- return false;
+bool WebMediaPlayerClientImpl::hasVideo() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->hasVideo();
+ return false;
}
-void WebMediaPlayerClientImpl::setVisible(bool visible) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setVisible(visible);
+void WebMediaPlayerClientImpl::setVisible(bool visible)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setVisible(visible);
}
-float WebMediaPlayerClientImpl::duration() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->duration();
- return 0.0f;
+float WebMediaPlayerClientImpl::duration() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->duration();
+ return 0.0f;
}
-float WebMediaPlayerClientImpl::currentTime() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->currentTime();
- return 0.0f;
+float WebMediaPlayerClientImpl::currentTime() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->currentTime();
+ return 0.0f;
}
-void WebMediaPlayerClientImpl::seek(float time) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->seek(time);
+void WebMediaPlayerClientImpl::seek(float time)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->seek(time);
}
-bool WebMediaPlayerClientImpl::seeking() const {
- return m_webMediaPlayer->seeking();
+bool WebMediaPlayerClientImpl::seeking() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->seeking();
+ return false;
}
-void WebMediaPlayerClientImpl::setEndTime(float time) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setEndTime(time);
+void WebMediaPlayerClientImpl::setEndTime(float time)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setEndTime(time);
}
-void WebMediaPlayerClientImpl::setRate(float rate) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setRate(rate);
+void WebMediaPlayerClientImpl::setRate(float rate)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setRate(rate);
}
-bool WebMediaPlayerClientImpl::paused() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->paused();
- return false;
+bool WebMediaPlayerClientImpl::paused() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->paused();
+ return false;
}
-void WebMediaPlayerClientImpl::setVolume(float volume) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setVolume(volume);
+void WebMediaPlayerClientImpl::setVolume(float volume)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setVolume(volume);
}
-MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const {
- COMPILE_ASSERT(
- int(WebMediaPlayer::Empty) == int(MediaPlayer::Empty), Empty);
- COMPILE_ASSERT(
- int(WebMediaPlayer::Idle) == int(MediaPlayer::Idle), Idle);
- COMPILE_ASSERT(
- int(WebMediaPlayer::Loading) == int(MediaPlayer::Loading), Loading);
- COMPILE_ASSERT(
- int(WebMediaPlayer::Loaded) == int(MediaPlayer::Loaded), Loaded);
- COMPILE_ASSERT(
- int(WebMediaPlayer::FormatError) == int(MediaPlayer::FormatError),
- FormatError);
- COMPILE_ASSERT(
- int(WebMediaPlayer::NetworkError) == int(MediaPlayer::NetworkError),
- NetworkError);
- COMPILE_ASSERT(
- int(WebMediaPlayer::DecodeError) == int(MediaPlayer::DecodeError),
- DecodeError);
+MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
+{
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::Empty) == int(MediaPlayer::Empty), Empty);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::Idle) == int(MediaPlayer::Idle), Idle);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::Loading) == int(MediaPlayer::Loading), Loading);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::Loaded) == int(MediaPlayer::Loaded), Loaded);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::FormatError) == int(MediaPlayer::FormatError),
+ FormatError);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::NetworkError) == int(MediaPlayer::NetworkError),
+ NetworkError);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::DecodeError) == int(MediaPlayer::DecodeError),
+ DecodeError);
- if (m_webMediaPlayer)
- return static_cast<MediaPlayer::NetworkState>(
- m_webMediaPlayer->networkState());
- return MediaPlayer::Empty;
+ if (m_webMediaPlayer.get())
+ return static_cast<MediaPlayer::NetworkState>(m_webMediaPlayer->networkState());
+ return MediaPlayer::Empty;
}
-MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const {
- COMPILE_ASSERT(
- int(WebMediaPlayer::HaveNothing) == int(MediaPlayer::HaveNothing),
- HaveNothing);
- COMPILE_ASSERT(
- int(WebMediaPlayer::HaveMetadata) == int(MediaPlayer::HaveMetadata),
- HaveMetadata);
- COMPILE_ASSERT(
- int(WebMediaPlayer::HaveCurrentData) == int(MediaPlayer::HaveCurrentData),
- HaveCurrentData);
- COMPILE_ASSERT(
- int(WebMediaPlayer::HaveFutureData) == int(MediaPlayer::HaveFutureData),
- HaveFutureData);
- COMPILE_ASSERT(
- int(WebMediaPlayer::HaveEnoughData) == int(MediaPlayer::HaveEnoughData),
- HaveEnoughData);
+MediaPlayer::ReadyState WebMediaPlayerClientImpl::readyState() const
+{
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::HaveNothing) == int(MediaPlayer::HaveNothing),
+ HaveNothing);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::HaveMetadata) == int(MediaPlayer::HaveMetadata),
+ HaveMetadata);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::HaveCurrentData) == int(MediaPlayer::HaveCurrentData),
+ HaveCurrentData);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::HaveFutureData) == int(MediaPlayer::HaveFutureData),
+ HaveFutureData);
+ COMPILE_ASSERT(
+ int(WebMediaPlayer::HaveEnoughData) == int(MediaPlayer::HaveEnoughData),
+ HaveEnoughData);
- if (m_webMediaPlayer)
- return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState());
- return MediaPlayer::HaveNothing;
+ if (m_webMediaPlayer.get())
+ return static_cast<MediaPlayer::ReadyState>(m_webMediaPlayer->readyState());
+ return MediaPlayer::HaveNothing;
}
-float WebMediaPlayerClientImpl::maxTimeSeekable() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->maxTimeSeekable();
- return 0.0f;
+float WebMediaPlayerClientImpl::maxTimeSeekable() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->maxTimeSeekable();
+ return 0.0f;
}
-float WebMediaPlayerClientImpl::maxTimeBuffered() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->maxTimeBuffered();
- return 0.0f;
+float WebMediaPlayerClientImpl::maxTimeBuffered() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->maxTimeBuffered();
+ return 0.0f;
}
-int WebMediaPlayerClientImpl::dataRate() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->dataRate();
- return 0;
+int WebMediaPlayerClientImpl::dataRate() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->dataRate();
+ return 0;
}
-bool WebMediaPlayerClientImpl::totalBytesKnown() const {
- if (m_webMediaPlayer)
- return m_webMediaPlayer->totalBytesKnown();
- return false;
+bool WebMediaPlayerClientImpl::totalBytesKnown() const
+{
+ if (m_webMediaPlayer.get())
+ return m_webMediaPlayer->totalBytesKnown();
+ return false;
}
-unsigned WebMediaPlayerClientImpl::totalBytes() const {
- if (m_webMediaPlayer)
- return static_cast<unsigned>(m_webMediaPlayer->totalBytes());
- return 0;
+unsigned WebMediaPlayerClientImpl::totalBytes() const
+{
+ if (m_webMediaPlayer.get())
+ return static_cast<unsigned>(m_webMediaPlayer->totalBytes());
+ return 0;
}
-unsigned WebMediaPlayerClientImpl::bytesLoaded() const {
- if (m_webMediaPlayer)
- return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded());
- return 0;
+unsigned WebMediaPlayerClientImpl::bytesLoaded() const
+{
+ if (m_webMediaPlayer.get())
+ return static_cast<unsigned>(m_webMediaPlayer->bytesLoaded());
+ return 0;
}
-void WebMediaPlayerClientImpl::setSize(const IntSize& size) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setSize(WebSize(size.width(), size.height()));
+void WebMediaPlayerClientImpl::setSize(const IntSize& size)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setSize(WebSize(size.width(), size.height()));
}
-void WebMediaPlayerClientImpl::paint(GraphicsContext* context,
- const IntRect& rect) {
-// TODO(hclam): enable this for mac.
+void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& rect)
+{
+ // FIXME: enable this for mac.
#if WEBKIT_USING_SKIA
- if (m_webMediaPlayer)
- m_webMediaPlayer->paint(
- context->platformContext()->canvas(),
- WebRect(rect.x(), rect.y(), rect.width(), rect.height()));
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->paint(context->platformContext()->canvas(), rect);
#endif
}
-void WebMediaPlayerClientImpl::setAutobuffer(bool autoBuffer) {
- if (m_webMediaPlayer)
- m_webMediaPlayer->setAutoBuffer(autoBuffer);
+void WebMediaPlayerClientImpl::setAutobuffer(bool autoBuffer)
+{
+ if (m_webMediaPlayer.get())
+ m_webMediaPlayer->setAutoBuffer(autoBuffer);
}
-// static
-MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(
- MediaPlayer* player) {
- WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
- client->m_mediaPlayer = player;
- return client;
+MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player)
+{
+ WebMediaPlayerClientImpl* client = new WebMediaPlayerClientImpl();
+ client->m_mediaPlayer = player;
+ return client;
}
-// static
-void WebMediaPlayerClientImpl::getSupportedTypes(
- HashSet<String>& supportedTypes) {
- // TODO(hclam): decide what to do here, we should fill in the HashSet about
- // codecs that we support.
- notImplemented();
+void WebMediaPlayerClientImpl::getSupportedTypes(HashSet<String>& supportedTypes)
+{
+ // FIXME: decide what to do here, we should fill in the HashSet about
+ // codecs that we support.
+ notImplemented();
}
-// static
-MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(
- const String& type, const String& codecs) {
- // TODO(hclam): implement this nicely.
- return MediaPlayer::IsSupported;
+MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type,
+ const String& codecs)
+{
+ // FIXME: implement this properly.
+ return MediaPlayer::IsSupported;
}
+WebMediaPlayerClientImpl::WebMediaPlayerClientImpl()
+ : m_mediaPlayer(0)
+{
+}
+
+} // namespace WebKit
+
#endif // ENABLE(VIDEO)
« no previous file with comments | « webkit/api/src/WebMediaPlayerClientImpl.h ('k') | webkit/glue/media_player_private_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698