Bug 1208371 - Add CORSMode methods to MediaStreamTrack. r?mt draft
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 05 Jan 2016 10:16:27 +0800
changeset 342130 9263841d760637a9d5976b41e048f4d3a00be292
parent 342129 00a51c27520180068c3f23c503272f4b3218955e
child 342131 613bf001396b3115eaf8db10b1fc682383b73831
push id13352
push userpehrsons@gmail.com
push dateFri, 18 Mar 2016 13:49:47 +0000
reviewersmt
bugs1208371
milestone47.0a1
Bug 1208371 - Add CORSMode methods to MediaStreamTrack. r?mt MozReview-Commit-ID: 5vYHjdDHDSn
dom/media/MediaStreamTrack.h
--- a/dom/media/MediaStreamTrack.h
+++ b/dom/media/MediaStreamTrack.h
@@ -6,16 +6,17 @@
 #ifndef MEDIASTREAMTRACK_H_
 #define MEDIASTREAMTRACK_H_
 
 #include "mozilla/DOMEventTargetHelper.h"
 #include "nsError.h"
 #include "nsID.h"
 #include "StreamBuffer.h"
 #include "MediaTrackConstraints.h"
+#include "mozilla/CORSMode.h"
 #include "PrincipalChangeObserver.h"
 
 namespace mozilla {
 
 class DOMMediaStream;
 class MediaEnginePhotoCallback;
 class MediaStream;
 class MediaStreamGraph;
@@ -62,16 +63,23 @@ public:
   virtual MediaSourceEnum GetMediaSource() const = 0;
 
   /**
    * Get this TrackSource's principal.
    */
   nsIPrincipal* GetPrincipal() const { return mPrincipal; }
 
   /**
+   * Get the source's current CORSMode. If not applicable CORS_NONE is returned.
+   * The sink will be notified of changes to our CORSMode through
+   * NotifyPrincipalChanged().
+   */
+  virtual CORSMode GetCORSMode() const { return CORS_NONE; }
+
+  /**
    * Indicates whether the track is remote or not per the MediaCapture and
    * Streams spec.
    */
   virtual bool IsRemote() const { return mIsRemote; }
 
   /**
    * Forwards a photo request to backends that support it. Other backends return
    * NS_ERROR_NOT_IMPLEMENTED to indicate that a MediaStreamGraph-based fallback
@@ -221,16 +229,21 @@ public:
   // Notifications from the MediaStreamGraph
   void NotifyEnded() { mEnded = true; }
 
   /**
    * Get this track's principal.
    */
   nsIPrincipal* GetPrincipal() const { return GetSource().GetPrincipal(); }
 
+  /**
+   * Get this track's CORS mode.
+   */
+  CORSMode GetCORSMode() const { return GetSource().GetCORSMode(); }
+
   MediaStreamGraph* Graph();
 
   MediaStreamTrackSource& GetSource() const
   {
     MOZ_RELEASE_ASSERT(mSource, "The track source is only removed on destruction");
     return *mSource;
   }