-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
capture_mode_delegate.h
95 lines (73 loc) · 3.41 KB
/
capture_mode_delegate.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ASH_PUBLIC_CPP_CAPTURE_MODE_DELEGATE_H_
#define ASH_PUBLIC_CPP_CAPTURE_MODE_DELEGATE_H_
#include "ash/public/cpp/ash_public_export.h"
#include "ash/services/recording/public/mojom/recording_service.mojom-forward.h"
#include "base/callback.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace aura {
class Window;
} // namespace aura
namespace base {
class FilePath;
} // namespace base
namespace gfx {
class Rect;
} // namespace gfx
namespace media {
namespace mojom {
class AudioStreamFactory;
} // namespace mojom
} // namespace media
namespace ash {
// Defines the interface for the delegate of CaptureModeController, that can be
// implemented by an ash client (e.g. Chrome). The CaptureModeController owns
// the instance of this delegate.
class ASH_PUBLIC_EXPORT CaptureModeDelegate {
public:
virtual ~CaptureModeDelegate() = default;
// Returns the path to the active user's downloads directory. This will never
// be called if the user is not logged in.
virtual base::FilePath GetActiveUserDownloadsDir() const = 0;
// Shows the screenshot or screen recording item in the screen capture folder.
virtual void ShowScreenCaptureItemInFolder(
const base::FilePath& file_path) = 0;
// Opens the screenshot item in an image editor.
virtual void OpenScreenshotInImageEditor(const base::FilePath& file_path) = 0;
// Returns true if the current user is using the 24-hour format (i.e. 14:00
// vs. 2:00 PM). This is used to build the file name of the captured image or
// video.
virtual bool Uses24HourFormat() const = 0;
// Returns whether initiation of capture mode is restricted because of Data
// Leak Prevention applied to the currently visible content.
virtual bool IsCaptureModeInitRestrictedByDlp() const = 0;
// Returns whether capture of the region defined by |window| and |bounds|
// is currently allowed by Data Leak Prevention feature.
virtual bool IsCaptureAllowedByDlp(const aura::Window* window,
const gfx::Rect& bounds,
bool for_video) const = 0;
// Returns whether screen capture is allowed by an enterprise policy.
virtual bool IsCaptureAllowedByPolicy() const = 0;
// Called when a video capture for |window| and |bounds| area is started, so
// that Data Leak Prevention can start observing the area.
// |on_area_restricted_callback| will be called when the area becomes
// restricted so that the capture should be interrupted.
virtual void StartObservingRestrictedContent(
const aura::Window* window,
const gfx::Rect& bounds,
base::OnceClosure on_area_restricted_callback) = 0;
// Called when the running video capture is stopped.
virtual void StopObservingRestrictedContent() = 0;
// Launches the Recording Service into a separate utility process.
virtual mojo::Remote<recording::mojom::RecordingService>
LaunchRecordingService() = 0;
// Binds the given AudioStreamFactory |receiver| to the audio service.
virtual void BindAudioStreamFactory(
mojo::PendingReceiver<media::mojom::AudioStreamFactory> receiver) = 0;
// Called when a capture mode session starts or stops.
virtual void OnSessionStateChanged(bool started) = 0;
};
} // namespace ash
#endif // ASH_PUBLIC_CPP_CAPTURE_MODE_DELEGATE_H_