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

Side by Side Diff: chrome/browser/permissions/permission_uma_util.cc

Issue 2250893002: Permission Action Reporting: Add num_prior_* fields. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@par-new-fields-proto
Patch Set: Also update browsertest Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/permissions/permission_uma_util.h" 5 #include "chrome/browser/permissions/permission_uma_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
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"
11 #include "base/strings/stringprintf.h" 11 #include "base/strings/stringprintf.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/permissions/permission_decision_auto_blocker.h"
13 #include "chrome/browser/permissions/permission_manager.h" 14 #include "chrome/browser/permissions/permission_manager.h"
14 #include "chrome/browser/permissions/permission_request.h" 15 #include "chrome/browser/permissions/permission_request.h"
15 #include "chrome/browser/permissions/permission_util.h" 16 #include "chrome/browser/permissions/permission_util.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 18 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
18 #include "chrome/browser/safe_browsing/ui_manager.h" 19 #include "chrome/browser/safe_browsing/ui_manager.h"
19 #include "chrome/browser/sync/profile_sync_service_factory.h" 20 #include "chrome/browser/sync/profile_sync_service_factory.h"
20 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/pref_names.h" 22 #include "chrome/common/pref_names.h"
22 #include "components/browser_sync/browser/profile_sync_service.h" 23 #include "components/browser_sync/browser/profile_sync_service.h"
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 481 }
481 482
482 void PermissionUmaUtil::RecordPermissionAction( 483 void PermissionUmaUtil::RecordPermissionAction(
483 PermissionType permission, 484 PermissionType permission,
484 PermissionAction action, 485 PermissionAction action,
485 PermissionSourceUI source_ui, 486 PermissionSourceUI source_ui,
486 PermissionRequestGestureType gesture_type, 487 PermissionRequestGestureType gesture_type,
487 const GURL& requesting_origin, 488 const GURL& requesting_origin,
488 Profile* profile) { 489 Profile* profile) {
489 if (IsOptedIntoPermissionActionReporting(profile)) { 490 if (IsOptedIntoPermissionActionReporting(profile)) {
491 PermissionDecisionAutoBlocker blocker(profile);
490 g_browser_process->safe_browsing_service() 492 g_browser_process->safe_browsing_service()
491 ->ui_manager() 493 ->ui_manager()
492 ->ReportPermissionAction(requesting_origin, permission, action, 494 ->ReportPermissionAction(requesting_origin, permission, action,
493 source_ui, gesture_type); 495 source_ui, gesture_type,
496 blocker.GetDismissCount(requesting_origin, permission),
497 blocker.GetIgnoreCount(requesting_origin, permission));
494 } 498 }
495 499
496 bool secure_origin = content::IsOriginSecure(requesting_origin); 500 bool secure_origin = content::IsOriginSecure(requesting_origin);
497 501
498 switch (permission) { 502 switch (permission) {
499 case PermissionType::GEOLOCATION: 503 case PermissionType::GEOLOCATION:
500 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", 504 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation",
501 "Permissions.Action.SecureOrigin.Geolocation", 505 "Permissions.Action.SecureOrigin.Geolocation",
502 "Permissions.Action.InsecureOrigin.Geolocation", 506 "Permissions.Action.InsecureOrigin.Geolocation",
503 action); 507 action);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 if (!deprecated_metric.empty() && rappor_service) { 567 if (!deprecated_metric.empty() && rappor_service) {
564 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 568 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
565 requesting_origin); 569 requesting_origin);
566 570
567 std::string rappor_metric = deprecated_metric + "2"; 571 std::string rappor_metric = deprecated_metric + "2";
568 rappor_service->RecordSample( 572 rappor_service->RecordSample(
569 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 573 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
570 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 574 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
571 } 575 }
572 } 576 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698