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

Unified Diff: chrome/browser/ui/webui/snippets_internals_message_handler.cc

Issue 2826013002: List relevant IDs from Finch in snippets-internals (Closed)
Patch Set: rebase Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/snippets_internals_message_handler.cc
diff --git a/chrome/browser/ui/webui/snippets_internals_message_handler.cc b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
index 3c1b7eee118d0b202458fd2f351faf9e609dcf9e..9b3d770447bb1d81ebf1a370f5383de575646072 100644
--- a/chrome/browser/ui/webui/snippets_internals_message_handler.cc
+++ b/chrome/browser/ui/webui/snippets_internals_message_handler.cc
@@ -16,9 +16,11 @@
#include "base/i18n/time_formatting.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
+#include "base/metrics/field_trial.h"
#include "base/optional.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
+#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
@@ -35,6 +37,7 @@
#include "components/ntp_snippets/switches.h"
#include "components/offline_pages/core/offline_page_feature.h"
#include "components/prefs/pref_service.h"
+#include "components/variations/variations_associated_data.h"
#include "content/public/browser/web_ui.h"
using ntp_snippets::ContentSuggestion;
@@ -120,6 +123,31 @@ std::string GetCategoryStatusName(CategoryStatus status) {
return std::string();
}
+std::set<variations::VariationID> SnippetsExperiments() {
+ std::set<variations::VariationID> result;
+ for (const base::Feature* const* feature = ntp_snippets::kAllFeatures;
+ *feature; ++feature) {
+ base::FieldTrial* trial = base::FeatureList::GetFieldTrial(**feature);
+ if (!trial) {
+ continue;
+ }
+ if (trial->GetGroupNameWithoutActivation().empty()) {
+ continue;
+ }
+ for (variations::IDCollectionKey key :
+ {variations::GOOGLE_WEB_PROPERTIES,
+ variations::GOOGLE_WEB_PROPERTIES_SIGNED_IN,
+ variations::GOOGLE_WEB_PROPERTIES_TRIGGER}) {
+ const variations::VariationID id = variations::GetGoogleVariationID(
+ key, trial->trial_name(), trial->group_name());
+ if (id != variations::EMPTY_ID) {
+ result.insert(id);
+ }
+ }
+ }
+ return result;
+}
+
} // namespace
SnippetsInternalsMessageHandler::SnippetsInternalsMessageHandler(
@@ -358,6 +386,13 @@ void SnippetsInternalsMessageHandler::SendAllContent() {
base::Value(fetcher->last_json()));
}
+ std::set<variations::VariationID> ids = SnippetsExperiments();
+ std::vector<std::string> string_ids;
+ for (auto id : ids) {
+ string_ids.push_back(base::IntToString(id));
+ }
+ SendString("experiment-ids", base::JoinString(string_ids, ", "));
+
SendContentSuggestions();
}
« no previous file with comments | « chrome/browser/resources/snippets_internals.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698