Commit 31936285 authored by Owen Min's avatar Owen Min Committed by Commit Bot

Check extension request policy when generate profile report

set_extension_request_enabled is not used by any ProfileReportGenerator
caller. Let the ProfileReportGenerator read the policy value for each
profile.

Bug: 1006899
Change-Id: I968656200a214e80e9a1f0502b0e63dddf98c916
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024696Reviewed-by: default avatarJulian Pastarmov <pastarmovj@chromium.org>
Commit-Queue: Owen Min <zmin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736390}
parent 0d3451f3
...@@ -35,10 +35,6 @@ void ProfileReportGenerator::set_policies_enabled(bool enabled) { ...@@ -35,10 +35,6 @@ void ProfileReportGenerator::set_policies_enabled(bool enabled) {
policies_enabled_ = enabled; policies_enabled_ = enabled;
} }
void ProfileReportGenerator::set_extension_request_enabled(bool enabled) {
extension_request_enabled_ = enabled;
}
std::unique_ptr<em::ChromeUserProfileInfo> std::unique_ptr<em::ChromeUserProfileInfo>
ProfileReportGenerator::MaybeGenerate(const base::FilePath& path, ProfileReportGenerator::MaybeGenerate(const base::FilePath& path,
const std::string& name) { const std::string& name) {
...@@ -101,7 +97,7 @@ void ProfileReportGenerator::GetPolicyFetchTimestampInfo() { ...@@ -101,7 +97,7 @@ void ProfileReportGenerator::GetPolicyFetchTimestampInfo() {
} }
void ProfileReportGenerator::GetExtensionRequest() { void ProfileReportGenerator::GetExtensionRequest() {
if (!extension_request_enabled_) if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudExtensionRequestEnabled))
return; return;
const base::DictionaryValue* pending_requests = const base::DictionaryValue* pending_requests =
profile_->GetPrefs()->GetDictionary(prefs::kCloudExtensionRequestIds); profile_->GetPrefs()->GetDictionary(prefs::kCloudExtensionRequestIds);
......
...@@ -33,7 +33,6 @@ class ProfileReportGenerator { ...@@ -33,7 +33,6 @@ class ProfileReportGenerator {
void set_extensions_enabled(bool enabled); void set_extensions_enabled(bool enabled);
void set_policies_enabled(bool enabled); void set_policies_enabled(bool enabled);
void set_extension_request_enabled(bool enabled);
// Generates report for Profile if it's activated. Returns the report with // Generates report for Profile if it's activated. Returns the report with
// |callback| once it's ready. The report is null if it can't be generated. // |callback| once it's ready. The report is null if it can't be generated.
...@@ -57,7 +56,6 @@ class ProfileReportGenerator { ...@@ -57,7 +56,6 @@ class ProfileReportGenerator {
bool extensions_enabled_ = true; bool extensions_enabled_ = true;
bool policies_enabled_ = true; bool policies_enabled_ = true;
bool extension_request_enabled_ = false;
std::unique_ptr<em::ChromeUserProfileInfo> report_ = nullptr; std::unique_ptr<em::ChromeUserProfileInfo> report_ = nullptr;
......
...@@ -162,7 +162,9 @@ TEST_F(ProfileReportGeneratorTest, PoliciesDisabled) { ...@@ -162,7 +162,9 @@ TEST_F(ProfileReportGeneratorTest, PoliciesDisabled) {
} }
TEST_F(ProfileReportGeneratorTest, PendingRequest) { TEST_F(ProfileReportGeneratorTest, PendingRequest) {
generator_.set_extension_request_enabled(true); profile()->GetTestingPrefService()->SetManagedPref(
prefs::kCloudExtensionRequestEnabled,
std::make_unique<base::Value>(true));
std::vector<std::string> ids = {kExtensionId}; std::vector<std::string> ids = {kExtensionId};
SetExtensionToPendingList(ids); SetExtensionToPendingList(ids);
...@@ -173,7 +175,9 @@ TEST_F(ProfileReportGeneratorTest, PendingRequest) { ...@@ -173,7 +175,9 @@ TEST_F(ProfileReportGeneratorTest, PendingRequest) {
} }
TEST_F(ProfileReportGeneratorTest, NoPendingRequestWhenItsDisabled) { TEST_F(ProfileReportGeneratorTest, NoPendingRequestWhenItsDisabled) {
generator_.set_extension_request_enabled(false); profile()->GetTestingPrefService()->SetManagedPref(
prefs::kCloudExtensionRequestEnabled,
std::make_unique<base::Value>(false));
std::vector<std::string> ids = {kExtensionId}; std::vector<std::string> ids = {kExtensionId};
SetExtensionToPendingList(ids); SetExtensionToPendingList(ids);
......
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