Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: chromecast/browser/metrics/cast_metrics_service_client.cc

Issue 886173002: Allow server endpoint to be injected into the NetMetricsLogUploader from chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed GN build Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chromecast/browser/metrics/cast_metrics_service_client.h ('k') | components/metrics.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "chromecast/browser/metrics/cast_metrics_service_client.h" 5 #include "chromecast/browser/metrics/cast_metrics_service_client.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/guid.h" 8 #include "base/guid.h"
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chromecast/browser/metrics/cast_stability_metrics_provider.h" 11 #include "chromecast/browser/metrics/cast_stability_metrics_provider.h"
12 #include "chromecast/browser/metrics/platform_metrics_providers.h" 12 #include "chromecast/browser/metrics/platform_metrics_providers.h"
13 #include "chromecast/common/chromecast_switches.h" 13 #include "chromecast/common/chromecast_switches.h"
14 #include "chromecast/common/pref_names.h" 14 #include "chromecast/common/pref_names.h"
15 #include "components/metrics/client_info.h" 15 #include "components/metrics/client_info.h"
16 #include "components/metrics/gpu/gpu_metrics_provider.h" 16 #include "components/metrics/gpu/gpu_metrics_provider.h"
17 #include "components/metrics/metrics_pref_names.h" 17 #include "components/metrics/metrics_pref_names.h"
18 #include "components/metrics/metrics_provider.h" 18 #include "components/metrics/metrics_provider.h"
19 #include "components/metrics/metrics_service.h" 19 #include "components/metrics/metrics_service.h"
20 #include "components/metrics/metrics_state_manager.h" 20 #include "components/metrics/metrics_state_manager.h"
21 #include "components/metrics/net/net_metrics_log_uploader.h" 21 #include "components/metrics/net/net_metrics_log_uploader.h"
22 #include "components/metrics/net/network_metrics_provider.h" 22 #include "components/metrics/net/network_metrics_provider.h"
23 #include "components/metrics/profiler/profiler_metrics_provider.h" 23 #include "components/metrics/profiler/profiler_metrics_provider.h"
24 #include "components/metrics/url_constants.h"
24 #include "content/public/common/content_switches.h" 25 #include "content/public/common/content_switches.h"
25 26
26 #if defined(OS_LINUX) 27 #if defined(OS_LINUX)
27 #include "chromecast/browser/metrics/external_metrics.h" 28 #include "chromecast/browser/metrics/external_metrics.h"
28 #endif // defined(OS_LINUX) 29 #endif // defined(OS_LINUX)
29 30
30 namespace chromecast { 31 namespace chromecast {
31 namespace metrics { 32 namespace metrics {
32 33
33 // static 34 // static
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 done_callback.Run(); 127 done_callback.Run();
127 } 128 }
128 129
129 void CastMetricsServiceClient::CollectFinalMetrics( 130 void CastMetricsServiceClient::CollectFinalMetrics(
130 const base::Closure& done_callback) { 131 const base::Closure& done_callback) {
131 done_callback.Run(); 132 done_callback.Run();
132 } 133 }
133 134
134 scoped_ptr< ::metrics::MetricsLogUploader> 135 scoped_ptr< ::metrics::MetricsLogUploader>
135 CastMetricsServiceClient::CreateUploader( 136 CastMetricsServiceClient::CreateUploader(
136 const std::string& server_url,
137 const std::string& mime_type,
138 const base::Callback<void(int)>& on_upload_complete) { 137 const base::Callback<void(int)>& on_upload_complete) {
139 std::string uma_server_url(server_url); 138 std::string uma_server_url(::metrics::kDefaultMetricsServerUrl);
140 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 139 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
141 if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { 140 if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) {
142 uma_server_url.assign( 141 uma_server_url.assign(
143 command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); 142 command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl));
144 } 143 }
145 DCHECK(!uma_server_url.empty()); 144 DCHECK(!uma_server_url.empty());
146 return scoped_ptr< ::metrics::MetricsLogUploader>( 145 return scoped_ptr< ::metrics::MetricsLogUploader>(
147 new ::metrics::NetMetricsLogUploader( 146 new ::metrics::NetMetricsLogUploader(
148 request_context_, 147 request_context_,
149 uma_server_url, 148 uma_server_url,
150 mime_type, 149 ::metrics::kDefaultMetricsMimeType,
151 on_upload_complete)); 150 on_upload_complete));
152 } 151 }
153 152
154 void CastMetricsServiceClient::EnableMetricsService(bool enabled) { 153 void CastMetricsServiceClient::EnableMetricsService(bool enabled) {
155 if (!metrics_service_loop_->BelongsToCurrentThread()) { 154 if (!metrics_service_loop_->BelongsToCurrentThread()) {
156 metrics_service_loop_->PostTask( 155 metrics_service_loop_->PostTask(
157 FROM_HERE, 156 FROM_HERE,
158 base::Bind(&CastMetricsServiceClient::EnableMetricsService, 157 base::Bind(&CastMetricsServiceClient::EnableMetricsService,
159 base::Unretained(this), 158 base::Unretained(this),
160 enabled)); 159 enabled));
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 #endif // defined(OS_LINUX) 263 #endif // defined(OS_LINUX)
265 metrics_service_->Stop(); 264 metrics_service_->Stop();
266 } 265 }
267 266
268 bool CastMetricsServiceClient::IsReportingEnabled() { 267 bool CastMetricsServiceClient::IsReportingEnabled() {
269 return PlatformIsReportingEnabled(cast_service_); 268 return PlatformIsReportingEnabled(cast_service_);
270 } 269 }
271 270
272 } // namespace metrics 271 } // namespace metrics
273 } // namespace chromecast 272 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/metrics/cast_metrics_service_client.h ('k') | components/metrics.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698