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

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

Issue 2164513002: Add browsertest for permission action reporting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-hooks-to-permission-layer2
Patch Set: Add gesture test 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"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_request_manager.h ('k') | chrome/browser/safe_browsing/mock_permission_report_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698