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

Side by Side Diff: components/metrics/net/network_metrics_provider.h

Issue 1033493002: Histogram for UMA log upload connection type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ 5 #ifndef COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
6 #define COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ 6 #define COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 13 matching lines...) Expand all
24 public: 24 public:
25 // Creates a NetworkMetricsProvider, where |io_task_runner| is used to post 25 // Creates a NetworkMetricsProvider, where |io_task_runner| is used to post
26 // network info collection tasks. 26 // network info collection tasks.
27 explicit NetworkMetricsProvider(base::TaskRunner* io_task_runner); 27 explicit NetworkMetricsProvider(base::TaskRunner* io_task_runner);
28 ~NetworkMetricsProvider() override; 28 ~NetworkMetricsProvider() override;
29 29
30 // Returns callback function bound to the weak pointer of the provider, which 30 // Returns callback function bound to the weak pointer of the provider, which
31 // can be used to get whether current connection type is cellular. 31 // can be used to get whether current connection type is cellular.
32 base::Callback<void(bool*)> GetConnectionCallback(); 32 base::Callback<void(bool*)> GetConnectionCallback();
33 33
34 // Returns true if the connection type is 2G, 3G, or 4G.
35 bool IsCellularConnection() const;
36
37 SystemProfileProto::Network::ConnectionType GetConnectionType() const;
38
34 private: 39 private:
35 // MetricsProvider: 40 // MetricsProvider:
36 void OnDidCreateMetricsLog() override; 41 void OnDidCreateMetricsLog() override;
37 void ProvideSystemProfileMetrics(SystemProfileProto* system_profile) override; 42 void ProvideSystemProfileMetrics(SystemProfileProto* system_profile) override;
38 43
39 // ConnectionTypeObserver: 44 // ConnectionTypeObserver:
40 void OnConnectionTypeChanged( 45 void OnConnectionTypeChanged(
41 net::NetworkChangeNotifier::ConnectionType type) override; 46 net::NetworkChangeNotifier::ConnectionType type) override;
42 47
43 SystemProfileProto::Network::ConnectionType GetConnectionType() const;
44 SystemProfileProto::Network::WifiPHYLayerProtocol GetWifiPHYLayerProtocol() 48 SystemProfileProto::Network::WifiPHYLayerProtocol GetWifiPHYLayerProtocol()
45 const; 49 const;
46 50
47 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool. 51 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool.
48 void ProbeWifiPHYLayerProtocol(); 52 void ProbeWifiPHYLayerProtocol();
49 // Callback from the blocking pool with the result of 53 // Callback from the blocking pool with the result of
50 // net::GetWifiPHYLayerProtocol. 54 // net::GetWifiPHYLayerProtocol.
51 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode); 55 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode);
52 56
53 // Writes info about the wireless access points that this system is 57 // Writes info about the wireless access points that this system is
54 // connected to. 58 // connected to.
55 void WriteWifiAccessPointProto( 59 void WriteWifiAccessPointProto(
56 const WifiAccessPointInfoProvider::WifiAccessPointInfo& info, 60 const WifiAccessPointInfoProvider::WifiAccessPointInfo& info,
57 SystemProfileProto::Network* network_proto); 61 SystemProfileProto::Network* network_proto);
58 62
59 // Returns true if the connection type is 2G, 3G, or 4G.
60 bool IsCellularConnection();
61
62 // Assigns the passed |is_cellular_out| parameter based on whether current 63 // Assigns the passed |is_cellular_out| parameter based on whether current
63 // network connection is cellular. 64 // network connection is cellular.
64 void GetIsCellularConnection(bool* is_cellular_out); 65 void GetIsCellularConnection(bool* is_cellular_out);
65 66
66 // Task runner used for blocking file I/O. 67 // Task runner used for blocking file I/O.
67 base::TaskRunner* io_task_runner_; 68 base::TaskRunner* io_task_runner_;
68 69
69 // True if |connection_type_| changed during the lifetime of the log. 70 // True if |connection_type_| changed during the lifetime of the log.
70 bool connection_type_is_ambiguous_; 71 bool connection_type_is_ambiguous_;
71 // The connection type according to net::NetworkChangeNotifier. 72 // The connection type according to net::NetworkChangeNotifier.
72 net::NetworkChangeNotifier::ConnectionType connection_type_; 73 net::NetworkChangeNotifier::ConnectionType connection_type_;
73 74
74 // True if |wifi_phy_layer_protocol_| changed during the lifetime of the log. 75 // True if |wifi_phy_layer_protocol_| changed during the lifetime of the log.
75 bool wifi_phy_layer_protocol_is_ambiguous_; 76 bool wifi_phy_layer_protocol_is_ambiguous_;
76 // The PHY mode of the currently associated access point obtained via 77 // The PHY mode of the currently associated access point obtained via
77 // net::GetWifiPHYLayerProtocol. 78 // net::GetWifiPHYLayerProtocol.
78 net::WifiPHYLayerProtocol wifi_phy_layer_protocol_; 79 net::WifiPHYLayerProtocol wifi_phy_layer_protocol_;
79 80
80 // Helper object for retrieving connected wifi access point information. 81 // Helper object for retrieving connected wifi access point information.
81 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; 82 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_;
82 83
83 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; 84 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_;
84 85
85 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); 86 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider);
86 }; 87 };
87 88
88 } // namespace metrics 89 } // namespace metrics
89 90
90 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ 91 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698