Index: third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp |
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5a1f18792a8ac0376975ebc11afeea5b1c17bcc5 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp |
@@ -0,0 +1,33 @@ |
+// Copyright 2015 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. |
+ |
+#include "config.h" |
+#include "modules/mediacapturefromelement/HTMLCanvasElementCapture.h" |
+ |
+#include "core/html/HTMLCanvasElement.h" |
+#include "modules/mediacapturefromelement/CanvasCaptureMediaStream.h" |
+#include "platform/Logging.h" |
+#include "platform/NotImplemented.h" |
+#include "platform/mediastream/MediaStreamCenter.h" |
+#include "public/platform/Platform.h" |
+#include "public/platform/WebCanvasCaptureHandler.h" |
+#include "public/platform/WebMediaStream.h" |
+#include "public/platform/WebMediaStreamSource.h" |
+#include "public/platform/WebMediaStreamTrack.h" |
+ |
+namespace blink { |
+ |
+CanvasCaptureMediaStream* HTMLCanvasElementCapture::captureStream(HTMLCanvasElement& element) |
peria
2015/11/24 05:50:22
Please do not use non-const reference.
emircan
2015/11/24 22:16:51
Same as the answer above.
|
+{ |
+ // TODO(emircan): Check for origin-clean here and possibly throw an error. See crbug.com/544359. |
+ |
+ WebMediaStream stream; |
+ stream.initialize(WebVector<WebMediaStreamTrack>(), Vector<WebMediaStreamTrack>()); |
+ WebSize size(element.width(), element.height()); |
+ |
+ OwnPtr<WebCanvasCaptureHandler> handler = adoptPtr(Platform::current()->createCanvasCaptureHandler(size, &stream)); |
+ return CanvasCaptureMediaStream::create(stream, element, handler.release()); |
+} |
+ |
+} // namespace blink |