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

Unified Diff: chrome/browser/net/http_server_properties_manager.cc

Issue 10006047: Persist the alternate protocol as a string not an int to allow the enum to be changed without affec… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add NET_EXPORT to new public functions Created 8 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/net/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/http_server_properties_manager.cc
diff --git a/chrome/browser/net/http_server_properties_manager.cc b/chrome/browser/net/http_server_properties_manager.cc
index 285082f746aee2c33c24f14d1a3583426f71177a..9120e8ca4d98b1b23918ab64f7ff7cf045e96bf2 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);
}
« no previous file with comments | « no previous file | chrome/browser/net/http_server_properties_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698