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

Unified Diff: net/nqe/effective_connection_type.cc

Issue 2720513002: Change the string representation of Slow2G ECT (Closed)
Patch Set: ryansturm comments Created 3 years, 10 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 | « net/nqe/effective_connection_type.h ('k') | net/nqe/effective_connection_type_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/nqe/effective_connection_type.cc
diff --git a/net/nqe/effective_connection_type.cc b/net/nqe/effective_connection_type.cc
index 811c7253bac6057a3edcd6bb09d461a002b9a72e..5fb2a6e34069936b1bf5d4996b9f44f42f6c19c9 100644
--- a/net/nqe/effective_connection_type.cc
+++ b/net/nqe/effective_connection_type.cc
@@ -10,10 +10,11 @@ namespace {
const char kEffectiveConnectionTypeUnknown[] = "Unknown";
const char kEffectiveConnectionTypeOffline[] = "Offline";
-const char kEffectiveConnectionTypeSlow2G[] = "Slow2G";
+const char kEffectiveConnectionTypeSlow2G[] = "Slow-2G";
const char kEffectiveConnectionType2G[] = "2G";
const char kEffectiveConnectionType3G[] = "3G";
const char kEffectiveConnectionType4G[] = "4G";
+const char kDeprectedEffectiveConnectionTypeSlow2G[] = "Slow2G";
} // namespace
@@ -33,10 +34,11 @@ const char* GetNameForEffectiveConnectionType(EffectiveConnectionType type) {
return kEffectiveConnectionType3G;
case EFFECTIVE_CONNECTION_TYPE_4G:
return kEffectiveConnectionType4G;
- default:
+ case EFFECTIVE_CONNECTION_TYPE_LAST:
NOTREACHED();
- break;
+ return "";
}
+ NOTREACHED();
return "";
}
@@ -55,6 +57,12 @@ bool GetEffectiveConnectionTypeForName(
*effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
return true;
}
+ // Return EFFECTIVE_CONNECTION_TYPE_SLOW_2G if the deprecated string
+ // representation is in use.
+ if (connection_type_name == kDeprectedEffectiveConnectionTypeSlow2G) {
+ *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_SLOW_2G;
+ return true;
+ }
if (connection_type_name == kEffectiveConnectionType2G) {
*effective_connection_type = EFFECTIVE_CONNECTION_TYPE_2G;
return true;
@@ -71,4 +79,14 @@ bool GetEffectiveConnectionTypeForName(
return false;
}
+const char* DeprecatedGetNameForEffectiveConnectionType(
+ EffectiveConnectionType type) {
+ switch (type) {
+ case EFFECTIVE_CONNECTION_TYPE_SLOW_2G:
+ return kDeprectedEffectiveConnectionTypeSlow2G;
+ default:
+ return GetNameForEffectiveConnectionType(type);
+ }
+}
+
} // namespace net
« no previous file with comments | « net/nqe/effective_connection_type.h ('k') | net/nqe/effective_connection_type_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698