| 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/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 "components/metrics/metrics_provider.h" | 11 #include "components/metrics/metrics_provider.h" |
| 12 #include "components/metrics/net/wifi_access_point_info_provider.h" | 12 #include "components/metrics/net/wifi_access_point_info_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 // Creates a NetworkMetricsProvider, where |io_task_runner| is used to post | 23 // Creates a NetworkMetricsProvider, where |io_task_runner| is used to post |
| 24 // network info collection tasks. | 24 // network info collection tasks. |
| 25 explicit NetworkMetricsProvider(base::TaskRunner* io_task_runner); | 25 explicit NetworkMetricsProvider(base::TaskRunner* io_task_runner); |
| 26 virtual ~NetworkMetricsProvider(); | 26 ~NetworkMetricsProvider() override; |
| 27 | 27 |
| 28 private: | 28 private: |
| 29 // metrics::MetricsProvider: | 29 // metrics::MetricsProvider: |
| 30 virtual void OnDidCreateMetricsLog() override; | 30 void OnDidCreateMetricsLog() override; |
| 31 virtual void ProvideSystemProfileMetrics( | 31 void ProvideSystemProfileMetrics( |
| 32 metrics::SystemProfileProto* system_profile) override; | 32 metrics::SystemProfileProto* system_profile) override; |
| 33 | 33 |
| 34 // ConnectionTypeObserver: | 34 // ConnectionTypeObserver: |
| 35 virtual void OnConnectionTypeChanged( | 35 void OnConnectionTypeChanged( |
| 36 net::NetworkChangeNotifier::ConnectionType type) override; | 36 net::NetworkChangeNotifier::ConnectionType type) override; |
| 37 | 37 |
| 38 metrics::SystemProfileProto::Network::ConnectionType | 38 metrics::SystemProfileProto::Network::ConnectionType |
| 39 GetConnectionType() const; | 39 GetConnectionType() const; |
| 40 metrics::SystemProfileProto::Network::WifiPHYLayerProtocol | 40 metrics::SystemProfileProto::Network::WifiPHYLayerProtocol |
| 41 GetWifiPHYLayerProtocol() const; | 41 GetWifiPHYLayerProtocol() const; |
| 42 | 42 |
| 43 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool. | 43 // Posts a call to net::GetWifiPHYLayerProtocol on the blocking pool. |
| 44 void ProbeWifiPHYLayerProtocol(); | 44 void ProbeWifiPHYLayerProtocol(); |
| 45 // Callback from the blocking pool with the result of | 45 // Callback from the blocking pool with the result of |
| (...skipping 22 matching lines...) Expand all Loading... |
| 68 | 68 |
| 69 // Helper object for retrieving connected wifi access point information. | 69 // Helper object for retrieving connected wifi access point information. |
| 70 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; | 70 scoped_ptr<WifiAccessPointInfoProvider> wifi_access_point_info_provider_; |
| 71 | 71 |
| 72 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; | 72 base::WeakPtrFactory<NetworkMetricsProvider> weak_ptr_factory_; |
| 73 | 73 |
| 74 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); | 74 DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider); |
| 75 }; | 75 }; |
| 76 | 76 |
| 77 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ | 77 #endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_ |
| OLD | NEW |