Index: chrome/browser/android/most_visited_sites.cc |
diff --git a/chrome/browser/android/most_visited_sites.cc b/chrome/browser/android/most_visited_sites.cc |
index 5eda3f36fa71b09f5ec6c82af16507cb240cd7d6..16aed52297656e67f8d3885362bbe3726f857b8c 100644 |
--- a/chrome/browser/android/most_visited_sites.cc |
+++ b/chrome/browser/android/most_visited_sites.cc |
@@ -58,6 +58,8 @@ const char kNumEmptyTilesHistogramName[] = "NewTabPage.NumberOfGrayTiles"; |
const char kNumServerTilesHistogramName[] = "NewTabPage.NumberOfExternalTiles"; |
// Client suggestion opened. |
const char kOpenedItemClientHistogramName[] = "NewTabPage.MostVisited.client"; |
+// Control group suggestion opened. |
+const char kOpenedItemControlHistogramName[] = "NewTabPage.MostVisited.client0"; |
// Server suggestion opened, no provider. |
const char kOpenedItemServerHistogramName[] = "NewTabPage.MostVisited.server"; |
// Server suggestion opened with provider. |
@@ -66,6 +68,9 @@ const char kOpenedItemServerProviderHistogramFormat[] = |
// Client impression. |
const char kImpressionClientHistogramName[] = |
"NewTabPage.SuggestionsImpression.client"; |
+// Control group impression. |
+const char kImpressionControlHistogramName[] = |
+ "NewTabPage.SuggestionsImpression.client0"; |
// Server suggestion impression, no provider. |
const char kImpressionServerHistogramName[] = |
"NewTabPage.SuggestionsImpression.server"; |
@@ -168,8 +173,9 @@ void LogHistogramEvent(const std::string& histogram, int position, |
} // namespace |
MostVisitedSites::MostVisitedSites(Profile* profile) |
- : profile_(profile), num_sites_(0), num_local_thumbs_(0), |
- num_server_thumbs_(0), num_empty_thumbs_(0), weak_ptr_factory_(this) { |
+ : profile_(profile), num_sites_(0), is_control_group_(false), |
+ num_local_thumbs_(0), num_server_thumbs_(0), num_empty_thumbs_(0), |
+ weak_ptr_factory_(this) { |
// Register the debugging page for the Suggestions Service and the thumbnails |
// debugging page. |
content::URLDataSource::Add(profile_, |
@@ -278,7 +284,9 @@ void MostVisitedSites::RecordOpenedMostVisitedItem(JNIEnv* env, |
jint index) { |
switch (mv_source_) { |
case TOP_SITES: { |
- UMA_HISTOGRAM_SPARSE_SLOWLY(kOpenedItemClientHistogramName, index); |
+ const std::string histogram = is_control_group_ ? |
+ kOpenedItemControlHistogramName : kOpenedItemClientHistogramName; |
+ LogHistogramEvent(histogram, index, num_sites_); |
break; |
} |
case SUGGESTIONS_SERVICE: { |
@@ -354,8 +362,10 @@ void MostVisitedSites::OnMostVisitedURLsAvailable( |
int num_tiles = urls.size(); |
UMA_HISTOGRAM_SPARSE_SLOWLY(kNumTilesHistogramName, num_tiles); |
+ const std::string histogram = is_control_group_ ? |
+ kImpressionControlHistogramName : kImpressionClientHistogramName; |
for (int i = 0; i < num_tiles; ++i) { |
- UMA_HISTOGRAM_SPARSE_SLOWLY(kImpressionClientHistogramName, i); |
+ LogHistogramEvent(histogram, i, num_sites_); |
} |
JNIEnv* env = AttachCurrentThread(); |
@@ -370,8 +380,14 @@ void MostVisitedSites::OnSuggestionsProfileAvailable( |
ScopedJavaGlobalRef<jobject>* j_observer, |
const SuggestionsProfile& suggestions_profile) { |
int size = suggestions_profile.suggestions_size(); |
- if (size == 0) { |
- // No suggestions data available, initiate Top Sites query. |
+ |
+ // Determine if the user is in a control group (they would have received |
+ // suggestions, but are in a group where they shouldn't). |
+ is_control_group_ = size && SuggestionsService::IsControlGroup(); |
+ |
+ // If no suggestions data is available or the user is in a control group, |
+ // initiate Top Sites query. |
+ if (is_control_group_ || !size) { |
InitiateTopSitesQuery(); |
return; |
} |