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

Side by Side Diff: third_party/WebKit/Source/modules/mediacapturefromelement/HTMLCanvasElementCapture.cpp

Issue 1467103003: Basic use implementation for MediaStream from Canvas: captureStream() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "config.h"
6 #include "modules/mediacapturefromelement/HTMLCanvasElementCapture.h"
7
8 #include "core/dom/ExceptionCode.h"
9 #include "core/html/HTMLCanvasElement.h"
10 #include "modules/mediacapturefromelement/CanvasCaptureMediaStream.h"
11 #include "platform/Logging.h"
12 #include "platform/NotImplemented.h"
13 #include "platform/mediastream/MediaStreamCenter.h"
14 #include "public/platform/Platform.h"
15 #include "public/platform/WebCanvasCaptureHandler.h"
16 #include "public/platform/WebMediaStream.h"
17 #include "public/platform/WebMediaStreamSource.h"
18 #include "public/platform/WebMediaStreamTrack.h"
19
20 namespace blink {
21
22 CanvasCaptureMediaStream* HTMLCanvasElementCapture::captureStream(HTMLCanvasElem ent& element, ExceptionState& exceptionState)
23 {
24 WebMediaStream stream;
25 stream.initialize(WebVector<WebMediaStreamTrack>(), Vector<WebMediaStreamTra ck>());
26 WebSize size(element.width(), element.height());
27
28 if (!element.originClean()) {
29 exceptionState.throwDOMException(SecurityError, "Canvas is not origin-cl ean.");
30 return CanvasCaptureMediaStream::create(stream, adoptRef(&element));
31 }
32
33 OwnPtr<WebCanvasCaptureHandler> handler = adoptPtr(Platform::current()->crea teCanvasCaptureHandler(size, &stream));
34 return CanvasCaptureMediaStream::create(stream, adoptRef(&element), handler. release());
35 }
36
37 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698