LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/desktop_capture - mouse_cursor_monitor.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 4 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_H_
      12             : #define WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_H_
      13             : 
      14             : #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
      15             : #include "webrtc/modules/desktop_capture/desktop_geometry.h"
      16             : #include "webrtc/typedefs.h"
      17             : 
      18             : namespace webrtc {
      19             : 
      20             : class DesktopCaptureOptions;
      21             : class DesktopFrame;
      22             : class MouseCursor;
      23             : 
      24             : // Captures mouse shape and position.
      25           0 : class MouseCursorMonitor {
      26             :  public:
      27             :   enum CursorState {
      28             :     // Cursor on top of the window including window decorations.
      29             :     INSIDE,
      30             : 
      31             :     // Cursor is outside of the window.
      32             :     OUTSIDE,
      33             :   };
      34             : 
      35             :   enum Mode {
      36             :     // Capture only shape of the mouse cursor, but not position.
      37             :     SHAPE_ONLY,
      38             : 
      39             :     // Capture both, mouse cursor shape and position.
      40             :     SHAPE_AND_POSITION,
      41             :   };
      42             : 
      43             :   // Callback interface used to pass current mouse cursor position and shape.
      44           0 :   class Callback {
      45             :    public:
      46             :     // Called in response to Capture() when the cursor shape has changed. Must
      47             :     // take ownership of |cursor|.
      48             :     virtual void OnMouseCursor(MouseCursor* cursor) = 0;
      49             : 
      50             :     // Called in response to Capture(). |position| indicates cursor position
      51             :     // relative to the |window| specified in the constructor.
      52             :     virtual void OnMouseCursorPosition(CursorState state,
      53             :                                        const DesktopVector& position) = 0;
      54             : 
      55             :    protected:
      56           0 :     virtual ~Callback() {}
      57             :   };
      58             : 
      59           0 :   virtual ~MouseCursorMonitor() {}
      60             : 
      61             :   // Creates a capturer that notifies of mouse cursor events while the cursor is
      62             :   // over the specified window.
      63             :   static MouseCursorMonitor* CreateForWindow(
      64             :       const DesktopCaptureOptions& options,
      65             :       WindowId window);
      66             : 
      67             :   // Creates a capturer that monitors the mouse cursor shape and position across
      68             :   // the entire desktop.
      69             :   //
      70             :   // TODO(sergeyu): Provide a way to select a specific screen.
      71             :   static MouseCursorMonitor* CreateForScreen(
      72             :       const DesktopCaptureOptions& options,
      73             :       ScreenId screen);
      74             : 
      75             :   // Initializes the monitor with the |callback|, which must remain valid until
      76             :   // capturer is destroyed or until Stop()
      77             :   virtual void Start(Callback* callback, Mode mode) = 0;
      78             : 
      79             :   // clears the callback
      80             :   virtual void Stop() = 0;
      81             : 
      82             :   // Captures current cursor shape and position (depending on the |mode| passed
      83             :   // to Init()). Calls Callback::OnMouseCursor() if cursor shape has
      84             :   // changed since the last call (or when Capture() is called for the first
      85             :   // time) and then Callback::OnMouseCursorPosition() if mode is set to
      86             :   // SHAPE_AND_POSITION.
      87             :   virtual void Capture() = 0;
      88             : };
      89             : 
      90             : }  // namespace webrtc
      91             : 
      92             : #endif  // WEBRTC_MODULES_DESKTOP_CAPTURE_MOUSE_CURSOR_MONITOR_H_
      93             : 

Generated by: LCOV version 1.13