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 "components/rappor/rappor_service.h" | 5 #include "components/rappor/rappor_service.h" |
6 | 6 |
7 #include "base/base64.h" | 7 #include "base/base64.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/prefs/pref_registry_simple.h" | 9 #include "base/prefs/pref_registry_simple.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const int kLogIntervalSeconds = 30 * 60; | 28 const int kLogIntervalSeconds = 30 * 60; |
29 | 29 |
30 const char kMimeType[] = "application/vnd.chrome.rappor"; | 30 const char kMimeType[] = "application/vnd.chrome.rappor"; |
31 | 31 |
32 // Constants for the RAPPOR rollout field trial. | 32 // Constants for the RAPPOR rollout field trial. |
33 const char kRapporRolloutFieldTrialName[] = "RapporRollout"; | 33 const char kRapporRolloutFieldTrialName[] = "RapporRollout"; |
34 | 34 |
35 // Constant for the finch parameter name for the server URL | 35 // Constant for the finch parameter name for the server URL |
36 const char kRapporRolloutServerUrlParam[] = "ServerUrl"; | 36 const char kRapporRolloutServerUrlParam[] = "ServerUrl"; |
37 | 37 |
| 38 // The rappor server's URL. |
| 39 const char kDefaultServerUrl[] = "https://clients4.google.com/rappor"; |
| 40 |
38 GURL GetServerUrl() { | 41 GURL GetServerUrl() { |
39 return GURL(chrome_variations::GetVariationParamValue( | 42 std::string server_url = chrome_variations::GetVariationParamValue( |
40 kRapporRolloutFieldTrialName, | 43 kRapporRolloutFieldTrialName, |
41 kRapporRolloutServerUrlParam)); | 44 kRapporRolloutServerUrlParam); |
| 45 if (!server_url.empty()) |
| 46 return GURL(server_url); |
| 47 else |
| 48 return GURL(kDefaultServerUrl); |
42 } | 49 } |
43 | 50 |
44 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { | 51 const RapporParameters kRapporParametersForType[NUM_RAPPOR_TYPES] = { |
45 // ETLD_PLUS_ONE_RAPPOR_TYPE | 52 // ETLD_PLUS_ONE_RAPPOR_TYPE |
46 {128 /* Num cohorts */, | 53 {128 /* Num cohorts */, |
47 16 /* Bloom filter size bytes */, | 54 16 /* Bloom filter size bytes */, |
48 2 /* Bloom filter hash count */, | 55 2 /* Bloom filter hash count */, |
49 rappor::PROBABILITY_50 /* Fake data probability */, | 56 rappor::PROBABILITY_50 /* Fake data probability */, |
50 rappor::PROBABILITY_50 /* Fake one probability */, | 57 rappor::PROBABILITY_50 /* Fake one probability */, |
51 rappor::PROBABILITY_75 /* One coin probability */, | 58 rappor::PROBABILITY_75 /* One coin probability */, |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 DCHECK_EQ(parameters.ToString(), metric->parameters().ToString()); | 191 DCHECK_EQ(parameters.ToString(), metric->parameters().ToString()); |
185 return metric; | 192 return metric; |
186 } | 193 } |
187 | 194 |
188 RapporMetric* new_metric = new RapporMetric(metric_name, parameters, cohort_); | 195 RapporMetric* new_metric = new RapporMetric(metric_name, parameters, cohort_); |
189 metrics_map_[metric_name] = new_metric; | 196 metrics_map_[metric_name] = new_metric; |
190 return new_metric; | 197 return new_metric; |
191 } | 198 } |
192 | 199 |
193 } // namespace rappor | 200 } // namespace rappor |
OLD | NEW |