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

Side by Side Diff: chrome/browser/android/metrics/uma_session_stats.cc

Issue 2558913003: Restrict transmission of external exp ids to signed in users. (Closed)
Patch Set: Address nit. Created 4 years 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
OLDNEW
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
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.
171 variations::AssociateGoogleVariationIDForceHashes( 174 variations::AssociateGoogleVariationIDForceHashes(
172 variations::GOOGLE_WEB_PROPERTIES, active_group, 175 variations::GOOGLE_WEB_PROPERTIES_SIGNED_IN, active_group,
173 static_cast<variations::VariationID>(experiment_id)); 176 static_cast<variations::VariationID>(experiment_id));
174 group_name_hashes.push_back(active_group.group); 177 group_name_hashes.push_back(active_group.group);
175 } 178 }
176 179
177 UmaSessionStats::RegisterSyntheticMultiGroupFieldTrial(trial_name_utf8, 180 UmaSessionStats::RegisterSyntheticMultiGroupFieldTrial(trial_name_utf8,
178 group_name_hashes); 181 group_name_hashes);
179 } 182 }
180 183
181 static void RegisterSyntheticFieldTrial( 184 static void RegisterSyntheticFieldTrial(
182 JNIEnv* env, 185 JNIEnv* env,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 // We should have only one UmaSessionStats instance. 232 // We should have only one UmaSessionStats instance.
230 DCHECK(!g_uma_session_stats); 233 DCHECK(!g_uma_session_stats);
231 g_uma_session_stats = new UmaSessionStats(); 234 g_uma_session_stats = new UmaSessionStats();
232 return reinterpret_cast<intptr_t>(g_uma_session_stats); 235 return reinterpret_cast<intptr_t>(g_uma_session_stats);
233 } 236 }
234 237
235 // Register native methods 238 // Register native methods
236 bool RegisterUmaSessionStats(JNIEnv* env) { 239 bool RegisterUmaSessionStats(JNIEnv* env) {
237 return RegisterNativesImpl(env); 240 return RegisterNativesImpl(env);
238 } 241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698