OLD | NEW |
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/macros.h" | 8 #include "base/macros.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" |
| 11 #include "base/metrics/histogram_base.h" |
11 #include "components/metrics/metrics_provider.h" | 12 #include "components/metrics/metrics_provider.h" |
12 #include "components/metrics/net/wifi_access_point_info_provider.h" | 13 #include "components/metrics/net/wifi_access_point_info_provider.h" |
13 #include "components/metrics/proto/system_profile.pb.h" | 14 #include "components/metrics/proto/system_profile.pb.h" |
14 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
15 #include "net/base/network_interfaces.h" | 16 #include "net/base/network_interfaces.h" |
16 | 17 |
17 namespace metrics { | 18 namespace metrics { |
18 | 19 |
19 // Registers as observer with net::NetworkChangeNotifier and keeps track of | 20 // Registers as observer with net::NetworkChangeNotifier and keeps track of |
20 // the network environment. | 21 // the network environment. |
(...skipping 24 matching lines...) Expand all Loading... |
45 // Callback from the blocking pool with the result of | 46 // Callback from the blocking pool with the result of |
46 // net::GetWifiPHYLayerProtocol. | 47 // net::GetWifiPHYLayerProtocol. |
47 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode); | 48 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode); |
48 | 49 |
49 // Writes info about the wireless access points that this system is | 50 // Writes info about the wireless access points that this system is |
50 // connected to. | 51 // connected to. |
51 void WriteWifiAccessPointProto( | 52 void WriteWifiAccessPointProto( |
52 const WifiAccessPointInfoProvider::WifiAccessPointInfo& info, | 53 const WifiAccessPointInfoProvider::WifiAccessPointInfo& info, |
53 SystemProfileProto::Network* network_proto); | 54 SystemProfileProto::Network* network_proto); |
54 | 55 |
| 56 // Logs metrics that are functions of other metrics being uploaded. |
| 57 void LogAggregatedMetrics(); |
| 58 |
55 // Task runner used for blocking file I/O. | 59 // Task runner used for blocking file I/O. |
56 base::TaskRunner* io_task_runner_; | 60 base::TaskRunner* io_task_runner_; |
57 | 61 |
58 // True if |connection_type_| changed during the lifetime of the log. | 62 // True if |connection_type_| changed during the lifetime of the log. |
59 bool connection_type_is_ambiguous_; | 63 bool connection_type_is_ambiguous_; |
60 // The connection type according to net::NetworkChangeNotifier. | 64 // The connection type according to net::NetworkChangeNotifier. |
61 net::NetworkChangeNotifier::ConnectionType connection_type_; | 65 net::NetworkChangeNotifier::ConnectionType connection_type_; |
62 | 66 |
63 // True if |wifi_phy_layer_protocol_| changed during the lifetime of the log. | 67 // True if |wifi_phy_layer_protocol_| changed during the lifetime of the log. |
64 bool wifi_phy_layer_protocol_is_ambiguous_; | 68 bool wifi_phy_layer_protocol_is_ambiguous_; |
65 // The PHY mode of the currently associated access point obtained via | 69 // The PHY mode of the currently associated access point obtained via |
66 // net::GetWifiPHYLayerProtocol. | 70 // net::GetWifiPHYLayerProtocol. |
67 net::WifiPHYLayerProtocol wifi_phy_layer_protocol_; | 71 net::WifiPHYLayerProtocol wifi_phy_layer_protocol_; |
68 | 72 |
69 // Helper object for retrieving connected wifi access point information. | 73 // Helper object for retrieving connected wifi access point information. |
70 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; | 74 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; |
71 | 75 |
| 76 // These metrics track histogram totals for the Net.ErrorCodesForMainFrame3 |
| 77 // histogram. They are used to compute deltas at upload time. |
| 78 base::HistogramBase::Count total_aborts_; |
| 79 base::HistogramBase::Count total_codes_; |
| 80 |
72 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; | 81 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; |
73 | 82 |
74 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); | 83 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); |
75 }; | 84 }; |
76 | 85 |
77 } // namespace metrics | 86 } // namespace metrics |
78 | 87 |
79 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ | 88 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ |
OLD | NEW |