| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 WindowCapturerWin(); | 85 WindowCapturerWin(); |
| 86 virtual ~WindowCapturerWin(); | 86 virtual ~WindowCapturerWin(); |
| 87 | 87 |
| 88 // WindowCapturer interface. | 88 // WindowCapturer interface. |
| 89 bool GetWindowList(WindowList* windows) override; | 89 bool GetWindowList(WindowList* windows) override; |
| 90 bool SelectWindow(WindowId id) override; | 90 bool SelectWindow(WindowId id) override; |
| 91 bool BringSelectedWindowToFront() override; | 91 bool BringSelectedWindowToFront() override; |
| 92 | 92 |
| 93 // DesktopCapturer interface. | 93 // DesktopCapturer interface. |
| 94 void Start(Callback* callback) override; | 94 void Start(Callback* callback) override; |
| 95 void Capture(const DesktopRegion& region) override; | 95 void Capture2() override; |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 Callback* callback_ = nullptr; | 98 Callback* callback_ = nullptr; |
| 99 | 99 |
| 100 // HWND and HDC for the currently selected window or nullptr if window is not | 100 // HWND and HDC for the currently selected window or nullptr if window is not |
| 101 // selected. | 101 // selected. |
| 102 HWND window_ = nullptr; | 102 HWND window_ = nullptr; |
| 103 | 103 |
| 104 DesktopSize previous_size_; | 104 DesktopSize previous_size_; |
| 105 | 105 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return SetForegroundWindow(window_) != 0; | 153 return SetForegroundWindow(window_) != 0; |
| 154 } | 154 } |
| 155 | 155 |
| 156 void WindowCapturerWin::Start(Callback* callback) { | 156 void WindowCapturerWin::Start(Callback* callback) { |
| 157 assert(!callback_); | 157 assert(!callback_); |
| 158 assert(callback); | 158 assert(callback); |
| 159 | 159 |
| 160 callback_ = callback; | 160 callback_ = callback; |
| 161 } | 161 } |
| 162 | 162 |
| 163 void WindowCapturerWin::Capture(const DesktopRegion& region) { | 163 void WindowCapturerWin::Capture2() { |
| 164 if (!window_) { | 164 if (!window_) { |
| 165 LOG(LS_ERROR) << "Window hasn't been selected: " << GetLastError(); | 165 LOG(LS_ERROR) << "Window hasn't been selected: " << GetLastError(); |
| 166 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | 166 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
| 167 return; | 167 return; |
| 168 } | 168 } |
| 169 | 169 |
| 170 // Stop capturing if the window has been closed. | 170 // Stop capturing if the window has been closed. |
| 171 if (!IsWindow(window_)) { | 171 if (!IsWindow(window_)) { |
| 172 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); | 172 callback_->OnCaptureResult(Result::ERROR_PERMANENT, nullptr); |
| 173 return; | 173 return; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace | 265 } // namespace |
| 266 | 266 |
| 267 // static | 267 // static |
| 268 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { | 268 WindowCapturer* WindowCapturer::Create(const DesktopCaptureOptions& options) { |
| 269 return new WindowCapturerWin(); | 269 return new WindowCapturerWin(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace webrtc | 272 } // namespace webrtc |
| OLD | NEW |