File: capture_mode_observer.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (58 lines) | stat: -rw-r--r-- 2,339 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ASH_CAPTURE_MODE_CAPTURE_MODE_OBSERVER_H_
#define ASH_CAPTURE_MODE_CAPTURE_MODE_OBSERVER_H_

#include "base/observer_list_types.h"

namespace aura {
class Window;
}  // namespace aura

namespace gfx {
class ImageSkia;
}  // namespace gfx

namespace ash {

// Defines an interface that's used to observe changes in capture mode.
class CaptureModeObserver : public base::CheckedObserver {
 public:
  // Called to notify with the state of a video recording. `current_root` is the
  // root window, which is either being captured itself or a descendant of it.
  // Note that `OnRecordingEnded()` means that the recording stopped (i.e.
  // `is_recording_in_progress()` is now false), but it doesn't mean that a new
  // recording can be started. A recording that were just stopped may take some
  // time for the file to be finalized and saved (see `OnVideoFileFinalized()`
  // below). `can_start_new_recording()` should be checked for these purposes.
  virtual void OnRecordingStarted(aura::Window* current_root) = 0;
  virtual void OnRecordingEnded() = 0;

  // Called when the status of the video is confirmed. DLP can potentially show
  // users a dialog to warn them about restricted contents in the video, and
  // recommending that they delete the file. In this case,
  // `user_deleted_video_file` will be true. `thumbnail` contains an image
  // representation of the video, which can be empty if there were errors during
  // recording.
  // `can_start_new_recording()` is guaranteed to return `true` when this is
  // called.
  virtual void OnVideoFileFinalized(bool user_deleted_video_file,
                                    const gfx::ImageSkia& thumbnail) = 0;

  // Called when the window being recorded is moved from one display to another.
  virtual void OnRecordedWindowChangingRoot(aura::Window* new_root) = 0;

  // Called to notify us that a recording session was aborted (i.e. recording
  // was never started) due to e.g. user cancellation, an error, or a DLP/HDCP
  // restriction.
  virtual void OnRecordingStartAborted() = 0;

 protected:
  ~CaptureModeObserver() override = default;
};

}  // namespace ash

#endif  // ASH_CAPTURE_MODE_CAPTURE_MODE_OBSERVER_H_