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

Unified Diff: chrome/browser/safe_browsing/permission_reporter.cc

Issue 2073713002: Add field trials and platform to permission report (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@permission-reporter-implementation
Patch Set: Rebase Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/safe_browsing/permission_reporter.cc
diff --git a/chrome/browser/safe_browsing/permission_reporter.cc b/chrome/browser/safe_browsing/permission_reporter.cc
index d0364bcda25efd32910ce1bd1c9ab355edb9ced8..3470a78979fc4610c2f2d1bd53bf8ce99e44a09d 100644
--- a/chrome/browser/safe_browsing/permission_reporter.cc
+++ b/chrome/browser/safe_browsing/permission_reporter.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/safe_browsing/permission_reporter.h"
#include "chrome/common/safe_browsing/permission_report.pb.h"
+#include "components/variations/active_field_trials.h"
#include "content/public/browser/permission_type.h"
#include "net/url_request/report_sender.h"
@@ -103,7 +104,23 @@ bool PermissionReporter::BuildReport(const GURL& origin,
report.set_origin(origin.spec());
report.set_permission(PermissionTypeToPermissionReportPermission(permission));
report.set_action(PermissionActionToPermissionReportAction(action));
- // TODO(stefanocs): Collect other data for the report from global variables.
+// Collect platform data.
+#if defined(OS_ANDROID)
+ report.set_platform_type(PermissionReport::ANDROID_PLATFORM);
+#elif defined(OS_MACOSX) || defined(OS_WIN) || defined(OS_CHROMEOS) || \
+ defined(OS_LINUX)
+ report.set_platform_type(PermissionReport::DESKTOP_PLATFORM);
+#else
+ report.set_platform_type(PermissionReport::PLATFORM_TYPE_UNSPECIFIED);
raymes 2016/06/20 01:32:11 Perhaps add a #error here instead of setting UNSPE
stefanocs 2016/06/21 07:01:01 Done.
+#endif
+ // Collect field trials data.
+ std::vector<variations::ActiveGroupId> active_groups_ids;
+ variations::GetFieldTrialActiveGroupIds(&active_groups_ids);
raymes 2016/06/20 01:32:11 I think Kendra mentioned we may only want to add f
kcarattini 2016/06/20 20:58:17 Hmm, I don't want to bloat the reports with unnece
+ for (auto active_group_id : active_groups_ids) {
+ PermissionReport::FieldTrial* field_trial = report.add_field_trials();
+ field_trial->set_name_id(active_group_id.name);
+ field_trial->set_group_id(active_group_id.group);
+ }
return report.SerializeToString(output);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698