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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 } | 335 } |
336 | 336 |
337 void PermissionUmaUtil::RecordPermissionAction(PermissionType permission, | 337 void PermissionUmaUtil::RecordPermissionAction(PermissionType permission, |
338 PermissionAction action, | 338 PermissionAction action, |
339 PermissionSourceUI source_ui, | 339 PermissionSourceUI source_ui, |
340 const GURL& requesting_origin, | 340 const GURL& requesting_origin, |
341 Profile* profile) { | 341 Profile* profile) { |
342 if (IsOptedIntoPermissionActionReporting(profile)) { | 342 if (IsOptedIntoPermissionActionReporting(profile)) { |
343 // TODO(stefanocs): Add browsertests to make sure the reports are being | 343 // TODO(stefanocs): Add browsertests to make sure the reports are being |
344 // sent. | 344 // sent. |
| 345 // TODO(stefanocs): Get the actual |user_gesture| from permission layer. |
345 g_browser_process->safe_browsing_service() | 346 g_browser_process->safe_browsing_service() |
346 ->ui_manager() | 347 ->ui_manager() |
347 ->ReportPermissionAction(requesting_origin, permission, action, | 348 ->ReportPermissionAction(requesting_origin, permission, action, |
348 source_ui); | 349 source_ui, false /* user_gesture */); |
349 } | 350 } |
350 | 351 |
351 bool secure_origin = content::IsOriginSecure(requesting_origin); | 352 bool secure_origin = content::IsOriginSecure(requesting_origin); |
352 | 353 |
353 switch (permission) { | 354 switch (permission) { |
354 case PermissionType::GEOLOCATION: | 355 case PermissionType::GEOLOCATION: |
355 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", | 356 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", |
356 "Permissions.Action.SecureOrigin.Geolocation", | 357 "Permissions.Action.SecureOrigin.Geolocation", |
357 "Permissions.Action.InsecureOrigin.Geolocation", | 358 "Permissions.Action.InsecureOrigin.Geolocation", |
358 action); | 359 action); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 if (!deprecated_metric.empty() && rappor_service) { | 419 if (!deprecated_metric.empty() && rappor_service) { |
419 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 420 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
420 requesting_origin); | 421 requesting_origin); |
421 | 422 |
422 std::string rappor_metric = deprecated_metric + "2"; | 423 std::string rappor_metric = deprecated_metric + "2"; |
423 rappor_service->RecordSample( | 424 rappor_service->RecordSample( |
424 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 425 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
425 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 426 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
426 } | 427 } |
427 } | 428 } |
OLD | NEW |