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

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

Issue 2339093002: [HBD] Add Plugins permission type and PermissionContext (Closed)
Patch Set: [HBD] Add Plugins permission type and PermissionContext Created 4 years, 3 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 toggle_enabled); 489 toggle_enabled);
490 break; 490 break;
491 case PermissionType::AUDIO_CAPTURE: 491 case PermissionType::AUDIO_CAPTURE:
492 UMA_HISTOGRAM_BOOLEAN( 492 UMA_HISTOGRAM_BOOLEAN(
493 "Permissions.Prompt.Accepted.Persisted.AudioCapture", toggle_enabled); 493 "Permissions.Prompt.Accepted.Persisted.AudioCapture", toggle_enabled);
494 break; 494 break;
495 case PermissionType::VIDEO_CAPTURE: 495 case PermissionType::VIDEO_CAPTURE:
496 UMA_HISTOGRAM_BOOLEAN( 496 UMA_HISTOGRAM_BOOLEAN(
497 "Permissions.Prompt.Accepted.Persisted.VideoCapture", toggle_enabled); 497 "Permissions.Prompt.Accepted.Persisted.VideoCapture", toggle_enabled);
498 break; 498 break;
499 case PermissionType::PLUGINS:
500 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Accepted.Persisted.Plugins",
501 toggle_enabled);
502 break;
499 // The user is not prompted for these permissions, thus there is no accept 503 // The user is not prompted for these permissions, thus there is no accept
500 // recorded for them. 504 // recorded for them.
501 case PermissionType::MIDI: 505 case PermissionType::MIDI:
502 case PermissionType::BACKGROUND_SYNC: 506 case PermissionType::BACKGROUND_SYNC:
503 case PermissionType::NUM: 507 case PermissionType::NUM:
504 NOTREACHED() << "PERMISSION " 508 NOTREACHED() << "PERMISSION "
505 << PermissionUtil::GetPermissionString(permission) 509 << PermissionUtil::GetPermissionString(permission)
506 << " not accounted for"; 510 << " not accounted for";
507 } 511 }
508 } 512 }
(...skipping 27 matching lines...) Expand all
536 "Permissions.Prompt.Denied.Persisted.DurableStorage", toggle_enabled); 540 "Permissions.Prompt.Denied.Persisted.DurableStorage", toggle_enabled);
537 break; 541 break;
538 case PermissionType::AUDIO_CAPTURE: 542 case PermissionType::AUDIO_CAPTURE:
539 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.AudioCapture", 543 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.AudioCapture",
540 toggle_enabled); 544 toggle_enabled);
541 break; 545 break;
542 case PermissionType::VIDEO_CAPTURE: 546 case PermissionType::VIDEO_CAPTURE:
543 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture", 547 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture",
544 toggle_enabled); 548 toggle_enabled);
545 break; 549 break;
550 case PermissionType::PLUGINS:
551 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.Plugins",
552 toggle_enabled);
553 break;
546 // The user is not prompted for these permissions, thus there is no deny 554 // The user is not prompted for these permissions, thus there is no deny
547 // recorded for them. 555 // recorded for them.
548 case PermissionType::MIDI: 556 case PermissionType::MIDI:
549 case PermissionType::BACKGROUND_SYNC: 557 case PermissionType::BACKGROUND_SYNC:
550 case PermissionType::NUM: 558 case PermissionType::NUM:
551 NOTREACHED() << "PERMISSION " 559 NOTREACHED() << "PERMISSION "
552 << PermissionUtil::GetPermissionString(permission) 560 << PermissionUtil::GetPermissionString(permission)
553 << " not accounted for"; 561 << " not accounted for";
554 } 562 }
555 } 563 }
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 case PermissionType::AUDIO_CAPTURE: 662 case PermissionType::AUDIO_CAPTURE:
655 // Media permissions are disabled on insecure origins, so there's no 663 // Media permissions are disabled on insecure origins, so there's no
656 // need to record metrics for secure/insecue. 664 // need to record metrics for secure/insecue.
657 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.AudioCapture", action, 665 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.AudioCapture", action,
658 PERMISSION_ACTION_NUM); 666 PERMISSION_ACTION_NUM);
659 break; 667 break;
660 case PermissionType::VIDEO_CAPTURE: 668 case PermissionType::VIDEO_CAPTURE:
661 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.VideoCapture", action, 669 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.VideoCapture", action,
662 PERMISSION_ACTION_NUM); 670 PERMISSION_ACTION_NUM);
663 break; 671 break;
672 case PermissionType::PLUGINS:
673 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Plugins",
674 "Permissions.Action.SecureOrigin.Plugins",
675 "Permissions.Action.InsecureOrigin.Plugins",
676 action);
677 break;
664 // The user is not prompted for these permissions, thus there is no 678 // The user is not prompted for these permissions, thus there is no
665 // permission action recorded for them. 679 // permission action recorded for them.
666 case PermissionType::MIDI: 680 case PermissionType::MIDI:
667 case PermissionType::BACKGROUND_SYNC: 681 case PermissionType::BACKGROUND_SYNC:
668 case PermissionType::NUM: 682 case PermissionType::NUM:
669 NOTREACHED() << "PERMISSION " 683 NOTREACHED() << "PERMISSION "
670 << PermissionUtil::GetPermissionString(permission) 684 << PermissionUtil::GetPermissionString(permission)
671 << " not accounted for"; 685 << " not accounted for";
672 } 686 }
673 687
674 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is 688 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is
675 // the deprecated name with "2" on the end, e.g. 689 // the deprecated name with "2" on the end, e.g.
676 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity, 690 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity,
677 // we retrieve the deprecated name and append the "2" for the new name. 691 // we retrieve the deprecated name and append the "2" for the new name.
678 // TODO(dominickn): remove the deprecated metric and replace it solely with 692 // TODO(dominickn): remove the deprecated metric and replace it solely with
679 // the new one in GetRapporMetric - crbug.com/605836. 693 // the new one in GetRapporMetric - crbug.com/605836.
680 const std::string deprecated_metric = GetRapporMetric(permission, action); 694 const std::string deprecated_metric = GetRapporMetric(permission, action);
681 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); 695 rappor::RapporService* rappor_service = g_browser_process->rappor_service();
682 if (!deprecated_metric.empty() && rappor_service) { 696 if (!deprecated_metric.empty() && rappor_service) {
683 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 697 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
684 requesting_origin); 698 requesting_origin);
685 699
686 std::string rappor_metric = deprecated_metric + "2"; 700 std::string rappor_metric = deprecated_metric + "2";
687 rappor_service->RecordSample( 701 rappor_service->RecordSample(
688 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 702 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
689 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 703 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
690 } 704 }
691 } 705 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_request_impl.cc ('k') | chrome/browser/permissions/permission_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698