Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef REMOTING_HOST_CAPTURER_H_ | 5 #ifndef REMOTING_HOST_CAPTURER_H_ |
| 6 #define REMOTING_HOST_CAPTURER_H_ | 6 #define REMOTING_HOST_CAPTURER_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "remoting/base/capture_data.h" | 10 #include "remoting/base/capture_data.h" |
| 11 #include "remoting/base/cursor_shape_data.h" | |
|
Sergey Ulanov
2012/05/15 23:51:34
Can you forward-declare CursorShapeData?
Sergey Ulanov
2012/05/15 23:51:34
This file seems to be missing from this CL
garykac
2012/05/22 00:42:03
Done.
garykac
2012/05/22 00:42:03
Done. (for CaptureData as well)
| |
| 11 #include "third_party/skia/include/core/SkRegion.h" | 12 #include "third_party/skia/include/core/SkRegion.h" |
| 12 | 13 |
| 13 namespace remoting { | 14 namespace remoting { |
| 14 | 15 |
| 15 // A class to perform the task of capturing the image of a window. | 16 // A class to perform the task of capturing the image of a window. |
| 16 // The capture action is asynchronous to allow maximum throughput. | 17 // The capture action is asynchronous to allow maximum throughput. |
| 17 // | 18 // |
| 18 // The full capture process is as follows: | 19 // The full capture process is as follows: |
| 19 // | 20 // |
| 20 // (1) Start | 21 // (1) Start |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 42 // | 43 // |
| 43 // Implementation has to ensure the following guarantees: | 44 // Implementation has to ensure the following guarantees: |
| 44 // 1. Double buffering | 45 // 1. Double buffering |
| 45 // Since data can be read while another capture action is happening. | 46 // Since data can be read while another capture action is happening. |
| 46 class Capturer { | 47 class Capturer { |
| 47 public: | 48 public: |
| 48 // CaptureCompletedCallback is called when the capturer has completed. | 49 // CaptureCompletedCallback is called when the capturer has completed. |
| 49 typedef base::Callback<void(scoped_refptr<CaptureData>)> | 50 typedef base::Callback<void(scoped_refptr<CaptureData>)> |
| 50 CaptureCompletedCallback; | 51 CaptureCompletedCallback; |
| 51 | 52 |
| 53 // CursorShapeChangedCallback is called when the cursor shape has changed. | |
| 54 typedef base::Callback<void(scoped_refptr<CursorShapeData>)> | |
| 55 CursorShapeChangedCallback; | |
| 56 | |
| 52 virtual ~Capturer() {}; | 57 virtual ~Capturer() {}; |
| 53 | 58 |
| 54 // Create platform-specific capturer. | 59 // Create platform-specific capturer. |
| 55 static Capturer* Create(); | 60 static Capturer* Create(); |
| 56 | 61 |
| 57 #if defined(OS_LINUX) | 62 #if defined(OS_LINUX) |
| 58 // Set whether the Capturer should try to use X DAMAGE support if it is | 63 // Set whether the Capturer should try to use X DAMAGE support if it is |
| 59 // available. This needs to be called before the Capturer is created. | 64 // available. This needs to be called before the Capturer is created. |
| 60 // This is used by the Virtual Me2Me host, since the XDamage extension is | 65 // This is used by the Virtual Me2Me host, since the XDamage extension is |
| 61 // known to work reliably in this case. | 66 // known to work reliably in this case. |
| 62 | 67 |
| 63 // TODO(lambroslambrou): This currently sets a global flag, referenced during | 68 // TODO(lambroslambrou): This currently sets a global flag, referenced during |
| 64 // Capturer::Create(). This is a temporary solution, until the | 69 // Capturer::Create(). This is a temporary solution, until the |
| 65 // DesktopEnvironment class is refactored to allow applications to control | 70 // DesktopEnvironment class is refactored to allow applications to control |
| 66 // the creation of various stubs (including the Capturer) - see | 71 // the creation of various stubs (including the Capturer) - see |
| 67 // http://crbug.com/104544 | 72 // http://crbug.com/104544 |
| 68 static void EnableXDamage(bool enable); | 73 static void EnableXDamage(bool enable); |
| 69 #endif // defined(OS_LINUX) | 74 #endif // defined(OS_LINUX) |
| 70 | 75 |
| 71 // Called at the beginning of a capturing session. | 76 // Called at the beginning of a capturing session. |
| 72 virtual void Start() = 0; | 77 virtual void Start() = 0; |
| 73 | 78 |
| 74 // Called at the end of a capturing session. | 79 // Called at the end of a capturing session. |
| 75 virtual void Stop() = 0; | 80 virtual void Stop() = 0; |
| 76 | 81 |
| 82 // Set callback to be called when the cursor shape changes. | |
| 83 virtual void SetCursorShapeChangedCallback( | |
| 84 const CursorShapeChangedCallback& callback) = 0; | |
| 85 | |
| 77 // Called when the screen configuration is changed. | 86 // Called when the screen configuration is changed. |
| 78 virtual void ScreenConfigurationChanged() = 0; | 87 virtual void ScreenConfigurationChanged() = 0; |
| 79 | 88 |
| 80 // Return the pixel format of the screen. | 89 // Return the pixel format of the screen. |
| 81 virtual media::VideoFrame::Format pixel_format() const = 0; | 90 virtual media::VideoFrame::Format pixel_format() const = 0; |
| 82 | 91 |
| 83 // Clear out the invalid region. | 92 // Clear out the invalid region. |
| 84 virtual void ClearInvalidRegion() = 0; | 93 virtual void ClearInvalidRegion() = 0; |
| 85 | 94 |
| 86 // Invalidate the specified region. | 95 // Invalidate the specified region. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 105 virtual void CaptureInvalidRegion( | 114 virtual void CaptureInvalidRegion( |
| 106 const CaptureCompletedCallback& callback) = 0; | 115 const CaptureCompletedCallback& callback) = 0; |
| 107 | 116 |
| 108 // Get the size of the most recently captured screen. | 117 // Get the size of the most recently captured screen. |
| 109 virtual const SkISize& size_most_recent() const = 0; | 118 virtual const SkISize& size_most_recent() const = 0; |
| 110 }; | 119 }; |
| 111 | 120 |
| 112 } // namespace remoting | 121 } // namespace remoting |
| 113 | 122 |
| 114 #endif // REMOTING_HOST_CAPTURER_H_ | 123 #endif // REMOTING_HOST_CAPTURER_H_ |
| OLD | NEW |