OLD | NEW |
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" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 } | 389 } |
390 | 390 |
391 void PermissionUmaUtil::RecordPermissionAction( | 391 void PermissionUmaUtil::RecordPermissionAction( |
392 PermissionType permission, | 392 PermissionType permission, |
393 PermissionAction action, | 393 PermissionAction action, |
394 PermissionSourceUI source_ui, | 394 PermissionSourceUI source_ui, |
395 PermissionRequestGestureType gesture_type, | 395 PermissionRequestGestureType gesture_type, |
396 const GURL& requesting_origin, | 396 const GURL& requesting_origin, |
397 Profile* profile) { | 397 Profile* profile) { |
398 if (IsOptedIntoPermissionActionReporting(profile)) { | 398 if (IsOptedIntoPermissionActionReporting(profile)) { |
399 // TODO(stefanocs): Add browsertests to make sure the reports are being | |
400 // sent. | |
401 g_browser_process->safe_browsing_service() | 399 g_browser_process->safe_browsing_service() |
402 ->ui_manager() | 400 ->ui_manager() |
403 ->ReportPermissionAction(requesting_origin, permission, action, | 401 ->ReportPermissionAction(requesting_origin, permission, action, |
404 source_ui, gesture_type); | 402 source_ui, gesture_type); |
405 } | 403 } |
406 | 404 |
407 bool secure_origin = content::IsOriginSecure(requesting_origin); | 405 bool secure_origin = content::IsOriginSecure(requesting_origin); |
408 | 406 |
409 switch (permission) { | 407 switch (permission) { |
410 case PermissionType::GEOLOCATION: | 408 case PermissionType::GEOLOCATION: |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 if (!deprecated_metric.empty() && rappor_service) { | 472 if (!deprecated_metric.empty() && rappor_service) { |
475 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 473 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
476 requesting_origin); | 474 requesting_origin); |
477 | 475 |
478 std::string rappor_metric = deprecated_metric + "2"; | 476 std::string rappor_metric = deprecated_metric + "2"; |
479 rappor_service->RecordSample( | 477 rappor_service->RecordSample( |
480 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 478 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
481 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 479 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
482 } | 480 } |
483 } | 481 } |
OLD | NEW |