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

Side by Side Diff: net/nqe/effective_connection_type.cc

Issue 2228253002: NQE: Remove Broadband from the list of ECT enums (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 4 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 unified diff | Download patch
« no previous file with comments | « net/nqe/effective_connection_type.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/nqe/effective_connection_type.h" 5 #include "net/nqe/effective_connection_type.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 8
9 namespace { 9 namespace {
10 10
11 const char kEffectiveConnectionTypeUnknown[] = "Unknown"; 11 const char kEffectiveConnectionTypeUnknown[] = "Unknown";
12 const char kEffectiveConnectionTypeOffline[] = "Offline"; 12 const char kEffectiveConnectionTypeOffline[] = "Offline";
13 const char kEffectiveConnectionTypeSlow2G[] = "Slow2G"; 13 const char kEffectiveConnectionTypeSlow2G[] = "Slow2G";
14 const char kEffectiveConnectionType2G[] = "2G"; 14 const char kEffectiveConnectionType2G[] = "2G";
15 const char kEffectiveConnectionType3G[] = "3G"; 15 const char kEffectiveConnectionType3G[] = "3G";
16 const char kEffectiveConnectionType4G[] = "4G"; 16 const char kEffectiveConnectionType4G[] = "4G";
17 const char kEffectiveConnectionTypeBroadband[] = "Broadband";
18 17
19 } // namespace 18 } // namespace
20 19
21 namespace net { 20 namespace net {
22 21
23 const char* GetNameForEffectiveConnectionType(EffectiveConnectionType type) { 22 const char* GetNameForEffectiveConnectionType(EffectiveConnectionType type) {
24 switch (type) { 23 switch (type) {
25 case EFFECTIVE_CONNECTION_TYPE_UNKNOWN: 24 case EFFECTIVE_CONNECTION_TYPE_UNKNOWN:
26 return kEffectiveConnectionTypeUnknown; 25 return kEffectiveConnectionTypeUnknown;
27 case EFFECTIVE_CONNECTION_TYPE_OFFLINE: 26 case EFFECTIVE_CONNECTION_TYPE_OFFLINE:
28 return kEffectiveConnectionTypeOffline; 27 return kEffectiveConnectionTypeOffline;
29 case EFFECTIVE_CONNECTION_TYPE_SLOW_2G: 28 case EFFECTIVE_CONNECTION_TYPE_SLOW_2G:
30 return kEffectiveConnectionTypeSlow2G; 29 return kEffectiveConnectionTypeSlow2G;
31 case EFFECTIVE_CONNECTION_TYPE_2G: 30 case EFFECTIVE_CONNECTION_TYPE_2G:
32 return kEffectiveConnectionType2G; 31 return kEffectiveConnectionType2G;
33 case EFFECTIVE_CONNECTION_TYPE_3G: 32 case EFFECTIVE_CONNECTION_TYPE_3G:
34 return kEffectiveConnectionType3G; 33 return kEffectiveConnectionType3G;
35 case EFFECTIVE_CONNECTION_TYPE_4G: 34 case EFFECTIVE_CONNECTION_TYPE_4G:
36 return kEffectiveConnectionType4G; 35 return kEffectiveConnectionType4G;
37 case EFFECTIVE_CONNECTION_TYPE_BROADBAND:
38 return kEffectiveConnectionTypeBroadband;
39 default: 36 default:
40 NOTREACHED(); 37 NOTREACHED();
41 break; 38 break;
42 } 39 }
43 return ""; 40 return "";
44 } 41 }
45 42
46 bool GetEffectiveConnectionTypeForName( 43 bool GetEffectiveConnectionTypeForName(
47 const std::string& connection_type_name, 44 const std::string& connection_type_name,
48 EffectiveConnectionType* effective_connection_type) { 45 EffectiveConnectionType* effective_connection_type) {
(...skipping 14 matching lines...) Expand all
63 return true; 60 return true;
64 } 61 }
65 if (connection_type_name == kEffectiveConnectionType3G) { 62 if (connection_type_name == kEffectiveConnectionType3G) {
66 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_3G; 63 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_3G;
67 return true; 64 return true;
68 } 65 }
69 if (connection_type_name == kEffectiveConnectionType4G) { 66 if (connection_type_name == kEffectiveConnectionType4G) {
70 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_4G; 67 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_4G;
71 return true; 68 return true;
72 } 69 }
73 if (connection_type_name == kEffectiveConnectionTypeBroadband) {
74 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_BROADBAND;
75 return true;
76 }
77 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_UNKNOWN; 70 *effective_connection_type = EFFECTIVE_CONNECTION_TYPE_UNKNOWN;
78 return false; 71 return false;
79 } 72 }
80 73
81 } // namespace net 74 } // namespace net
OLDNEW
« no previous file with comments | « net/nqe/effective_connection_type.h ('k') | net/nqe/network_quality_estimator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698