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

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

Issue 2733023002: [Origin Trials] Support updates of disabled token list (Closed)
Patch Set: Rebase 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 9378dcf407a9f57d51a0ed5fb55f0de104e04d0e..0396ce4df1a67ff276014e274a71a2b13bd2a4db 100644
--- a/chrome/browser/component_updater/origin_trials_component_installer.cc
+++ b/chrome/browser/component_updater/origin_trials_component_installer.cc
@@ -20,7 +20,7 @@
// 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:
//
@@ -30,8 +30,6 @@
// "revoked-tokens": "<base64-encoded data>"
// }
//
-// 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 +41,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 kManifestDisabledTokensPath[] =
+ "origin-trials.disabled-tokens";
// Extension id is llkgjffcdpffmhiakmfcdcblohccpfmo
const uint8_t kSha256Hash[] = {0xbb, 0xa6, 0x95, 0x52, 0x3f, 0x55, 0xc7, 0x80,
@@ -101,6 +101,15 @@ void OriginTrialsComponentInstallerTraits::ComponentReady(
} else {
local_state->ClearPref(prefs::kOriginTrialDisabledFeatures);
}
+ base::ListValue* disabled_tokens_list = nullptr;
+ const bool manifest_has_disabled_tokens =
+ manifest->GetList(kManifestDisabledTokensPath, &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