mirror of
https://github.com/imputnet/helium.git
synced 2026-08-20 00:57:32 +02:00
patches/hop/setup: drop special handling for recommended extensions
we no longer use/need this since ublock is componentized
This commit is contained in:
@@ -217,90 +217,3 @@
|
||||
<message name="IDS_POLICY_SOURCE_ACTIVE_DIRECTORY" desc="Indicates that the policy originates from a local server, e.g. Samba or Active Directory.">
|
||||
<ph name="MICROSOFT_ACTIVE_DIRECTORY">Local Server</ph>
|
||||
</message>
|
||||
--- a/chrome/browser/extensions/extension_management.cc
|
||||
+++ b/chrome/browser/extensions/extension_management.cc
|
||||
@@ -640,7 +640,7 @@ void ExtensionManagement::Refresh() {
|
||||
const base::Value::List* denied_list_pref =
|
||||
LoadListPreference(pref_names::kInstallDenyList, false);
|
||||
const base::Value::Dict* forced_list_pref =
|
||||
- LoadDictPreference(pref_names::kInstallForceList, true);
|
||||
+ LoadDictPreference(pref_names::kInstallForceList, false);
|
||||
const base::Value::List* install_sources_pref =
|
||||
LoadListPreference(pref_names::kAllowedInstallSites, true);
|
||||
const base::Value::List* allowed_types_pref =
|
||||
@@ -657,6 +657,8 @@ void ExtensionManagement::Refresh() {
|
||||
LoadPreference(pref_names::kExtensionUnpublishedAvailability,
|
||||
/*force_managed=*/true, base::Value::Type::INTEGER);
|
||||
|
||||
+ bool forcelist_is_forced = IsPreferenceManaged(pref_names::kInstallForceList);
|
||||
+
|
||||
// Reset all settings.
|
||||
global_settings_ = std::make_unique<internal::GlobalSettings>();
|
||||
settings_by_id_.clear();
|
||||
@@ -707,7 +709,7 @@ void ExtensionManagement::Refresh() {
|
||||
}
|
||||
}
|
||||
|
||||
- UpdateForcedExtensions(forced_list_pref);
|
||||
+ UpdateForcedExtensions(forced_list_pref, forcelist_is_forced);
|
||||
|
||||
if (install_sources_pref) {
|
||||
global_settings_->install_sources = URLPatternSet();
|
||||
@@ -902,6 +904,16 @@ void ExtensionManagement::LoadDeferredEx
|
||||
DCHECK(found) << "Couldn't find dictionary for extension in deferred_ids_.";
|
||||
}
|
||||
|
||||
+bool ExtensionManagement::IsPreferenceManaged(const char* pref_name) const {
|
||||
+ if (!pref_service_)
|
||||
+ return false;
|
||||
+
|
||||
+ const PrefService::Preference* pref =
|
||||
+ pref_service_->FindPreference(pref_name);
|
||||
+
|
||||
+ return pref && pref->IsManaged();
|
||||
+}
|
||||
+
|
||||
const base::Value* ExtensionManagement::LoadPreference(
|
||||
const char* pref_name,
|
||||
bool force_managed,
|
||||
@@ -983,7 +995,7 @@ base::Value::Dict ExtensionManagement::G
|
||||
}
|
||||
|
||||
void ExtensionManagement::UpdateForcedExtensions(
|
||||
- const base::Value::Dict* extension_dict) {
|
||||
+ const base::Value::Dict* extension_dict, bool is_forced) {
|
||||
if (!extension_dict)
|
||||
return;
|
||||
|
||||
@@ -1009,7 +1021,7 @@ void ExtensionManagement::UpdateForcedEx
|
||||
continue;
|
||||
}
|
||||
internal::IndividualSettings* by_id = AccessById(it.first);
|
||||
- by_id->installation_mode = ManagedInstallationMode::kForced;
|
||||
+ by_id->installation_mode = is_forced ? ManagedInstallationMode::kForced : ManagedInstallationMode::kRecommended;
|
||||
by_id->update_url = *update_url;
|
||||
install_stage_tracker->ReportInstallationStage(
|
||||
it.first, InstallStageTracker::Stage::CREATED);
|
||||
--- a/chrome/browser/extensions/extension_management.h
|
||||
+++ b/chrome/browser/extensions/extension_management.h
|
||||
@@ -263,6 +263,9 @@ class ExtensionManagement : public Keyed
|
||||
// Loads the deferred settings information for `extension_id`.
|
||||
void LoadDeferredExtensionSetting(const std::string& extension_id);
|
||||
|
||||
+ // Checks whether a preference is managed.
|
||||
+ bool IsPreferenceManaged(const char* pref_name) const;
|
||||
+
|
||||
// Loads preference with name `pref_name` and expected type `expected_type`.
|
||||
// If `force_managed` is true, only loading from the managed preference store
|
||||
// is allowed. Returns NULL if the preference is not present, not allowed to
|
||||
@@ -298,7 +301,9 @@ class ExtensionManagement : public Keyed
|
||||
ManagedInstallationMode installation_mode) const;
|
||||
|
||||
// Helper to update `extension_dict` for forced installs.
|
||||
- void UpdateForcedExtensions(const base::Value::Dict* extension_dict);
|
||||
+ void UpdateForcedExtensions(
|
||||
+ const base::Value::Dict* extension_dict,
|
||||
+ bool is_forced);
|
||||
|
||||
// Helper function to access `settings_by_id_` with `id` as key.
|
||||
// Adds a new IndividualSettings entry to `settings_by_id_` if none exists for
|
||||
|
||||
Reference in New Issue
Block a user