Index: webkit/api/src/WebMediaPlayerClientImpl.h |
=================================================================== |
--- webkit/api/src/WebMediaPlayerClientImpl.h (revision 16276) |
+++ webkit/api/src/WebMediaPlayerClientImpl.h (working copy) |
@@ -1,101 +1,107 @@ |
-// Copyright (c) 2009 The Chromium Authors. All rights reserved. |
-// Use of this source code is governed by a BSD-style license that can be |
-// found in the LICENSE file. |
+/* |
+ * Copyright (C) 2009 Google Inc. All rights reserved. |
+ * |
+ * Redistribution and use in source and binary forms, with or without |
+ * modification, are permitted provided that the following conditions are |
+ * met: |
+ * |
+ * * Redistributions of source code must retain the above copyright |
+ * notice, this list of conditions and the following disclaimer. |
+ * * Redistributions in binary form must reproduce the above |
+ * copyright notice, this list of conditions and the following disclaimer |
+ * in the documentation and/or other materials provided with the |
+ * distribution. |
+ * * Neither the name of Google Inc. nor the names of its |
+ * contributors may be used to endorse or promote products derived from |
+ * this software without specific prior written permission. |
+ * |
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+ */ |
-#ifndef WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ |
-#define WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ |
+#ifndef WebMediaPlayerClientImpl_h |
+#define WebMediaPlayerClientImpl_h |
#if ENABLE(VIDEO) |
-#include "webkit/api/public/WebMediaPlayerClient.h" |
+#include "WebMediaPlayerClient.h" |
#include "MediaPlayerPrivate.h" |
+#include <wtf/OwnPtr.h> |
-namespace WebCore { |
-class MediaPlayerPrivate; |
-} // namespace WebCore |
- |
namespace WebKit { |
-class WebMediaPlayer; |
-} // namespace WebKit |
+ class WebMediaPlayer; |
-class WebMediaPlayerClientImpl : public WebKit::WebMediaPlayerClient, |
- public WebCore::MediaPlayerPrivateInterface { |
- public: |
- virtual ~WebMediaPlayerClientImpl(); |
+ // This class serves as a bridge between WebCore::MediaPlayer and |
+ // WebKit::WebMediaPlayer. |
+ class WebMediaPlayerClientImpl : public WebMediaPlayerClient |
+ , public WebCore::MediaPlayerPrivateInterface { |
+ public: |
+ static void setIsEnabled(bool); |
+ static void registerSelf(WebCore::MediaEngineRegistrar); |
- //////////////////////////////////////////////////////////////////////////// |
- // WebMediaPlayerPlayerClient methods |
- virtual void networkStateChanged(); |
- virtual void readyStateChanged(); |
- virtual void volumeChanged(); |
- virtual void timeChanged(); |
- virtual void repaint(); |
- virtual void durationChanged(); |
- virtual void rateChanged(); |
- virtual void sizeChanged(); |
- virtual void sawUnsupportedTracks(); |
+ // WebMediaPlayerClient methods: |
+ virtual void networkStateChanged(); |
+ virtual void readyStateChanged(); |
+ virtual void volumeChanged(); |
+ virtual void timeChanged(); |
+ virtual void repaint(); |
+ virtual void durationChanged(); |
+ virtual void rateChanged(); |
+ virtual void sizeChanged(); |
+ virtual void sawUnsupportedTracks(); |
- //////////////////////////////////////////////////////////////////////////// |
- // MediaPlayerPrivateInterface methods |
- virtual void load(const WebCore::String& url); |
- virtual void cancelLoad(); |
+ // MediaPlayerPrivateInterface methods: |
+ virtual void load(const WebCore::String& url); |
+ virtual void cancelLoad(); |
+ virtual void play(); |
+ virtual void pause(); |
+ virtual WebCore::IntSize naturalSize() const; |
+ virtual bool hasVideo() const; |
+ virtual void setVisible(bool); |
+ virtual float duration() const; |
+ virtual float currentTime() const; |
+ virtual void seek(float time); |
+ virtual bool seeking() const; |
+ virtual void setEndTime(float time); |
+ virtual void setRate(float); |
+ virtual bool paused() const; |
+ virtual void setVolume(float); |
+ virtual WebCore::MediaPlayer::NetworkState networkState() const; |
+ virtual WebCore::MediaPlayer::ReadyState readyState() const; |
+ virtual float maxTimeSeekable() const; |
+ virtual float maxTimeBuffered() const; |
+ virtual int dataRate() const; |
+ virtual void setAutobuffer(bool); |
+ virtual bool totalBytesKnown() const; |
+ virtual unsigned totalBytes() const; |
+ virtual unsigned bytesLoaded() const; |
+ virtual void setSize(const WebCore::IntSize&); |
+ virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); |
- virtual void play(); |
- virtual void pause(); |
+ private: |
+ WebMediaPlayerClientImpl(); |
- virtual WebCore::IntSize naturalSize() const; |
+ static WebCore::MediaPlayerPrivateInterface* create(WebCore::MediaPlayer*); |
+ static void getSupportedTypes(WTF::HashSet<WebCore::String>&); |
+ static WebCore::MediaPlayer::SupportsType supportsType( |
+ const WebCore::String& type, const WebCore::String& codecs); |
- virtual bool hasVideo() const; |
+ WebCore::MediaPlayer* m_mediaPlayer; |
+ OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
+ }; |
- virtual void setVisible(bool); |
+} // namespace WebKit |
- virtual float duration() const; |
+#endif |
- virtual float currentTime() const; |
- virtual void seek(float time); |
- virtual bool seeking() const; |
- |
- virtual void setEndTime(float time); |
- |
- virtual void setRate(float); |
- virtual bool paused() const; |
- |
- virtual void setVolume(float); |
- |
- virtual WebCore::MediaPlayer::NetworkState networkState() const; |
- virtual WebCore::MediaPlayer::ReadyState readyState() const; |
- |
- virtual float maxTimeSeekable() const; |
- virtual float maxTimeBuffered() const; |
- |
- virtual int dataRate() const; |
- virtual void setAutobuffer(bool); |
- |
- virtual bool totalBytesKnown() const; |
- virtual unsigned totalBytes() const; |
- virtual unsigned bytesLoaded() const; |
- |
- virtual void setSize(const WebCore::IntSize&); |
- virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&); |
- |
- private: |
- friend class WebCore::MediaPlayerPrivate; |
- |
- WebMediaPlayerClientImpl(); |
- |
- // Static methods used by WebKit for construction. |
- static WebCore::MediaPlayerPrivateInterface* create( |
- WebCore::MediaPlayer* player); |
- static void getSupportedTypes( |
- WTF::HashSet<WebCore::String>& supportedTypes); |
- static WebCore::MediaPlayer::SupportsType supportsType( |
- const WebCore::String& type, const WebCore::String& codecs); |
- |
- WebCore::MediaPlayer* m_mediaPlayer; |
- WebKit::WebMediaPlayer* m_webMediaPlayer; |
-}; |
- |
-#endif // ENABLE(VIDEO) |
- |
-#endif // WEBKIT_GLUE_WEBMEDIAPLAYERCLIENT_IMPL_H_ |
+#endif |