Chromium Code Reviews| 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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 332 } | 332 } |
| 333 | 333 |
| 334 void PermissionUmaUtil::RecordPermissionAction(PermissionType permission, | 334 void PermissionUmaUtil::RecordPermissionAction(PermissionType permission, |
| 335 PermissionAction action, | 335 PermissionAction action, |
| 336 PermissionSourceUI source_ui, | 336 PermissionSourceUI source_ui, |
| 337 const GURL& requesting_origin, | 337 const GURL& requesting_origin, |
| 338 Profile* profile) { | 338 Profile* profile) { |
| 339 if (IsOptedIntoPermissionActionReporting(profile)) { | 339 if (IsOptedIntoPermissionActionReporting(profile)) { |
| 340 // TODO(stefanocs): Add browsertests to make sure the reports are being | 340 // TODO(stefanocs): Add browsertests to make sure the reports are being |
| 341 // sent. | 341 // sent. |
| 342 // TODO(stefanocs): Get the actual |user_gesture| from permission layer. | |
| 342 g_browser_process->safe_browsing_service() | 343 g_browser_process->safe_browsing_service() |
| 343 ->ui_manager() | 344 ->ui_manager() |
| 344 ->ReportPermissionAction(requesting_origin, permission, action, | 345 ->ReportPermissionAction(requesting_origin, permission, action, |
| 345 source_ui); | 346 source_ui, false); |
|
raymes
2016/07/18 00:31:25
Rather than using a bool, it's probably better to
raymes
2016/07/18 00:35:11
I see most of the other code just uses a bool for
stefanocs
2016/07/18 00:48:07
Done. I was planning on doing this before but I wa
| |
| 346 } | 347 } |
| 347 | 348 |
| 348 bool secure_origin = content::IsOriginSecure(requesting_origin); | 349 bool secure_origin = content::IsOriginSecure(requesting_origin); |
| 349 | 350 |
| 350 switch (permission) { | 351 switch (permission) { |
| 351 case PermissionType::GEOLOCATION: | 352 case PermissionType::GEOLOCATION: |
| 352 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", | 353 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Geolocation", |
| 353 "Permissions.Action.SecureOrigin.Geolocation", | 354 "Permissions.Action.SecureOrigin.Geolocation", |
| 354 "Permissions.Action.InsecureOrigin.Geolocation", | 355 "Permissions.Action.InsecureOrigin.Geolocation", |
| 355 action); | 356 action); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 if (!deprecated_metric.empty() && rappor_service) { | 416 if (!deprecated_metric.empty() && rappor_service) { |
| 416 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 417 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
| 417 requesting_origin); | 418 requesting_origin); |
| 418 | 419 |
| 419 std::string rappor_metric = deprecated_metric + "2"; | 420 std::string rappor_metric = deprecated_metric + "2"; |
| 420 rappor_service->RecordSample( | 421 rappor_service->RecordSample( |
| 421 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 422 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 422 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 423 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
| 423 } | 424 } |
| 424 } | 425 } |
| OLD | NEW |