Index: components/metrics/net/net_metrics_log_uploader.cc |
diff --git a/components/metrics/net/net_metrics_log_uploader.cc b/components/metrics/net/net_metrics_log_uploader.cc |
index 1a686742e247a19f2b9659b589d78df39cf4c4de..42a6c7103c0246a3e92db5f81b7f092aede4ccbb 100644 |
--- a/components/metrics/net/net_metrics_log_uploader.cc |
+++ b/components/metrics/net/net_metrics_log_uploader.cc |
@@ -6,9 +6,22 @@ |
#include "base/metrics/histogram.h" |
#include "net/base/load_flags.h" |
+#include "net/base/network_change_notifier.h" |
#include "net/url_request/url_fetcher.h" |
#include "url/gurl.h" |
+namespace { |
+ |
+// Records the network connection type if upload was successful. |
+void RecordConnectionType(int response_code) { |
+ if (response_code == 200) { |
+ UMA_HISTOGRAM_ENUMERATION("UMA.LogUpload.ConnetionType", |
+ net::NetworkChangeNotifier::GetConnectionType(), |
+ net::NetworkChangeNotifier::CONNECTION_LAST); |
Ilya Sherman
2015/03/25 23:10:00
If you reuse this enum, please add a comment above
gayane -on leave until 09-2017
2015/03/26 17:41:27
Done.
|
+ } |
+} |
Ilya Sherman
2015/03/25 23:10:00
nit: Please leave a blank line after this one.
gayane -on leave until 09-2017
2015/03/26 17:41:27
Done.
|
+} |
Ilya Sherman
2015/03/25 23:10:00
nit: Please add a comment " // namespace"
gayane -on leave until 09-2017
2015/03/26 17:41:27
Done.
|
+ |
namespace metrics { |
NetMetricsLogUploader::NetMetricsLogUploader( |
@@ -54,6 +67,7 @@ void NetMetricsLogUploader::OnURLFetchComplete(const net::URLFetcher* source) { |
if (response_code == net::URLFetcher::RESPONSE_CODE_INVALID) |
response_code = -1; |
current_fetch_.reset(); |
+ RecordConnectionType(response_code); |
on_upload_complete_.Run(response_code); |
} |