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 CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_ |
6 #define CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_ | 6 #define CHROME_BROWSER_METRICS_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" |
11 #include "chrome/browser/metrics/wifi_access_point_info_provider.h" | 11 #include "chrome/browser/metrics/wifi_access_point_info_provider.h" |
12 #include "components/metrics/metrics_provider.h" | 12 #include "components/metrics/metrics_provider.h" |
13 #include "components/metrics/proto/system_profile.pb.h" | 13 #include "components/metrics/proto/system_profile.pb.h" |
14 #include "net/base/net_util.h" | 14 #include "net/base/net_util.h" |
15 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
16 | 16 |
17 // Registers as observer with net::NetworkChangeNotifier and keeps track of | 17 // Registers as observer with net::NetworkChangeNotifier and keeps track of |
18 // the network environment. | 18 // the network environment. |
19 class NetworkMetricsProvider | 19 class NetworkMetricsProvider |
20 : public metrics::MetricsProvider, | 20 : public metrics::MetricsProvider, |
21 public net::NetworkChangeNotifier::ConnectionTypeObserver { | 21 public net::NetworkChangeNotifier::ConnectionTypeObserver { |
22 public: | 22 public: |
23 NetworkMetricsProvider(); | 23 NetworkMetricsProvider(); |
24 virtual ~NetworkMetricsProvider(); | 24 virtual ~NetworkMetricsProvider(); |
25 | 25 |
| 26 private: |
26 // metrics::MetricsProvider: | 27 // metrics::MetricsProvider: |
| 28 virtual void OnDidCreateMetricsLog() OVERRIDE; |
27 virtual void ProvideSystemProfileMetrics( | 29 virtual void ProvideSystemProfileMetrics( |
28 metrics::SystemProfileProto* system_profile) OVERRIDE; | 30 metrics::SystemProfileProto* system_profile) OVERRIDE; |
29 | 31 |
30 // ConnectionTypeObserver: | 32 // ConnectionTypeObserver: |
31 virtual void OnConnectionTypeChanged( | 33 virtual void OnConnectionTypeChanged( |
32 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; | 34 net::NetworkChangeNotifier::ConnectionType type) OVERRIDE; |
33 | 35 |
34 private: | |
35 metrics::SystemProfileProto::Network::ConnectionType | 36 metrics::SystemProfileProto::Network::ConnectionType |
36 GetConnectionType() const; | 37 GetConnectionType() const; |
37 metrics::SystemProfileProto::Network::WifiPHYLayerProtocol | 38 metrics::SystemProfileProto::Network::WifiPHYLayerProtocol |
38 GetWifiPHYLayerProtocol() const; | 39 GetWifiPHYLayerProtocol() const; |
39 | 40 |
40 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool. | 41 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool. |
41 void ProbeWifiPHYLayerProtocol(); | 42 void ProbeWifiPHYLayerProtocol(); |
42 // Callback from the blocking pool with the result of | 43 // Callback from the blocking pool with the result of |
43 // net::GetWifiPHYLayerProtocol. | 44 // net::GetWifiPHYLayerProtocol. |
44 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode); | 45 void OnWifiPHYLayerProtocolResult(net::WifiPHYLayerProtocol mode); |
(...skipping 17 matching lines...) Expand all Loading... |
62 | 63 |
63 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; | 64 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; |
64 | 65 |
65 // Helper object for retrieving connected wifi access point information. | 66 // Helper object for retrieving connected wifi access point information. |
66 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; | 67 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; |
67 | 68 |
68 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); | 69 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); |
69 }; | 70 }; |
70 | 71 |
71 #endif // CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_ | 72 #endif // CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_ |
OLD | NEW |