summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorivansham <ivansham@amazon.com>2015-02-18 15:27:09 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 23:27:47 +0000
commit1fbce4562b2a12e9a40cca38b3dcebd71dd02063 (patch)
tree641b628def66760ca03807446d04519db71efc94 /components
parent32c453b595c6cfeeb3fcdbd74333b3ebbcf815d5 (diff)
downloadchromium_src-1fbce4562b2a12e9a40cca38b3dcebd71dd02063.zip
chromium_src-1fbce4562b2a12e9a40cca38b3dcebd71dd02063.tar.gz
chromium_src-1fbce4562b2a12e9a40cca38b3dcebd71dd02063.tar.bz2
Allow server endpoint to be injected into the NetMetricsLogUploader from chrome/
As discussed in https://codereview.chromium.org/866163002/, this change will allow consumer of the metrics component to configure the metrics uploader endpoint without modifying the component. BUG=453987 Review URL: https://codereview.chromium.org/886173002 Cr-Commit-Position: refs/heads/master@{#316915}
Diffstat (limited to 'components')
-rw-r--r--components/metrics.gypi2
-rw-r--r--components/metrics/BUILD.gn2
-rw-r--r--components/metrics/metrics_service.cc7
-rw-r--r--components/metrics/metrics_service_client.h2
-rw-r--r--components/metrics/test_metrics_service_client.cc2
-rw-r--r--components/metrics/test_metrics_service_client.h2
-rw-r--r--components/metrics/url_constants.cc13
-rw-r--r--components/metrics/url_constants.h18
8 files changed, 35 insertions, 13 deletions
diff --git a/components/metrics.gypi b/components/metrics.gypi
index c723a15..9a8f19d 100644
--- a/components/metrics.gypi
+++ b/components/metrics.gypi
@@ -66,6 +66,8 @@
'metrics/metrics_switches.h',
'metrics/persisted_logs.cc',
'metrics/persisted_logs.h',
+ 'metrics/url_constants.cc',
+ 'metrics/url_constants.h',
],
'conditions': [
['chromeos==1', {
diff --git a/components/metrics/BUILD.gn b/components/metrics/BUILD.gn
index 69d0af4..7f4b9b5 100644
--- a/components/metrics/BUILD.gn
+++ b/components/metrics/BUILD.gn
@@ -48,6 +48,8 @@ source_set("metrics") {
"metrics_switches.h",
"persisted_logs.cc",
"persisted_logs.h",
+ "url_constants.cc",
+ "url_constants.h",
]
public_deps = [
diff --git a/components/metrics/metrics_service.cc b/components/metrics/metrics_service.cc
index 18ec2e5..962d836 100644
--- a/components/metrics/metrics_service.cc
+++ b/components/metrics/metrics_service.cc
@@ -227,12 +227,6 @@ const size_t kUploadLogAvoidRetransmitSize = 100 * 1024;
// Interval, in minutes, between state saves.
const int kSaveStateIntervalMinutes = 5;
-// The metrics server's URL.
-const char kServerUrl[] = "https://clients4.google.com/uma/v2";
-
-// The MIME type for the uploaded metrics data.
-const char kMimeType[] = "application/vnd.chrome.uma";
-
enum ResponseStatus {
UNKNOWN_FAILURE,
SUCCESS,
@@ -1021,7 +1015,6 @@ void MetricsService::SendStagedLog() {
if (!log_uploader_) {
log_uploader_ = client_->CreateUploader(
- kServerUrl, kMimeType,
base::Bind(&MetricsService::OnLogUploadComplete,
self_ptr_factory_.GetWeakPtr()));
}
diff --git a/components/metrics/metrics_service_client.h b/components/metrics/metrics_service_client.h
index 4289bae..fa31c5e 100644
--- a/components/metrics/metrics_service_client.h
+++ b/components/metrics/metrics_service_client.h
@@ -64,8 +64,6 @@ class MetricsServiceClient {
// Creates a MetricsLogUploader with the specified parameters (see comments on
// MetricsLogUploader for details).
virtual scoped_ptr<MetricsLogUploader> CreateUploader(
- const std::string& server_url,
- const std::string& mime_type,
const base::Callback<void(int)>& on_upload_complete) = 0;
// Returns the name of a key under HKEY_CURRENT_USER that can be used to store
diff --git a/components/metrics/test_metrics_service_client.cc b/components/metrics/test_metrics_service_client.cc
index c60db0b..53cb1d9 100644
--- a/components/metrics/test_metrics_service_client.cc
+++ b/components/metrics/test_metrics_service_client.cc
@@ -65,8 +65,6 @@ void TestMetricsServiceClient::CollectFinalMetrics(
}
scoped_ptr<MetricsLogUploader> TestMetricsServiceClient::CreateUploader(
- const std::string& server_url,
- const std::string& mime_type,
const base::Callback<void(int)>& on_upload_complete) {
return scoped_ptr<MetricsLogUploader>();
}
diff --git a/components/metrics/test_metrics_service_client.h b/components/metrics/test_metrics_service_client.h
index c46ac4e..14c5518 100644
--- a/components/metrics/test_metrics_service_client.h
+++ b/components/metrics/test_metrics_service_client.h
@@ -32,8 +32,6 @@ class TestMetricsServiceClient : public MetricsServiceClient {
void StartGatheringMetrics(const base::Closure& done_callback) override;
void CollectFinalMetrics(const base::Closure& done_callback) override;
scoped_ptr<MetricsLogUploader> CreateUploader(
- const std::string& server_url,
- const std::string& mime_type,
const base::Callback<void(int)>& on_upload_complete) override;
const std::string& get_client_id() const { return client_id_; }
diff --git a/components/metrics/url_constants.cc b/components/metrics/url_constants.cc
new file mode 100644
index 0000000..55d9e13
--- /dev/null
+++ b/components/metrics/url_constants.cc
@@ -0,0 +1,13 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/metrics/url_constants.h"
+
+namespace metrics {
+
+const char kDefaultMetricsServerUrl[] = "https://clients4.google.com/uma/v2";
+const char kDefaultMetricsMimeType[] = "application/vnd.chrome.uma";
+
+} // namespace metrics
+
diff --git a/components/metrics/url_constants.h b/components/metrics/url_constants.h
new file mode 100644
index 0000000..b52ddef
--- /dev/null
+++ b/components/metrics/url_constants.h
@@ -0,0 +1,18 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_METRICS_URL_CONSTANTS_H_
+#define COMPONENTS_METRICS_URL_CONSTANTS_H_
+
+namespace metrics {
+
+// The default metrics server's URL.
+extern const char kDefaultMetricsServerUrl[];
+
+// The default MIME type for the uploaded metrics data.
+extern const char kDefaultMetricsMimeType[];
+
+} // namespace metrics
+
+#endif // COMPONENTS_METRICS_URL_CONSTANTS_H_