diff --git a/cobalt/h5vcc/h5vcc_settings.cc b/cobalt/h5vcc/h5vcc_settings.cc index 69aabbf248ac..4c47039c28d5 100644 --- a/cobalt/h5vcc/h5vcc_settings.cc +++ b/cobalt/h5vcc/h5vcc_settings.cc @@ -50,7 +50,6 @@ bool H5vccSettings::Set(const std::string& name, SetValueType value) const { const char kMediaPrefix[] = "Media."; const char kMediaCodecBlockList[] = "MediaCodecBlockList"; const char kNavigatorUAData[] = "NavigatorUAData"; - const char kClientHintHeaders[] = "ClientHintHeaders"; const char kQUIC[] = "QUIC"; #if SB_IS(EVERGREEN) @@ -81,22 +80,6 @@ bool H5vccSettings::Set(const std::string& name, SetValueType value) const { return true; } - if (name.compare(kClientHintHeaders) == 0 && value.IsType()) { - if (!persistent_settings_) { - return false; - } else { - persistent_settings_->SetPersistentSetting( - network::kClientHintHeadersEnabledPersistentSettingsKey, - std::make_unique(value.AsType())); - // Tell NetworkModule (if exists) to re-query persistent settings. - if (network_module_) { - network_module_ - ->SetEnableClientHintHeadersFlagsFromPersistentSettings(); - } - return true; - } - } - if (name.compare(kQUIC) == 0 && value.IsType()) { if (!persistent_settings_) { return false; diff --git a/cobalt/network/network_module.cc b/cobalt/network/network_module.cc index 44cce0d66409..0c8f67e6b911 100644 --- a/cobalt/network/network_module.cc +++ b/cobalt/network/network_module.cc @@ -113,18 +113,6 @@ void NetworkModule::SetEnableQuicFromPersistentSettings() { } } -void NetworkModule::SetEnableClientHintHeadersFlagsFromPersistentSettings() { - // Called on initialization and when the persistent setting is changed. - // If persistent setting is not set, will default to - // kCallTypeLoader | kCallTypeXHR. - if (options_.persistent_settings != nullptr) { - enable_client_hint_headers_flags_.store( - options_.persistent_settings->GetPersistentSettingAsInt( - kClientHintHeadersEnabledPersistentSettingsKey, - (kCallTypeLoader | kCallTypeXHR))); - } -} - void NetworkModule::EnsureStorageManagerStarted() { DCHECK(storage_manager_); storage_manager_->EnsureStarted(); @@ -143,8 +131,6 @@ void NetworkModule::Initialize(const std::string& user_agent_string, http_user_agent_settings_.reset(new net::StaticHttpUserAgentSettings( options_.preferred_language, user_agent_string)); - SetEnableClientHintHeadersFlagsFromPersistentSettings(); - #if defined(ENABLE_DEBUG_COMMAND_LINE_SWITCHES) base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); @@ -244,7 +230,7 @@ void NetworkModule::OnCreate(base::WaitableEvent* creation_event) { void NetworkModule::AddClientHintHeaders( net::URLFetcher& url_fetcher, ClientHintHeadersCallType call_type) const { - if (enable_client_hint_headers_flags_.load() & call_type) { + if (kEnabledClientHintHeaders & call_type) { for (const auto& header : client_hint_headers_) { url_fetcher.AddExtraRequestHeader(header); } diff --git a/cobalt/network/network_module.h b/cobalt/network/network_module.h index 27e637a1852a..18ea05c0f6df 100644 --- a/cobalt/network/network_module.h +++ b/cobalt/network/network_module.h @@ -49,7 +49,7 @@ namespace cobalt { namespace network { // Used to differentiate type of network call for Client Hint Headers. -// Values correspond to bit masks against |enable_client_hint_headers_flags_|. +// Values correspond to bit masks against |kEnabledClientHintHeaders|. enum ClientHintHeadersCallType : int32_t { kCallTypeLoader = (1u << 0), kCallTypeMedia = (1u << 1), @@ -59,11 +59,10 @@ enum ClientHintHeadersCallType : int32_t { kCallTypeXHR = (1u << 5), }; -const char kQuicEnabledPersistentSettingsKey[] = "QUICEnabled"; +// Determines which type of network calls should include Client Hint Headers. +constexpr int32_t kEnabledClientHintHeaders = (kCallTypeLoader | kCallTypeXHR); -// Holds bit mask flag, read into |enable_client_hint_headers_flags_|. -const char kClientHintHeadersEnabledPersistentSettingsKey[] = - "clientHintHeadersEnabled"; +const char kQuicEnabledPersistentSettingsKey[] = "QUICEnabled"; class NetworkSystem; // NetworkModule wraps various networking-related components such as @@ -132,9 +131,6 @@ class NetworkModule : public base::MessageLoop::DestructionObserver { void SetEnableQuicFromPersistentSettings(); - // Checks persistent settings to determine if Client Hint Headers are enabled. - void SetEnableClientHintHeadersFlagsFromPersistentSettings(); - // Adds the Client Hint Headers to the provided URLFetcher if enabled. void AddClientHintHeaders(net::URLFetcher& url_fetcher, ClientHintHeadersCallType call_type) const; @@ -154,7 +150,6 @@ class NetworkModule : public base::MessageLoop::DestructionObserver { std::unique_ptr CreateNetPoster(); std::vector client_hint_headers_; - starboard::atomic_int32_t enable_client_hint_headers_flags_; std::unique_ptr storage_manager_; std::unique_ptr thread_; std::unique_ptr url_request_context_;