Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4230)

Unified Diff: chrome/browser/component_updater/subresource_filter_component_installer.cc

Issue 2665473002: Add support for custom subresource filter InstallerAttributes. (Closed)
Patch Set: address comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/component_updater/subresource_filter_component_installer.cc
diff --git a/chrome/browser/component_updater/subresource_filter_component_installer.cc b/chrome/browser/component_updater/subresource_filter_component_installer.cc
index 861819b85631c61dcf4cde9b1cf6a09eca37e24e..f3de4f0f3ca5d99c8f350c2199b2645ae882d8c7 100644
--- a/chrome/browser/component_updater/subresource_filter_component_installer.cc
+++ b/chrome/browser/component_updater/subresource_filter_component_installer.cc
@@ -115,9 +115,30 @@ std::string SubresourceFilterComponentInstallerTraits::GetName() const {
return kSubresourceFilterSetFetcherManifestName;
}
+// static
+std::string SubresourceFilterComponentInstallerTraits::GetInstallerTag() {
+ std::string ruleset_flavor = subresource_filter::GetRulesetFlavor();
+ if (ruleset_flavor.empty())
+ return ruleset_flavor;
+
+ // We allow 4 ruleset flavor identifiers: a, b, c, d
+ if (ruleset_flavor.size() == 1 && ruleset_flavor.at(0) >= 'a' &&
+ ruleset_flavor.at(0) <= 'd')
+ return ruleset_flavor;
+
+ // Return 'invalid' for any cases where we encounter an invalid installer
+ // tag. This allows us to verify that no clients are encountering invalid
+ // installer tags in the field.
+ return "invalid";
+}
+
update_client::InstallerAttributes
SubresourceFilterComponentInstallerTraits::GetInstallerAttributes() const {
- return update_client::InstallerAttributes();
+ update_client::InstallerAttributes attributes;
+ std::string installer_tag = GetInstallerTag();
+ if (!installer_tag.empty())
+ attributes["tag"] = installer_tag;
+ return attributes;
}
std::vector<std::string>

Powered by Google App Engine
This is Rietveld 408576698