Commit 786801e5 authored by Lambros Lambrou's avatar Lambros Lambrou Committed by Commit Bot

Rename the key used to mark host config as upgraded.

This gives the marker a more specific name, to reflect what is updated.
This allows for any future config updates (for example, if we need to
update the token to include more new scopes).

Bug: 954427
Change-Id: I12554301096bd80a82f8eae0bc8567c2d11ae83a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629702
Commit-Queue: Jamie Walch <jamiewalch@chromium.org>
Reviewed-by: default avatarJamie Walch <jamiewalch@chromium.org>
Auto-Submit: Lambros Lambrou <lambroslambrou@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664083}
parent 5f7fba25
...@@ -26,7 +26,7 @@ const char kUsageStatsConsentConfigPath[] = "usage_stats_consent"; ...@@ -26,7 +26,7 @@ const char kUsageStatsConsentConfigPath[] = "usage_stats_consent";
const char kEnableVp9ConfigPath[] = "enable_vp9"; const char kEnableVp9ConfigPath[] = "enable_vp9";
const char kEnableH264ConfigPath[] = "enable_h264"; const char kEnableH264ConfigPath[] = "enable_h264";
const char kFrameRecorderBufferKbConfigPath[] = "frame-recorder-buffer-kb"; const char kFrameRecorderBufferKbConfigPath[] = "frame-recorder-buffer-kb";
const char kTokenUpgradedConfigPath[] = "token_upgraded"; const char kIsFtlTokenConfigPath[] = "is_ftl_token";
std::unique_ptr<base::DictionaryValue> HostConfigFromJson( std::unique_ptr<base::DictionaryValue> HostConfigFromJson(
const std::string& json) { const std::string& json) {
......
...@@ -47,10 +47,10 @@ extern const char kEnableH264ConfigPath[]; ...@@ -47,10 +47,10 @@ extern const char kEnableH264ConfigPath[];
extern const char kFrameRecorderBufferKbConfigPath[]; extern const char kFrameRecorderBufferKbConfigPath[];
// The GCD device ID of this host (if registered with GCD). // The GCD device ID of this host (if registered with GCD).
extern const char kGcdDeviceIdConfigPath[]; extern const char kGcdDeviceIdConfigPath[];
// Key which marks the config as already-upgraded. If present, the // Key which marks the config's token as up-to-date for FTL. If present, the
// token-exchange will be skipped, which avoids querying over the network for // token-exchange will be skipped, which avoids querying over the network for
// the current token's scopes. // the current token's scopes.
extern const char kTokenUpgradedConfigPath[]; extern const char kIsFtlTokenConfigPath[];
// Helpers for serializing/deserializing Host configuration dictonaries. // Helpers for serializing/deserializing Host configuration dictonaries.
std::unique_ptr<base::DictionaryValue> HostConfigFromJson( std::unique_ptr<base::DictionaryValue> HostConfigFromJson(
......
...@@ -95,7 +95,7 @@ int HostConfigUpgrader::DoUpgrade() { ...@@ -95,7 +95,7 @@ int HostConfigUpgrader::DoUpgrade() {
refresh_token_ = *refresh_token; refresh_token_ = *refresh_token;
if (config_->FindKey(kTokenUpgradedConfigPath)) { if (config_->FindKey(kIsFtlTokenConfigPath)) {
HOST_LOG << "Host config is already upgraded."; HOST_LOG << "Host config is already upgraded.";
return 0; return 0;
} }
...@@ -141,7 +141,7 @@ void HostConfigUpgrader::OnTokenExchanged(OfflineTokenExchanger::Status status, ...@@ -141,7 +141,7 @@ void HostConfigUpgrader::OnTokenExchanged(OfflineTokenExchanger::Status status,
// Mark config as upgraded and write to disk (whether or not the token was // Mark config as upgraded and write to disk (whether or not the token was
// actually exchanged). The value is not important, only the presence of the // actually exchanged). The value is not important, only the presence of the
// key is used. // key is used.
config_->SetIntKey(kTokenUpgradedConfigPath, 1); config_->SetIntKey(kIsFtlTokenConfigPath, 1);
if (status == OfflineTokenExchanger::NO_EXCHANGE) { if (status == OfflineTokenExchanger::NO_EXCHANGE) {
HOST_LOG << "No exchange needed, writing new config to mark as upgraded."; HOST_LOG << "No exchange needed, writing new config to mark as upgraded.";
......
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