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

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

Issue 506083003: Chromecast: command-line switch to override the UMA metric upload URL. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: license headers Created 6 years, 3 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/common/chromecast_switches.cc ('k') | no next file » | 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/metrics/cast_metrics_service_client.h" 5 #include "chromecast/metrics/cast_metrics_service_client.h"
6 6
7 #include "base/command_line.h"
7 #include "base/i18n/rtl.h" 8 #include "base/i18n/rtl.h"
8 #include "chromecast/common/chromecast_config.h" 9 #include "chromecast/common/chromecast_config.h"
10 #include "chromecast/common/chromecast_switches.h"
9 #include "chromecast/metrics/platform_metrics_providers.h" 11 #include "chromecast/metrics/platform_metrics_providers.h"
10 #include "components/metrics/metrics_provider.h" 12 #include "components/metrics/metrics_provider.h"
11 #include "components/metrics/metrics_service.h" 13 #include "components/metrics/metrics_service.h"
12 #include "components/metrics/metrics_state_manager.h" 14 #include "components/metrics/metrics_state_manager.h"
13 #include "components/metrics/net/net_metrics_log_uploader.h" 15 #include "components/metrics/net/net_metrics_log_uploader.h"
14 16
15 namespace chromecast { 17 namespace chromecast {
16 namespace metrics { 18 namespace metrics {
17 19
18 // static 20 // static
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 void CastMetricsServiceClient::CollectFinalMetrics( 64 void CastMetricsServiceClient::CollectFinalMetrics(
63 const base::Closure& done_callback) { 65 const base::Closure& done_callback) {
64 done_callback.Run(); 66 done_callback.Run();
65 } 67 }
66 68
67 scoped_ptr< ::metrics::MetricsLogUploader> 69 scoped_ptr< ::metrics::MetricsLogUploader>
68 CastMetricsServiceClient::CreateUploader( 70 CastMetricsServiceClient::CreateUploader(
69 const std::string& server_url, 71 const std::string& server_url,
70 const std::string& mime_type, 72 const std::string& mime_type,
71 const base::Callback<void(int)>& on_upload_complete) { 73 const base::Callback<void(int)>& on_upload_complete) {
74 std::string uma_server_url(server_url);
75 if (base::CommandLine::ForCurrentProcess()->
Alexei Svitkine (slow) 2014/08/29 23:51:41 Nit: Make a local var for this to avoid calling it
76 HasSwitch(switches::kOverrideMetricsUploadUrl)) {
77 uma_server_url.assign(
78 base::CommandLine::ForCurrentProcess()->
79 GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl));
80 }
81 DCHECK(!uma_server_url.empty());
72 return scoped_ptr< ::metrics::MetricsLogUploader>( 82 return scoped_ptr< ::metrics::MetricsLogUploader>(
73 new ::metrics::NetMetricsLogUploader( 83 new ::metrics::NetMetricsLogUploader(
74 request_context_, 84 request_context_,
75 server_url, 85 uma_server_url,
76 mime_type, 86 mime_type,
77 on_upload_complete)); 87 on_upload_complete));
78 } 88 }
79 89
80 void CastMetricsServiceClient::EnableMetricsService(bool enabled) { 90 void CastMetricsServiceClient::EnableMetricsService(bool enabled) {
81 if (enabled) { 91 if (enabled) {
82 metrics_service_->Start(); 92 metrics_service_->Start();
83 } else { 93 } else {
84 metrics_service_->Stop(); 94 metrics_service_->Stop();
85 } 95 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 130
121 CastMetricsServiceClient::~CastMetricsServiceClient() { 131 CastMetricsServiceClient::~CastMetricsServiceClient() {
122 } 132 }
123 133
124 bool CastMetricsServiceClient::IsReportingEnabled() { 134 bool CastMetricsServiceClient::IsReportingEnabled() {
125 return PlatformIsReportingEnabled(); 135 return PlatformIsReportingEnabled();
126 } 136 }
127 137
128 } // namespace metrics 138 } // namespace metrics
129 } // namespace chromecast 139 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/common/chromecast_switches.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698