OLD | NEW |
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/client_info.h" | 12 #include "components/metrics/client_info.h" |
11 #include "components/metrics/metrics_provider.h" | 13 #include "components/metrics/metrics_provider.h" |
12 #include "components/metrics/metrics_service.h" | 14 #include "components/metrics/metrics_service.h" |
13 #include "components/metrics/metrics_state_manager.h" | 15 #include "components/metrics/metrics_state_manager.h" |
14 #include "components/metrics/net/net_metrics_log_uploader.h" | 16 #include "components/metrics/net/net_metrics_log_uploader.h" |
15 | 17 |
16 namespace chromecast { | 18 namespace chromecast { |
17 namespace metrics { | 19 namespace metrics { |
18 | 20 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 void CastMetricsServiceClient::CollectFinalMetrics( | 76 void CastMetricsServiceClient::CollectFinalMetrics( |
75 const base::Closure& done_callback) { | 77 const base::Closure& done_callback) { |
76 done_callback.Run(); | 78 done_callback.Run(); |
77 } | 79 } |
78 | 80 |
79 scoped_ptr< ::metrics::MetricsLogUploader> | 81 scoped_ptr< ::metrics::MetricsLogUploader> |
80 CastMetricsServiceClient::CreateUploader( | 82 CastMetricsServiceClient::CreateUploader( |
81 const std::string& server_url, | 83 const std::string& server_url, |
82 const std::string& mime_type, | 84 const std::string& mime_type, |
83 const base::Callback<void(int)>& on_upload_complete) { | 85 const base::Callback<void(int)>& on_upload_complete) { |
| 86 std::string uma_server_url(server_url); |
| 87 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 88 if (command_line->HasSwitch(switches::kOverrideMetricsUploadUrl)) { |
| 89 uma_server_url.assign( |
| 90 command_line->GetSwitchValueASCII(switches::kOverrideMetricsUploadUrl)); |
| 91 } |
| 92 DCHECK(!uma_server_url.empty()); |
84 return scoped_ptr< ::metrics::MetricsLogUploader>( | 93 return scoped_ptr< ::metrics::MetricsLogUploader>( |
85 new ::metrics::NetMetricsLogUploader( | 94 new ::metrics::NetMetricsLogUploader( |
86 request_context_, | 95 request_context_, |
87 server_url, | 96 uma_server_url, |
88 mime_type, | 97 mime_type, |
89 on_upload_complete)); | 98 on_upload_complete)); |
90 } | 99 } |
91 | 100 |
92 void CastMetricsServiceClient::EnableMetricsService(bool enabled) { | 101 void CastMetricsServiceClient::EnableMetricsService(bool enabled) { |
93 if (enabled) { | 102 if (enabled) { |
94 metrics_service_->Start(); | 103 metrics_service_->Start(); |
95 } else { | 104 } else { |
96 metrics_service_->Stop(); | 105 metrics_service_->Stop(); |
97 } | 106 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 141 |
133 CastMetricsServiceClient::~CastMetricsServiceClient() { | 142 CastMetricsServiceClient::~CastMetricsServiceClient() { |
134 } | 143 } |
135 | 144 |
136 bool CastMetricsServiceClient::IsReportingEnabled() { | 145 bool CastMetricsServiceClient::IsReportingEnabled() { |
137 return PlatformIsReportingEnabled(); | 146 return PlatformIsReportingEnabled(); |
138 } | 147 } |
139 | 148 |
140 } // namespace metrics | 149 } // namespace metrics |
141 } // namespace chromecast | 150 } // namespace chromecast |
OLD | NEW |