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

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

Issue 2733023002: [Origin Trials] Support updates of disabled token list (Closed)
Patch Set: Address comments Created 3 years, 9 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/origin_trials_component_installer.cc
diff --git a/chrome/browser/component_updater/origin_trials_component_installer.cc b/chrome/browser/component_updater/origin_trials_component_installer.cc
index 455403d0e72d6226246ce976f611e002f3e41d90..0a651b2c6f4bb9427eb7181ef10b994acfaa9c34 100644
--- a/chrome/browser/component_updater/origin_trials_component_installer.cc
+++ b/chrome/browser/component_updater/origin_trials_component_installer.cc
@@ -20,18 +20,19 @@
// The client-side configuration for the origin trial framework can be
// overridden by an installed component named 'OriginTrials' (extension id
-// kfoklmclfodeliojeaekpoflbkkhojea. This component currently consists of just a
+// llkgjffcdpffmhiakmfcdcblohccpfmo. This component currently consists of just a
// manifest.json file, which can contain a custom key named 'origin-trials'. The
// value of this key is a dictionary:
//
// {
// "public-key": "<base64-encoding of replacement public key>",
// "disabled-features": [<list of features to disable>],
-// "revoked-tokens": "<base64-encoded data>"
+// "disabled-tokens":
+// {
+// "signatures": [<list of token signatures to disable, base64-encoded>]
+// }
// }
//
-// TODO(iclelland): Implement support for revoked tokens.
-//
// If the component is not present in the user data directory, the default
// configuration will be used.
@@ -43,6 +44,8 @@ static const char kManifestOriginTrialsKey[] = "origin-trials";
static const char kManifestPublicKeyPath[] = "origin-trials.public-key";
static const char kManifestDisabledFeaturesPath[] =
"origin-trials.disabled-features";
+static const char kManifestDisabledTokenSignaturesPath[] =
+ "origin-trials.disabled-tokens.signatures";
// Extension id is llkgjffcdpffmhiakmfcdcblohccpfmo
const uint8_t kSha256Hash[] = {0xbb, 0xa6, 0x95, 0x52, 0x3f, 0x55, 0xc7, 0x80,
@@ -101,6 +104,15 @@ void OriginTrialsComponentInstallerTraits::ComponentReady(
} else {
local_state->ClearPref(prefs::kOriginTrialDisabledFeatures);
}
+ base::ListValue* disabled_tokens_list = nullptr;
+ const bool manifest_has_disabled_tokens = manifest->GetList(
+ kManifestDisabledTokenSignaturesPath, &disabled_tokens_list);
+ if (manifest_has_disabled_tokens && !disabled_tokens_list->empty()) {
+ ListPrefUpdate update(local_state, prefs::kOriginTrialDisabledTokens);
+ update->Swap(disabled_tokens_list);
+ } else {
+ local_state->ClearPref(prefs::kOriginTrialDisabledTokens);
+ }
}
base::FilePath OriginTrialsComponentInstallerTraits::GetRelativeInstallDir()

Powered by Google App Engine
This is Rietveld 408576698