1 /*
2  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #include "webrtc/modules/desktop_capture/window_capturer.h"
12 
13 #include <assert.h>
14 
15 #include "webrtc/modules/desktop_capture/desktop_frame.h"
16 
17 namespace webrtc {
18 
19 namespace {
20 
21 class WindowCapturerNull : public WindowCapturer {
22  public:
23   WindowCapturerNull();
24   virtual ~WindowCapturerNull();
25 
26   // WindowCapturer interface.
27   bool GetWindowList(WindowList* windows) override;
28   bool SelectWindow(WindowId id) override;
29   bool BringSelectedWindowToFront() override;
30 
31   // DesktopCapturer interface.
32   void Start(Callback* callback) override;
33   void Capture(const DesktopRegion& region) override;
34 
35  private:
36   Callback* callback_;
37 
38   RTC_DISALLOW_COPY_AND_ASSIGN(WindowCapturerNull);
39 };
40 
WindowCapturerNull()41 WindowCapturerNull::WindowCapturerNull()
42     : callback_(NULL) {
43 }
44 
~WindowCapturerNull()45 WindowCapturerNull::~WindowCapturerNull() {
46 }
47 
GetWindowList(WindowList * windows)48 bool WindowCapturerNull::GetWindowList(WindowList* windows) {
49   // Not implemented yet.
50   return false;
51 }
52 
SelectWindow(WindowId id)53 bool WindowCapturerNull::SelectWindow(WindowId id) {
54   // Not implemented yet.
55   return false;
56 }
57 
BringSelectedWindowToFront()58 bool WindowCapturerNull::BringSelectedWindowToFront() {
59   // Not implemented yet.
60   return false;
61 }
62 
Start(Callback * callback)63 void WindowCapturerNull::Start(Callback* callback) {
64   assert(!callback_);
65   assert(callback);
66 
67   callback_ = callback;
68 }
69 
Capture(const DesktopRegion & region)70 void WindowCapturerNull::Capture(const DesktopRegion& region) {
71   // Not implemented yet.
72   callback_->OnCaptureCompleted(NULL);
73 }
74 
75 }  // namespace
76 
77 // static
Create(const DesktopCaptureOptions & options)78 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) {
79   return new WindowCapturerNull();
80 }
81 
82 }  // namespace webrtc
83