| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/desktop_shape_tracker.h" | 5 #include "remoting/host/desktop_shape_tracker.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/win/scoped_gdi_object.h" | 10 #include "base/win/scoped_gdi_object.h" |
| 11 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" | 11 #include "third_party/webrtc/modules/desktop_capture/desktop_capture_options.h" |
| 12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" | 12 #include "third_party/webrtc/modules/desktop_capture/desktop_region.h" |
| 13 | 13 |
| 14 namespace remoting { | 14 namespace remoting { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 struct EnumDesktopShapeData { | 18 struct EnumDesktopShapeData { |
| 19 EnumDesktopShapeData() | 19 EnumDesktopShapeData() |
| 20 : window_region(CreateRectRgn(0, 0, 0, 0)), | 20 : window_region(CreateRectRgn(0, 0, 0, 0)), |
| 21 desktop_region(CreateRectRgn(0, 0, 0, 0)) { | 21 desktop_region(CreateRectRgn(0, 0, 0, 0)) { |
| 22 } | 22 } |
| 23 base::win::ScopedRegion window_region; | 23 base::win::ScopedRegion window_region; |
| 24 base::win::ScopedRegion desktop_region; | 24 base::win::ScopedRegion desktop_region; |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 class DesktopShapeTrackerWin : public DesktopShapeTracker { | 27 class DesktopShapeTrackerWin : public DesktopShapeTracker { |
| 28 public: | 28 public: |
| 29 DesktopShapeTrackerWin(); | 29 DesktopShapeTrackerWin(); |
| 30 virtual ~DesktopShapeTrackerWin(); | 30 ~DesktopShapeTrackerWin() override; |
| 31 | 31 |
| 32 virtual void RefreshDesktopShape(); | 32 void RefreshDesktopShape() override; |
| 33 virtual const webrtc::DesktopRegion& desktop_shape(); | 33 const webrtc::DesktopRegion& desktop_shape() override; |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 // Callback passed to EnumWindows() to enumerate windows. | 36 // Callback passed to EnumWindows() to enumerate windows. |
| 37 static BOOL CALLBACK EnumWindowsCallback(HWND window, LPARAM lparam); | 37 static BOOL CALLBACK EnumWindowsCallback(HWND window, LPARAM lparam); |
| 38 | 38 |
| 39 // The most recently calculated desktop region. | 39 // The most recently calculated desktop region. |
| 40 webrtc::DesktopRegion desktop_shape_; | 40 webrtc::DesktopRegion desktop_shape_; |
| 41 | 41 |
| 42 // Stored to compare with newly calculated desktop shapes, to avoid converting | 42 // Stored to compare with newly calculated desktop shapes, to avoid converting |
| 43 // to an DesktopRegion unless the shape has actually changed. | 43 // to an DesktopRegion unless the shape has actually changed. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 | 132 |
| 133 } // namespace | 133 } // namespace |
| 134 | 134 |
| 135 // static | 135 // static |
| 136 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( | 136 scoped_ptr<DesktopShapeTracker> DesktopShapeTracker::Create( |
| 137 webrtc::DesktopCaptureOptions options) { | 137 webrtc::DesktopCaptureOptions options) { |
| 138 return make_scoped_ptr(new DesktopShapeTrackerWin()); | 138 return make_scoped_ptr(new DesktopShapeTrackerWin()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 } // namespace remoting | 141 } // namespace remoting |
| OLD | NEW |