Add GCMChannelStatusSyncer to schedule requests and enable/disable GCM
[chromium-blink-merge.git] / chrome / browser / metrics / network_stats_uploader.cc
blob6ab6671a9bdfb60518a2fa3d9ab8a64931608f54
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
3 // found in the LICENSE file.
5 #include "chrome/browser/metrics/network_stats_uploader.h"
7 #include "chrome/browser/browser_process.h"
8 #include "chrome/browser/metrics/time_ticks_experiment_win.h"
9 #include "chrome/browser/net/network_stats.h"
10 #include "chrome/common/net/test_server_locations.h"
12 #if !defined(OS_POSIX)
13 #include "chrome/installer/util/browser_distribution.h"
14 #endif
16 NetworkStatsUploader::NetworkStatsUploader() {
17 #if defined(OS_POSIX)
18 network_stats_server_ = chrome_common_net::kEchoTestServerLocation;
19 #else
20 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
21 network_stats_server_ = dist->GetNetworkStatsServer();
22 #endif
25 NetworkStatsUploader::~NetworkStatsUploader() {
28 void NetworkStatsUploader::CollectAndReportNetworkStats() {
29 IOThread* io_thread = g_browser_process->io_thread();
30 if (!io_thread)
31 return;
33 chrome_browser_net::CollectNetworkStats(network_stats_server_, io_thread);
34 #if defined(OS_WIN)
35 chrome::CollectTimeTicksStats();
36 #endif