Update parsing of dumpsys batterystats
[chromium-blink-merge.git] / remoting / host / shaped_screen_capturer.cc
blob00e808fadd8c7670688499ea235c92311b41b9ec
1 // Copyright 2013 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.
5 #include "remoting/host/shaped_screen_capturer.h"
7 #include "base/logging.h"
8 #include "remoting/host/desktop_shape_tracker.h"
9 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h"
10 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
12 namespace remoting {
14 // static
15 scoped_ptr<ShapedScreenCapturer> ShapedScreenCapturer::Create(
16 webrtc::DesktopCaptureOptions options) {
17 return scoped_ptr<ShapedScreenCapturer>(
18 new ShapedScreenCapturer(scoped_ptr<webrtc::ScreenCapturer>(
19 webrtc::ScreenCapturer::Create(options)),
20 DesktopShapeTracker::Create(options)));
23 ShapedScreenCapturer::ShapedScreenCapturer(
24 scoped_ptr<webrtc::ScreenCapturer> screen_capturer,
25 scoped_ptr<DesktopShapeTracker> shape_tracker)
26 : screen_capturer_(screen_capturer.Pass()),
27 shape_tracker_(shape_tracker.Pass()),
28 callback_(NULL) {
31 ShapedScreenCapturer::~ShapedScreenCapturer() {}
33 void ShapedScreenCapturer::Start(webrtc::ScreenCapturer::Callback* callback) {
34 callback_ = callback;
35 screen_capturer_->Start(this);
38 void ShapedScreenCapturer::Capture(const webrtc::DesktopRegion& region) {
39 screen_capturer_->Capture(region);
42 void ShapedScreenCapturer::SetMouseShapeObserver(
43 MouseShapeObserver* mouse_shape_observer) {
44 screen_capturer_->SetMouseShapeObserver(mouse_shape_observer);
47 bool ShapedScreenCapturer::GetScreenList(ScreenList* screens) {
48 NOTIMPLEMENTED();
49 return false;
52 bool ShapedScreenCapturer::SelectScreen(webrtc::ScreenId id) {
53 NOTIMPLEMENTED();
54 return false;
57 webrtc::SharedMemory* ShapedScreenCapturer::CreateSharedMemory(size_t size) {
58 return callback_->CreateSharedMemory(size);
61 void ShapedScreenCapturer::OnCaptureCompleted(webrtc::DesktopFrame* frame) {
62 shape_tracker_->RefreshDesktopShape();
63 frame->set_shape(new webrtc::DesktopRegion(shape_tracker_->desktop_shape()));
64 callback_->OnCaptureCompleted(frame);
67 } // namespace remoting