Commit f9cef2f6 authored by Ahmed Fakhry's avatar Ahmed Fakhry Committed by Chromium LUCI CQ

capture_mode: Update the strings of the HDCP messages

BUG=1157997
TEST=Manual

Change-Id: I1079920b3d3530f6ba263f7d2b8b2a92fd39e59c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2631286Reviewed-by: default avatarSammie Quon <sammiequon@chromium.org>
Commit-Queue: Ahmed Fakhry <afakhry@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843904}
parent e607fe75
......@@ -3171,7 +3171,7 @@ Here are some things you can try to get started.
<!-- Capture Mode -->
<message name="IDS_ASH_SCREEN_CAPTURE_HDCP_BLOCKED_MESSAGE" desc="The text of the notification that informs the user the screen recording is blocked due to existence of protected content.">
Screen capture is not allowed while protected content is present
Screen recording is not allowed when protected content is visible
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_DLP_DISABLED_TITLE" desc="The title of the notification when capture mode is disabled because of confidential content.">
Can't capture confidential content
......@@ -3182,8 +3182,8 @@ Here are some things you can try to get started.
<message name="IDS_ASH_SCREEN_CAPTURE_FAILURE_TITLE" desc="The title of the notification when capture mode fails.">
An error occurred
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_STOPPED_TITLE" desc="The title of the notification when video capture is stopped.">
Screen recording stopped
<message name="IDS_ASH_SCREEN_CAPTURE_HDCP_STOPPED_TITLE" desc="The title of the notification when video capture is stopped due to protected content showing up on the screen.">
Can't record protected content
</message>
<message name="IDS_ASH_SCREEN_CAPTURE_DLP_STOPPED_TITLE" desc="The title of the notification when video capture is stopped because of confidential content.">
Can't record confidential content
......
fe2d0b79ce066bd00acca7ec224ca239cfa1e8a9
\ No newline at end of file
968dda018c6720fc0c764f6048f845e2832a97ce
\ No newline at end of file
968dda018c6720fc0c764f6048f845e2832a97ce
\ No newline at end of file
......@@ -198,13 +198,49 @@ void ShowFailureNotification() {
/*optional_fields=*/{}, /*delegate=*/nullptr);
}
// Returns the ID of the message or the title for the notification based on
// |allowance| and |for_title|.
int GetDisabledNotificationMessageId(CaptureAllowance allowance,
bool for_title) {
switch (allowance) {
case CaptureAllowance::kDisallowedByPolicy:
return for_title ? IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_TITLE
: IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_MESSAGE;
case CaptureAllowance::kDisallowedByDlp:
return for_title ? IDS_ASH_SCREEN_CAPTURE_DLP_DISABLED_TITLE
: IDS_ASH_SCREEN_CAPTURE_DLP_DISABLED_MESSAGE;
case CaptureAllowance::kDisallowedByHdcp:
return for_title ? IDS_ASH_SCREEN_CAPTURE_HDCP_STOPPED_TITLE
: IDS_ASH_SCREEN_CAPTURE_HDCP_BLOCKED_MESSAGE;
case CaptureAllowance::kAllowed:
NOTREACHED();
return IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_MESSAGE;
}
}
// Shows a notification informing the user that Capture Mode operations are
// currently disabled. |allowance| identifies the reason why the operation is
// currently disabled.
void ShowDisabledNotification(CaptureAllowance allowance) {
DCHECK(allowance != CaptureAllowance::kAllowed);
ShowNotification(
kScreenCaptureNotificationId,
GetDisabledNotificationMessageId(allowance, /*for_title=*/true),
GetDisabledNotificationMessageId(allowance, /*for_title=*/false),
/*optional_fields=*/{}, /*delegate=*/nullptr,
message_center::SystemNotificationWarningLevel::CRITICAL_WARNING,
allowance == CaptureAllowance::kDisallowedByHdcp
? kCaptureModeIcon
: vector_icons::kBusinessIcon);
}
// Shows a notification informing the user that video recording was stopped. If
// |for_hdcp| is true, then this was due to a content-enforced protection,
// otherwise it was due to DLP which is admin enforced.
void ShowVideoRecordingStoppedNotification(bool for_hdcp) {
ShowNotification(
kScreenCaptureStoppedNotificationId,
for_hdcp ? IDS_ASH_SCREEN_CAPTURE_STOPPED_TITLE
for_hdcp ? IDS_ASH_SCREEN_CAPTURE_HDCP_STOPPED_TITLE
: IDS_ASH_SCREEN_CAPTURE_DLP_STOPPED_TITLE,
for_hdcp ? IDS_ASH_SCREEN_CAPTURE_HDCP_BLOCKED_MESSAGE
: IDS_ASH_SCREEN_CAPTURE_DLP_STOPPED_MESSAGE,
......@@ -687,8 +723,7 @@ void CaptureModeController::OnRecordingServiceDisconnected() {
OnRecordingEnded(/*success=*/false);
}
CaptureModeController::CaptureAllowance
CaptureModeController::IsCaptureAllowedByEnterprisePolicies(
CaptureAllowance CaptureModeController::IsCaptureAllowedByEnterprisePolicies(
const CaptureParams& capture_params) const {
if (!delegate_->IsCaptureAllowedByPolicy()) {
return CaptureAllowance::kDisallowedByPolicy;
......@@ -900,40 +935,6 @@ void CaptureModeController::HandleNotificationClicked(
kScreenCaptureNotificationId, /*by_user=*/false);
}
/* static */
int CaptureModeController::GetDisabledNotificationMessageId(
CaptureModeController::CaptureAllowance allowance) {
switch (allowance) {
case CaptureAllowance::kDisallowedByPolicy:
return IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_MESSAGE;
case CaptureAllowance::kDisallowedByDlp:
return IDS_ASH_SCREEN_CAPTURE_DLP_DISABLED_MESSAGE;
case CaptureAllowance::kDisallowedByHdcp:
return IDS_ASH_SCREEN_CAPTURE_HDCP_BLOCKED_MESSAGE;
case CaptureAllowance::kAllowed:
NOTREACHED();
return IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_MESSAGE;
}
}
/* static */
void CaptureModeController::ShowDisabledNotification(
CaptureModeController::CaptureAllowance allowance) {
DCHECK(allowance != CaptureAllowance::kAllowed);
int message_id = GetDisabledNotificationMessageId(allowance);
ShowNotification(
kScreenCaptureNotificationId,
allowance == CaptureAllowance::kDisallowedByDlp
? IDS_ASH_SCREEN_CAPTURE_DLP_DISABLED_TITLE
: IDS_ASH_SCREEN_CAPTURE_POLICY_DISABLED_TITLE,
message_id,
/*optional_fields=*/{}, /*delegate=*/nullptr,
message_center::SystemNotificationWarningLevel::CRITICAL_WARNING,
allowance == CaptureAllowance::kDisallowedByHdcp
? kCaptureModeIcon
: vector_icons::kBusinessIcon);
}
base::FilePath CaptureModeController::BuildImagePath() const {
return BuildPathNoExtension(kScreenshotFileNameFmtStr, base::Time::Now())
.AddExtension("png");
......
......@@ -169,12 +169,6 @@ class ASH_EXPORT CaptureModeController
// Returns whether doing a screen capture is currently allowed by enterprise
// policies and a reason otherwise.
// ShouldBlockRecordingForContentProtection() should be used for HDCP checks.
enum class CaptureAllowance {
kAllowed,
kDisallowedByDlp,
kDisallowedByPolicy,
kDisallowedByHdcp
};
CaptureAllowance IsCaptureAllowedByEnterprisePolicies(
const CaptureParams& capture_params) const;
......@@ -225,15 +219,6 @@ class ASH_EXPORT CaptureModeController
const CaptureModeType type,
base::Optional<int> button_index);
// Returns the message for the notification based on |allowance|.
static int GetDisabledNotificationMessageId(
CaptureModeController::CaptureAllowance allowance);
// Shows a notification informing the user that Capture Mode operations are
// currently disabled. |allowance| identifies the reason why the operation is
// currently disabled.
static void ShowDisabledNotification(
CaptureModeController::CaptureAllowance allowance);
// Builds a path for a file of an image screenshot, or a video screen
// recording, builds with display index if there are
// multiple displays.
......
......@@ -20,6 +20,19 @@ enum class CaptureModeSource {
kWindow,
};
// Specifies the capture mode allowance types.
enum class CaptureAllowance {
// Capture mode is allowed.
kAllowed,
// Capture mode is blocked due to admin-enforced Data Leak Prevention policy.
kDisallowedByDlp,
// Capture mode is blocked due to admin-enforced device policy.
kDisallowedByPolicy,
// Video recording is blocked due to app- or content- enforced content
// protection. Applies only to video recording.
kDisallowedByHdcp
};
// The position of the press event during the fine tune phase of a region
// capture session. This will determine what subsequent drag events do to the
// select region.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment