diff --git a/cobalt/h5vcc/h5vcc_settings.cc b/cobalt/h5vcc/h5vcc_settings.cc index 4c47039c28d5..dadba6ec9e64 100644 --- a/cobalt/h5vcc/h5vcc_settings.cc +++ b/cobalt/h5vcc/h5vcc_settings.cc @@ -104,5 +104,24 @@ bool H5vccSettings::Set(const std::string& name, SetValueType value) const { return false; } +std::string H5vccSettings::GetPersistentSetting( + const std::string& name, const std::string& default_setting) const { + const char kQUIC[] = "QUIC"; + + if (persistent_settings_) { + // Accepts the string "true" or "false" as the default setting. + // Returns the string "true" or "false". + if (name.compare(kQUIC) == 0) { + bool value = persistent_settings_->GetPersistentSettingAsBool( + network::kQuicEnabledPersistentSettingsKey, default_setting); + if (value) { + return "true"; + } + return "false"; + } + } + return ""; +} + } // namespace h5vcc } // namespace cobalt diff --git a/cobalt/h5vcc/h5vcc_settings.h b/cobalt/h5vcc/h5vcc_settings.h index f7e10cf56de4..ff44fd012059 100644 --- a/cobalt/h5vcc/h5vcc_settings.h +++ b/cobalt/h5vcc/h5vcc_settings.h @@ -58,6 +58,9 @@ class H5vccSettings : public script::Wrappable { // invalid or not set to the expected value. bool Set(const std::string& name, SetValueType value) const; + std::string GetPersistentSetting(const std::string& name, + const std::string& default_setting) const; + DEFINE_WRAPPABLE_TYPE(H5vccSettings); private: diff --git a/cobalt/h5vcc/h5vcc_settings.idl b/cobalt/h5vcc/h5vcc_settings.idl index 34650a9d1f63..4fa01ef9c06b 100644 --- a/cobalt/h5vcc/h5vcc_settings.idl +++ b/cobalt/h5vcc/h5vcc_settings.idl @@ -14,4 +14,5 @@ interface H5vccSettings { boolean set(DOMString name, (long or DOMString) value); + DOMString getPersistentSetting(DOMString name, DOMString default_setting); };