summaryrefslogtreecommitdiffstats
path: root/chrome/browser/net/http_server_properties_manager.cc
diff options
context:
space:
mode:
authorrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 19:11:39 +0000
committerrch@chromium.org <rch@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-10 19:11:39 +0000
commit04af25f67a8794421c0533927e15e595d11fe9b2 (patch)
treeab31e76ed237cdda8a6a65e9d0a42fa4f9a7867a /chrome/browser/net/http_server_properties_manager.cc
parent9603fa7f011a3a6fddd9df0f02b92aa1bd279024 (diff)
downloadchromium_src-04af25f67a8794421c0533927e15e595d11fe9b2.zip
chromium_src-04af25f67a8794421c0533927e15e595d11fe9b2.tar.gz
chromium_src-04af25f67a8794421c0533927e15e595d11fe9b2.tar.bz2
Persist the alternate protocol as a string not an int to allow the enum to be changed without affecting persisted values.
BUG=121967 TEST=HttpServerPropertiesManagerTest.* Review URL: http://codereview.chromium.org/10006047 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/net/http_server_properties_manager.cc')
-rw-r--r--chrome/browser/net/http_server_properties_manager.cc22
1 files changed, 14 insertions, 8 deletions
diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
index 285082f..9120e8c 100644
--- a/chrome/browser/net/http_server_properties_manager.cc
+++ b/chrome/browser/net/http_server_properties_manager.cc
@@ -335,10 +335,16 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() {
detected_corrupted_prefs = true;
continue;
}
- int protocol = 0;
- if (!port_alternate_protocol_dict->GetIntegerWithoutPathExpansion(
- "protocol", &protocol) || (protocol < 0) ||
- (protocol > net::NUM_ALTERNATE_PROTOCOLS)) {
+ std::string protocol_str;
+ if (!port_alternate_protocol_dict->GetStringWithoutPathExpansion(
+ "protocol_str", &protocol_str)) {
+ DVLOG(1) << "Malformed Alternate-Protocol server: " << server_str;
+ detected_corrupted_prefs = true;
+ continue;
+ }
+ net::AlternateProtocol protocol =
+ net::AlternateProtocolFromString(protocol_str);
+ if (protocol > net::NUM_ALTERNATE_PROTOCOLS) {
DVLOG(1) << "Malformed Alternate-Protocol server: " << server_str;
detected_corrupted_prefs = true;
continue;
@@ -346,8 +352,7 @@ void HttpServerPropertiesManager::UpdateCacheFromPrefsOnUI() {
net::PortAlternateProtocolPair port_alternate_protocol;
port_alternate_protocol.port = port;
- port_alternate_protocol.protocol = static_cast<net::AlternateProtocol>(
- protocol);
+ port_alternate_protocol.protocol = protocol;
(*alternate_protocol_map)[server] = port_alternate_protocol;
} while (false);
@@ -589,8 +594,9 @@ void HttpServerPropertiesManager::UpdatePrefsOnUI(
server_pref.alternate_protocol;
port_alternate_protocol_dict->SetInteger(
"port", port_alternate_protocol->port);
- port_alternate_protocol_dict->SetInteger(
- "protocol", port_alternate_protocol->protocol);
+ const char* protocol_str =
+ net::AlternateProtocolToString(port_alternate_protocol->protocol);
+ port_alternate_protocol_dict->SetString("protocol_str", protocol_str);
server_pref_dict->SetWithoutPathExpansion(
"alternate_protocol", port_alternate_protocol_dict);
}