| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/android/metrics/uma_session_stats.h" | 5 #include "chrome/browser/android/metrics/uma_session_stats.h" |
| 6 | 6 |
| 7 #include "base/android/jni_array.h" | 7 #include "base/android/jni_array.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 UMA_HISTOGRAM_COUNTS_100("UMA.ExternalExperiment.GroupCount", | 161 UMA_HISTOGRAM_COUNTS_100("UMA.ExternalExperiment.GroupCount", |
| 162 experiment_ids.size()); | 162 experiment_ids.size()); |
| 163 | 163 |
| 164 std::vector<uint32_t> group_name_hashes; | 164 std::vector<uint32_t> group_name_hashes; |
| 165 group_name_hashes.reserve(experiment_ids.size()); | 165 group_name_hashes.reserve(experiment_ids.size()); |
| 166 | 166 |
| 167 variations::ActiveGroupId active_group; | 167 variations::ActiveGroupId active_group; |
| 168 active_group.name = metrics::HashName(trial_name_utf8); | 168 active_group.name = metrics::HashName(trial_name_utf8); |
| 169 for (int experiment_id : experiment_ids) { | 169 for (int experiment_id : experiment_ids) { |
| 170 active_group.group = metrics::HashName(base::IntToString(experiment_id)); | 170 active_group.group = metrics::HashName(base::IntToString(experiment_id)); |
| 171 // Since external experiments are not based on Chrome's low entropy source, | |
| 172 // they are only sent to Google web properties for signed in users to make | |
| 173 // sure that this couldn't be used to identify a user that's not signed in. | |
| 174 variations::AssociateGoogleVariationIDForceHashes( | 171 variations::AssociateGoogleVariationIDForceHashes( |
| 175 variations::GOOGLE_WEB_PROPERTIES_SIGNED_IN, active_group, | 172 variations::GOOGLE_WEB_PROPERTIES, active_group, |
| 176 static_cast<variations::VariationID>(experiment_id)); | 173 static_cast<variations::VariationID>(experiment_id)); |
| 177 group_name_hashes.push_back(active_group.group); | 174 group_name_hashes.push_back(active_group.group); |
| 178 } | 175 } |
| 179 | 176 |
| 180 UmaSessionStats::RegisterSyntheticMultiGroupFieldTrial(trial_name_utf8, | 177 UmaSessionStats::RegisterSyntheticMultiGroupFieldTrial(trial_name_utf8, |
| 181 group_name_hashes); | 178 group_name_hashes); |
| 182 } | 179 } |
| 183 | 180 |
| 184 static void RegisterSyntheticFieldTrial( | 181 static void RegisterSyntheticFieldTrial( |
| 185 JNIEnv* env, | 182 JNIEnv* env, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 // We should have only one UmaSessionStats instance. | 229 // We should have only one UmaSessionStats instance. |
| 233 DCHECK(!g_uma_session_stats); | 230 DCHECK(!g_uma_session_stats); |
| 234 g_uma_session_stats = new UmaSessionStats(); | 231 g_uma_session_stats = new UmaSessionStats(); |
| 235 return reinterpret_cast<intptr_t>(g_uma_session_stats); | 232 return reinterpret_cast<intptr_t>(g_uma_session_stats); |
| 236 } | 233 } |
| 237 | 234 |
| 238 // Register native methods | 235 // Register native methods |
| 239 bool RegisterUmaSessionStats(JNIEnv* env) { | 236 bool RegisterUmaSessionStats(JNIEnv* env) { |
| 240 return RegisterNativesImpl(env); | 237 return RegisterNativesImpl(env); |
| 241 } | 238 } |
| OLD | NEW |