Commit 043f3600 authored by gunsch's avatar gunsch Committed by Commit bot

Moves NetworkMetricsProvider to //components/metrics.

R=stevenjb@chromium.org,asvitkine@chromium.org,benchan@chromium.org
BUG=404791

Review URL: https://codereview.chromium.org/558873002

Cr-Commit-Position: refs/heads/master@{#294466}
parent 9c3546ac
......@@ -23,7 +23,6 @@
#include "chrome/browser/google/google_brand.h"
#include "chrome/browser/metrics/chrome_stability_metrics_provider.h"
#include "chrome/browser/metrics/gpu_metrics_provider.h"
#include "chrome/browser/metrics/network_metrics_provider.h"
#include "chrome/browser/metrics/omnibox_metrics_provider.h"
#include "chrome/browser/metrics/profiler_metrics_provider.h"
#include "chrome/browser/metrics/tracking_synchronizer.h"
......@@ -36,6 +35,7 @@
#include "chrome/common/render_messages.h"
#include "components/metrics/metrics_service.h"
#include "components/metrics/net/net_metrics_log_uploader.h"
#include "components/metrics/net/network_metrics_provider.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/histogram_fetcher.h"
#include "content/public/browser/notification_service.h"
......@@ -292,7 +292,8 @@ void ChromeMetricsServiceClient::Initialize() {
new ExtensionsMetricsProvider(metrics_state_manager_)));
#endif
metrics_service_->RegisterMetricsProvider(
scoped_ptr<metrics::MetricsProvider>(new NetworkMetricsProvider));
scoped_ptr<metrics::MetricsProvider>(new NetworkMetricsProvider(
content::BrowserThread::GetBlockingPool())));
metrics_service_->RegisterMetricsProvider(
scoped_ptr<metrics::MetricsProvider>(new OmniboxMetricsProvider));
metrics_service_->RegisterMetricsProvider(
......
......@@ -689,8 +689,6 @@
'browser/metrics/metrics_service_accessor.h',
'browser/metrics/metrics_services_manager.cc',
'browser/metrics/metrics_services_manager.h',
'browser/metrics/network_metrics_provider.cc',
'browser/metrics/network_metrics_provider.h',
'browser/metrics/network_stats_uploader.cc',
'browser/metrics/network_stats_uploader.h',
'browser/metrics/omnibox_metrics_provider.cc',
......@@ -722,10 +720,6 @@
'browser/metrics/variations/variations_seed_store.h',
'browser/metrics/variations/variations_service.cc',
'browser/metrics/variations/variations_service.h',
'browser/metrics/wifi_access_point_info_provider.h',
'browser/metrics/wifi_access_point_info_provider.cc',
'browser/metrics/wifi_access_point_info_provider_chromeos.h',
'browser/metrics/wifi_access_point_info_provider_chromeos.cc',
'browser/native_window_notification_source.h',
'browser/net/about_protocol_handler.cc',
'browser/net/about_protocol_handler.h',
......
......@@ -73,11 +73,18 @@
],
'dependencies': [
'../net/net.gyp:net',
'component_metrics_proto',
'metrics',
],
'sources': [
'metrics/net/network_metrics_provider.cc',
'metrics/net/network_metrics_provider.h',
'metrics/net/net_metrics_log_uploader.cc',
'metrics/net/net_metrics_log_uploader.h',
'metrics/net/wifi_access_point_info_provider.cc',
'metrics/net/wifi_access_point_info_provider.h',
'metrics/net/wifi_access_point_info_provider_chromeos.cc',
'metrics/net/wifi_access_point_info_provider_chromeos.h',
],
},
{
......
......@@ -52,8 +52,14 @@ source_set("metrics") {
# GYP version: components/metrics.gypi:metrics_net
static_library("net") {
sources = [
"net/network_metrics_provider.cc",
"net/network_metrics_provider.h",
"net/net_metrics_log_uploader.cc",
"net/net_metrics_log_uploader.h",
"net/wifi_access_point_info_provider.cc",
"net/wifi_access_point_info_provider.h",
"net/wifi_access_point_info_provider_chromeos.cc",
"net/wifi_access_point_info_provider_chromeos.h",
]
deps = [
......
include_rules = [
"+chromeos/network",
"+net",
"+third_party/cros_system_api",
]
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/metrics/network_metrics_provider.h"
#include "components/metrics/net/network_metrics_provider.h"
#include <string>
#include <vector>
......@@ -12,17 +12,17 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/task_runner_util.h"
#include "base/threading/sequenced_worker_pool.h"
#include "content/public/browser/browser_thread.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/metrics/wifi_access_point_info_provider_chromeos.h"
#include "components/metrics/net/wifi_access_point_info_provider_chromeos.h"
#endif // OS_CHROMEOS
using metrics::SystemProfileProto;
NetworkMetricsProvider::NetworkMetricsProvider()
: connection_type_is_ambiguous_(false),
NetworkMetricsProvider::NetworkMetricsProvider(
base::TaskRunner* io_task_runner)
: io_task_runner_(io_task_runner),
connection_type_is_ambiguous_(false),
wifi_phy_layer_protocol_is_ambiguous_(false),
wifi_phy_layer_protocol_(net::WIFI_PHY_LAYER_PROTOCOL_UNKNOWN),
weak_ptr_factory_(this) {
......@@ -131,7 +131,7 @@ NetworkMetricsProvider::GetWifiPHYLayerProtocol() const {
void NetworkMetricsProvider::ProbeWifiPHYLayerProtocol() {
PostTaskAndReplyWithResult(
content::BrowserThread::GetBlockingPool(),
io_task_runner_,
FROM_HERE,
base::Bind(&net::GetWifiPHYLayerProtocol),
base::Bind(&NetworkMetricsProvider::OnWifiPHYLayerProtocolResult,
......
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_
#define CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_
#ifndef COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
#define COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "chrome/browser/metrics/wifi_access_point_info_provider.h"
#include "components/metrics/metrics_provider.h"
#include "components/metrics/net/wifi_access_point_info_provider.h"
#include "components/metrics/proto/system_profile.pb.h"
#include "net/base/net_util.h"
#include "net/base/network_change_notifier.h"
......@@ -20,7 +20,9 @@ class NetworkMetricsProvider
: public metrics::MetricsProvider,
public net::NetworkChangeNotifier::ConnectionTypeObserver {
public:
NetworkMetricsProvider();
// Creates a NetworkMetricsProvider, where |io_task_runner| is used to post
// network info collection tasks.
explicit NetworkMetricsProvider(base::TaskRunner* io_task_runner);
virtual ~NetworkMetricsProvider();
private:
......@@ -50,6 +52,9 @@ class NetworkMetricsProvider
const WifiAccessPointInfoProvider::WifiAccessPointInfo& info,
metrics::SystemProfileProto::Network* network_proto);
// Task runner used for blocking file I/O.
base::TaskRunner* io_task_runner_;
// True if |connection_type_| changed during the lifetime of the log.
bool connection_type_is_ambiguous_;
// The connection type according to net::NetworkChangeNotifier.
......@@ -69,4 +74,4 @@ class NetworkMetricsProvider
DISALLOW_COPY_AND_ASSIGN(NetworkMetricsProvider);
};
#endif // CHROME_BROWSER_METRICS_NETWORK_METRICS_PROVIDER_H_
#endif // COMPONENTS_METRICS_NET_NETWORK_METRICS_PROVIDER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/metrics/wifi_access_point_info_provider.h"
#include "components/metrics/net/wifi_access_point_info_provider.h"
WifiAccessPointInfoProvider::WifiAccessPointInfo::WifiAccessPointInfo() {
}
......
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
#define CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
#ifndef COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
#define COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
#include <string>
#include "base/basictypes.h"
......@@ -46,4 +46,4 @@ class WifiAccessPointInfoProvider {
DISALLOW_COPY_AND_ASSIGN(WifiAccessPointInfoProvider);
};
#endif // CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
#endif // COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/metrics/wifi_access_point_info_provider_chromeos.h"
#include "components/metrics/net/wifi_access_point_info_provider_chromeos.h"
#include "base/bind.h"
#include "base/location.h"
......
......@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
#define CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
#ifndef COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
#define COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
#include "base/basictypes.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "chrome/browser/metrics/wifi_access_point_info_provider.h"
#include "chromeos/network/network_state_handler_observer.h"
#include "components/metrics/net/wifi_access_point_info_provider.h"
// WifiAccessPointInfoProviderChromeos provides the connected wifi
// acccess point information for chromeos.
......@@ -39,4 +39,4 @@ class WifiAccessPointInfoProviderChromeos
DISALLOW_COPY_AND_ASSIGN(WifiAccessPointInfoProviderChromeos);
};
#endif // CHROME_BROWSER_METRICS_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
#endif // COMPONENTS_METRICS_NET_WIFI_ACCESS_POINT_INFO_PROVIDER_CHROMEOS_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment