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

Side by Side Diff: remoting/host/shaped_screen_capturer.cc

Issue 455073004: Switch DesktopEnvironment to return a DesktopCapturer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove ShapedDesktopCapturer::Create() Created 6 years, 4 months 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 | Annotate | Revision Log
OLDNEW
(Empty)
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.
4
5 #include "remoting/host/shaped_screen_capturer.h"
6
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"
11
12 namespace remoting {
13
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)));
21 }
22
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) {
29 }
30
31 ShapedScreenCapturer::~ShapedScreenCapturer() {}
32
33 void ShapedScreenCapturer::Start(webrtc::ScreenCapturer::Callback* callback) {
34 callback_ = callback;
35 screen_capturer_->Start(this);
36 }
37
38 void ShapedScreenCapturer::Capture(const webrtc::DesktopRegion& region) {
39 screen_capturer_->Capture(region);
40 }
41
42 void ShapedScreenCapturer::SetMouseShapeObserver(
43 MouseShapeObserver* mouse_shape_observer) {
44 screen_capturer_->SetMouseShapeObserver(mouse_shape_observer);
45 }
46
47 bool ShapedScreenCapturer::GetScreenList(ScreenList* screens) {
48 NOTIMPLEMENTED();
49 return false;
50 }
51
52 bool ShapedScreenCapturer::SelectScreen(webrtc::ScreenId id) {
53 NOTIMPLEMENTED();
54 return false;
55 }
56
57 webrtc::SharedMemory* ShapedScreenCapturer::CreateSharedMemory(size_t size) {
58 return callback_->CreateSharedMemory(size);
59 }
60
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);
65 }
66
67 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/shaped_screen_capturer.h ('k') | remoting/host/shaped_screen_capturer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698