Chromium Code Reviews| OLD | NEW |
|---|---|
| (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" | |
|
haraken
2015/12/04 03:55:07
You're including a bit too much.
emircan
2015/12/04 04:46:15
Oops. I am cleaning it up. Thanks for the catch.
| |
| 19 | |
| 20 namespace { | |
| 21 const double kDefaultFrameRate = 60.0; | |
| 22 } // anonymous namespace | |
| 23 | |
| 24 namespace blink { | |
| 25 | |
| 26 CanvasCaptureMediaStream* HTMLCanvasElementCapture::captureStream(HTMLCanvasElem ent& element, ExceptionState& exceptionState) | |
| 27 { | |
| 28 WebMediaStream stream; | |
| 29 stream.initialize(WebVector<WebMediaStreamTrack>(), Vector<WebMediaStreamTra ck>()); | |
| 30 WebSize size(element.width(), element.height()); | |
| 31 | |
| 32 if (!element.originClean()) { | |
| 33 exceptionState.throwDOMException(SecurityError, "Canvas is not origin-cl ean."); | |
| 34 return CanvasCaptureMediaStream::create(stream, &element); | |
| 35 } | |
| 36 | |
| 37 OwnPtr<WebCanvasCaptureHandler> handler = adoptPtr(Platform::current()->crea teCanvasCaptureHandler(size, kDefaultFrameRate, &stream)); | |
| 38 return CanvasCaptureMediaStream::create(stream, &element, handler.release()) ; | |
| 39 } | |
| 40 | |
| 41 } // namespace blink | |
| OLD | NEW |