Commit 3e8937d9 authored by Sergey Poromov's avatar Sergey Poromov Committed by Commit Bot

DLP: Connect video capture restriction to the policy.

The screen recording part of the new screen capture feature
should be connected to the same SCREENSHOT restriction in DLP policy.

Tests: New browsertest
Bug: 1133324
Change-Id: If43440522edde5b1d4cc51400ec7f501c9d63074
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2510330
Commit-Queue: Sergey Poromov <poromov@chromium.org>
Reviewed-by: default avatarNikita Podguzov <nikitapodguzov@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823538}
parent d1fce023
......@@ -4,6 +4,8 @@
#include "chrome/browser/chromeos/policy/dlp/dlp_content_manager.h"
#include <vector>
#include "ash/public/cpp/privacy_screen_dlp_helper.h"
#include "base/bind.h"
#include "base/stl_util.h"
......@@ -176,16 +178,18 @@ DlpContentRestrictionSet DlpContentManager::GetRestrictionSetForURL(
return set;
DlpRulesManager* dlp_rules_manager = DlpRulesManager::Get();
static const base::NoDestructor<
base::flat_map<DlpRulesManager::Restriction, DlpContentRestriction>>
kRestrictionsMap({{DlpRulesManager::Restriction::kScreenshot,
DlpContentRestriction::kScreenshot},
{DlpRulesManager::Restriction::kPrivacyScreen,
DlpContentRestriction::kPrivacyScreen},
{DlpRulesManager::Restriction::kPrinting,
DlpContentRestriction::kPrint}});
for (const auto& restriction : *kRestrictionsMap) {
static const base::NoDestructor<std::vector<
std::pair<DlpRulesManager::Restriction, DlpContentRestriction>>>
kRestrictionsList({{DlpRulesManager::Restriction::kScreenshot,
DlpContentRestriction::kScreenshot},
{DlpRulesManager::Restriction::kScreenshot,
DlpContentRestriction::kVideoCapture},
{DlpRulesManager::Restriction::kPrivacyScreen,
DlpContentRestriction::kPrivacyScreen},
{DlpRulesManager::Restriction::kPrinting,
DlpContentRestriction::kPrint}});
for (const auto& restriction : *kRestrictionsList) {
if (dlp_rules_manager->IsRestricted(url, restriction.first) ==
DlpRulesManager::Level::kBlock) {
set.SetRestriction(restriction.second);
......
......@@ -6,6 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_POLICY_DLP_DLP_CONTENT_MANAGER_H_
#include <memory>
#include <utility>
#include "base/callback.h"
#include "base/containers/flat_map.h"
......
......@@ -282,7 +282,10 @@ IN_PROC_BROWSER_TEST_F(DlpContentManagerPolicyBrowserTest,
nullptr);
UpdateProviderPolicy(policies);
EXPECT_EQ(kScreenshotRestricted,
DlpContentRestrictionSet screenshot_and_videocapture(kScreenshotRestricted);
screenshot_and_videocapture.SetRestriction(
DlpContentRestriction::kVideoCapture);
EXPECT_EQ(screenshot_and_videocapture,
DlpContentManager::Get()->GetRestrictionSetForURL(GURL(kUrl1)));
EXPECT_EQ(kPrivacyScreenEnforced,
DlpContentManager::Get()->GetRestrictionSetForURL(GURL(kUrl2)));
......
......@@ -46,6 +46,7 @@ class DlpRulesManager {
// drag-n-drop.
kScreenshot = 2, // Restricts taking screenshots of confidential screen
// content.
// TODO(crbug/1145100): Update to include video capture
kPrinting = 3, // Restricts printing confidential screen content.
kPrivacyScreen = 4, // Enforces the Eprivacy screen when there's
// confidential content on the screen.
......
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