Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / HTMLMediaElement.h
index 1d06256..a2352b9 100644 (file)
@@ -74,8 +74,8 @@ typedef Vector<CueInterval> CueList;
 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it
 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement.
 
-class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject
-{
+class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject {
+    DEFINE_WRAPPERTYPEINFO();
     WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement);
 public:
     static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String());
@@ -87,10 +87,6 @@ public:
 #if ENABLE(WEB_AUDIO)
     void clearWeakMembers(Visitor*);
 #endif
-
-    // Do not use player().
-    // FIXME: Replace all uses with webMediaPlayer() and remove this API.
-    MediaPlayer* player() const { return m_player.get(); }
     blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->webMediaPlayer() : 0; }
 
     virtual bool hasVideo() const { return false; }
@@ -109,6 +105,9 @@ public:
 
     bool isActive() const { return m_active; }
 
+    bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; }
+    bool isPlayingRemotely() const { return m_playingRemotely; }
+
     // error state
     PassRefPtrWillBeRawPtr<MediaError> error() const;
 
@@ -146,9 +145,11 @@ public:
     bool ended() const;
     bool autoplay() const;
     bool loop() const;
-    void setLoop(bool b);
+    void setLoop(bool);
     void play();
     void pause();
+    void requestRemotePlayback();
+    void requestRemotePlaybackControl();
 
     // statistics
     unsigned webkitAudioDecodedByteCount() const;
@@ -185,7 +186,7 @@ public:
 
     void addTextTrack(TextTrack*);
     void removeTextTrack(TextTrack*);
-    void closeCaptionTracksChanged();
+    void textTracksChanged();
     void notifyMediaPlayerOfTextTrackChanges();
 
     // Implements the "forget the media element's media-resource-specific tracks" algorithm in the HTML5 spec.
@@ -261,13 +262,15 @@ public:
     bool closedCaptionsVisible() const;
     void setClosedCaptionsVisible(bool);
 
+    void remoteRouteAvailabilityChanged(bool);
+    void connectedToRemoteDevice();
+    void disconnectedFromRemoteDevice();
+
     MediaControls* mediaControls() const;
 
     void sourceWasRemoved(HTMLSourceElement*);
     void sourceWasAdded(HTMLSourceElement*);
 
-    bool isPlaying() const { return m_playing; }
-
     // ActiveDOMObject functions.
     virtual bool hasPendingActivity() const OVERRIDE FINAL;
     virtual void contextDestroyed() OVERRIDE FINAL;
@@ -303,6 +306,10 @@ public:
     void setCloseMediaSourceWhenFinalizing();
 #endif
 
+    // Predicates also used when dispatching wrapper creation (cf. [SpecialWrapFor] IDL attribute usage.)
+    virtual bool isHTMLAudioElement() const { return false; }
+    virtual bool isHTMLVideoElement() const { return false; }
+
 protected:
     HTMLMediaElement(const QualifiedName&, Document&);
     virtual ~HTMLMediaElement();
@@ -371,7 +378,7 @@ private:
     void startProgressEventTimer();
     void stopPeriodicTimers();
 
-    void seek(double time, ExceptionState&);
+    void seek(double time);
     void finishSeek();
     void checkIfSeekNeeded();
     void addPlayedRange(double start, double end);
@@ -428,9 +435,6 @@ private:
     bool stoppedDueToErrors() const;
     bool couldPlayIfEnoughData() const;
 
-    // Pauses playback without changing any states or generating events
-    void setPausedInternal(bool);
-
     void setShouldDelayLoadEvent(bool);
     void invalidateCachedTime();
     void refreshCachedTime() const;
@@ -439,9 +443,6 @@ private:
     bool createMediaControls();
     void configureMediaControls();
 
-    void prepareMediaFragmentURI();
-    void applyMediaFragmentURI();
-
     virtual void* preDispatchEventHandler(Event*) OVERRIDE FINAL;
 
     void changeNetworkStateFromLoadingToIdle();
@@ -504,6 +505,9 @@ private:
     // The last time a timeupdate event was sent in movie time.
     double m_lastTimeUpdateEventMovieTime;
 
+    // The default playback start position.
+    double m_defaultPlaybackStartPosition;
+
     // Loading state.
     enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElement };
     LoadState m_loadState;
@@ -535,11 +539,10 @@ private:
 
     RefPtrWillBeMember<HTMLMediaSource> m_mediaSource;
 
+    // Cached time value. Only valid when ready state is HAVE_METADATA or
+    // higher, otherwise the current time is assumed to be zero.
     mutable double m_cachedTime;
-    mutable double m_cachedTimeWallClockUpdateTime;
-    mutable double m_minimumWallClockTimeToCacheMediaTime;
 
-    double m_fragmentStartTime;
     double m_fragmentEndTime;
 
     typedef unsigned PendingActionFlags;
@@ -562,8 +565,6 @@ private:
     // time has not changed since sending an "ended" event
     bool m_sentEndEvent : 1;
 
-    bool m_pausedInternal : 1;
-
     bool m_closedCaptionsVisible : 1;
 
     bool m_completelyLoaded : 1;
@@ -573,6 +574,8 @@ private:
     bool m_tracksAreReady : 1;
     bool m_haveVisibleTextTrack : 1;
     bool m_processingPreferenceChange : 1;
+    bool m_remoteRoutesAvailable : 1;
+    bool m_playingRemotely : 1;
 #if ENABLE(OILPAN)
     bool m_isFinalizing : 1;
     bool m_closeMediaSourceWhenFinalizing : 1;
@@ -592,6 +595,7 @@ private:
 #if ENABLE(WEB_AUDIO)
     // This is a weak reference, since m_audioSourceNode holds a reference to us.
     // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
+    GC_PLUGIN_IGNORE("http://crbug.com/404577")
     RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode;
 #endif
 
@@ -630,6 +634,6 @@ inline bool isHTMLMediaElement(const HTMLElement& element)
 
 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
 
-} //namespace
+} // namespace blink
 
-#endif
+#endif // HTMLMediaElement_h