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

Side by Side Diff: net/nqe/network_id.h

Issue 2481373004: NQE: Add default RTT and throughput observations (Closed)
Patch Set: Addressed ryansturm comments Created 4 years 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 | « no previous file | net/nqe/network_quality_estimator.h » ('j') | net/nqe/network_quality_estimator.h » ('J')
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 #ifndef NET_NQE_NETWORK_ID_H_ 5 #ifndef NET_NQE_NETWORK_ID_H_
6 #define NET_NQE_NETWORK_ID_H_ 6 #define NET_NQE_NETWORK_ID_H_
7 7
8 #include <string> 8 #include <string>
9 #include <tuple> 9 #include <tuple>
10 10
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 #include "net/base/network_change_notifier.h" 13 #include "net/base/network_change_notifier.h"
14 14
15 namespace { 15 namespace {
16 16
17 const char kValueSeparator[] = ","; 17 const char kValueSeparator[] = ",";
18 18
19 // Parses |connection_type_string| as a NetworkChangeNotifier::ConnectionType. 19 // Parses |connection_type_string| as a NetworkChangeNotifier::ConnectionType.
20 // |connection_type_string| must contain the 20 // |connection_type_string| must contain the
21 // NetworkChangeNotifier::ConnectionType enum as an interger. 21 // NetworkChangeNotifier::ConnectionType enum as an interger.
22 net::NetworkChangeNotifier::ConnectionType ConvertStringToConnectionType( 22 net::NetworkChangeNotifier::ConnectionType ConvertStringToConnectionType(
23 const std::string& connection_type_string) { 23 const std::string& connection_type_string) {
24 int connection_type_int = 24 int connection_type_int =
25 static_cast<int>(net::NetworkChangeNotifier::CONNECTION_UNKNOWN); 25 static_cast<int>(net::NetworkChangeNotifier::CONNECTION_UNKNOWN);
26 bool connection_type_available = 26 bool connection_type_available =
27 base::StringToInt(connection_type_string, &connection_type_int); 27 base::StringToInt(connection_type_string, &connection_type_int);
28 28
29 if (!connection_type_available || connection_type_int < 0 || 29 if (!connection_type_available || connection_type_int < 0 ||
30 connection_type_int >= 30 connection_type_int >
31 static_cast<int>(net::NetworkChangeNotifier::CONNECTION_LAST)) { 31 static_cast<int>(net::NetworkChangeNotifier::CONNECTION_LAST)) {
32 DCHECK(false); 32 DCHECK(false);
33 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN; 33 return net::NetworkChangeNotifier::CONNECTION_UNKNOWN;
34 } 34 }
35 return static_cast<net::NetworkChangeNotifier::ConnectionType>( 35 return static_cast<net::NetworkChangeNotifier::ConnectionType>(
36 connection_type_int); 36 connection_type_int);
37 } 37 }
38 38
39 } // namespace 39 } // namespace
40 40
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 // - An empty string in all other cases or if the network name is not 99 // - An empty string in all other cases or if the network name is not
100 // exposed by platform APIs. 100 // exposed by platform APIs.
101 std::string id; 101 std::string id;
102 }; 102 };
103 103
104 } // namespace internal 104 } // namespace internal
105 } // namespace nqe 105 } // namespace nqe
106 } // namespace net 106 } // namespace net
107 107
108 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_ 108 #endif // NET_NQE_NETWORK_QUALITY_ESTIMATOR_H_
OLDNEW
« no previous file with comments | « no previous file | net/nqe/network_quality_estimator.h » ('j') | net/nqe/network_quality_estimator.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698