Commit 671b4808 authored by Findit's avatar Findit

Revert "Add helper functions to set Connectors prefs"

This reverts commit ee5c7e21.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 763989 as the
culprit for failures in the build cycles as shown on:
https://analysis.chromium.org/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtL2VlNWM3ZTIxZGFjYmE2MjFmZDRiODAwYzk2ZjU0ODVjYWZjODIzN2MM

Sample Failed Build: https://ci.chromium.org/b/8881651091126782208

Sample Failed Step: compile

Original change's description:
> Add helper functions to set Connectors prefs
> 
> These helpers use the legacy policy values but map to connectors. The
> idea is to use these in tests to keep their coverage for the new
> connector policies. This CL just gets the boilerplate out of the way
> and doesn't actually refactor any test.
> 
> Bug: 1076083
> Change-Id: I7f35f2e8550458ade396dd7a4a40b88a9745ecb2
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173341
> Reviewed-by: Roger Tawa <rogerta@chromium.org>
> Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#763989}


Change-Id: I5f697b9bc1a31d829defea0b442e0eaa74b02812
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 1076083
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2173406
Cr-Commit-Position: refs/heads/master@{#764003}
parent ab454541
......@@ -8,6 +8,21 @@
namespace enterprise_connectors {
namespace {
// Keys used to read a connector's policy values.
constexpr char kKeyServiceProvider[] = "service_provider";
constexpr char kKeyEnable[] = "enable";
constexpr char kKeyDisable[] = "disable";
constexpr char kKeyUrlList[] = "url_list";
constexpr char kKeyTags[] = "tags";
constexpr char kKeyBlockUntilVerdict[] = "block_until_verdict";
constexpr char kKeyBlockPasswordProtected[] = "block_password_protected";
constexpr char kKeyBlockLargeFiles[] = "block_large_files";
constexpr char kKeyBlockUnsupportedFileTypes[] = "block_unsupported_file_types";
} // namespace
AnalysisServiceSettings::AnalysisServiceSettings(
const base::Value& settings_value) {
if (!settings_value.is_dict())
......
......@@ -3,7 +3,6 @@
// found in the LICENSE file.
#include "chrome/browser/enterprise/connectors/common.h"
#include "chrome/browser/enterprise/connectors/connectors_prefs.h"
namespace enterprise_connectors {
......@@ -17,17 +16,4 @@ ReportingSettings::ReportingSettings(ReportingSettings&&) = default;
ReportingSettings& ReportingSettings::operator=(ReportingSettings&&) = default;
ReportingSettings::~ReportingSettings() = default;
const char* ConnectorPref(AnalysisConnector connector) {
switch (connector) {
case AnalysisConnector::BULK_DATA_ENTRY:
// TODO(crbug/1067631): Return the corresponding prefs for these analysis
// connectors once they exist.
return nullptr;
case AnalysisConnector::FILE_DOWNLOADED:
return kOnFileDownloadedPref;
case AnalysisConnector::FILE_ATTACHED:
return kOnFileAttachedPref;
}
}
} // namespace enterprise_connectors
......@@ -13,17 +13,6 @@
namespace enterprise_connectors {
// Keys used to read a connector's policy values.
constexpr char kKeyServiceProvider[] = "service_provider";
constexpr char kKeyEnable[] = "enable";
constexpr char kKeyDisable[] = "disable";
constexpr char kKeyUrlList[] = "url_list";
constexpr char kKeyTags[] = "tags";
constexpr char kKeyBlockUntilVerdict[] = "block_until_verdict";
constexpr char kKeyBlockPasswordProtected[] = "block_password_protected";
constexpr char kKeyBlockLargeFiles[] = "block_large_files";
constexpr char kKeyBlockUnsupportedFileTypes[] = "block_unsupported_file_types";
// Enums representing each connector to be used as arguments so the appropriate
// policies/settings can be read.
enum class AnalysisConnector {
......@@ -69,8 +58,6 @@ struct ReportingSettings {
std::vector<GURL> reporting_urls;
};
const char* ConnectorPref(AnalysisConnector connector);
} // namespace enterprise_connectors
#endif // CHROME_BROWSER_ENTERPRISE_CONNECTORS_COMMON_H_
......@@ -53,6 +53,18 @@ bool MatchURLAgainstPatterns(const GURL& url,
return has_scan_match;
}
const char* ConnectorToPref(AnalysisConnector connector) {
switch (connector) {
case AnalysisConnector::BULK_DATA_ENTRY:
case AnalysisConnector::FILE_DOWNLOADED:
// TODO(crbug/1067631): Return the corresponding prefs for these analysis
// connectors once they exist.
return nullptr;
case AnalysisConnector::FILE_ATTACHED:
return kOnFileAttachedPref;
}
}
} // namespace
// ConnectorsManager implementation---------------------------------------------
......@@ -72,7 +84,7 @@ bool ConnectorsManager::IsConnectorEnabled(AnalysisConnector connector) {
if (connector_settings_.count(connector) == 1)
return true;
const char* pref = ConnectorPref(connector);
const char* pref = ConnectorToPref(connector);
return pref && g_browser_process->local_state()->HasPrefPath(pref);
}
......@@ -109,7 +121,7 @@ void ConnectorsManager::GetAnalysisSettingsFromConnectorPolicy(
void ConnectorsManager::CacheConnectorPolicy(AnalysisConnector connector) {
// Connectors with non-existing policies should not reach this code.
const char* pref = ConnectorPref(connector);
const char* pref = ConnectorToPref(connector);
DCHECK(pref);
const base::ListValue* policy_value =
......
......@@ -10,7 +10,6 @@
#include "base/callback.h"
#include "base/optional.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/safe_browsing/core/proto/webprotect.pb.h"
namespace base {
......@@ -106,21 +105,6 @@ class EventReportValidator {
base::RepeatingClosure done_closure_;
};
// Helper functions that set matching connector policies values from legacy
// policy values.
void SetDlpPolicy(CheckContentComplianceValues state);
void SetMalwarePolicy(SendFilesForMalwareCheckValues state);
void SetDelayDeliveryUntilVerdictPolicy(DelayDeliveryUntilVerdictValues state);
void SetAllowPasswordProtectedFilesPolicy(
AllowPasswordProtectedFilesValues state);
void SetBlockUnsupportedFileTypesPolicy(BlockUnsupportedFiletypesValues state);
void SetBlockLargeFileTransferPolicy(BlockLargeFileTransferValues state);
void AddUrlsToCheckComplianceOfDownloads(const std::vector<std::string>& urls);
void AddUrlsToNotCheckComplianceOfUploads(const std::vector<std::string>& urls);
void AddUrlsToCheckForMalwareOfUploads(const std::vector<std::string>& urls);
void AddUrlsToNotCheckForMalwareOfDownloads(
const std::vector<std::string>& urls);
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_CLOUD_CONTENT_SCANNING_DEEP_SCANNING_TEST_UTILS_H_
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