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

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

Issue 2339093002: [HBD] Add Plugins permission type and PermissionContext (Closed)
Patch Set: 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 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.Plugins", action,
674 PERMISSION_ACTION_NUM);
675 break;
664 // The user is not prompted for these permissions, thus there is no 676 // The user is not prompted for these permissions, thus there is no
665 // permission action recorded for them. 677 // permission action recorded for them.
666 case PermissionType::MIDI: 678 case PermissionType::MIDI:
667 case PermissionType::BACKGROUND_SYNC: 679 case PermissionType::BACKGROUND_SYNC:
668 case PermissionType::NUM: 680 case PermissionType::NUM:
669 NOTREACHED() << "PERMISSION " 681 NOTREACHED() << "PERMISSION "
670 << PermissionUtil::GetPermissionString(permission) 682 << PermissionUtil::GetPermissionString(permission)
671 << " not accounted for"; 683 << " not accounted for";
672 } 684 }
673 685
674 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is 686 // Retrieve the name of the RAPPOR metric. Currently, the new metric name is
675 // the deprecated name with "2" on the end, e.g. 687 // the deprecated name with "2" on the end, e.g.
676 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity, 688 // ContentSettings.PermissionActions_Geolocation.Granted.Url2. For simplicity,
677 // we retrieve the deprecated name and append the "2" for the new name. 689 // 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 690 // TODO(dominickn): remove the deprecated metric and replace it solely with
679 // the new one in GetRapporMetric - crbug.com/605836. 691 // the new one in GetRapporMetric - crbug.com/605836.
680 const std::string deprecated_metric = GetRapporMetric(permission, action); 692 const std::string deprecated_metric = GetRapporMetric(permission, action);
681 rappor::RapporService* rappor_service = g_browser_process->rappor_service(); 693 rappor::RapporService* rappor_service = g_browser_process->rappor_service();
682 if (!deprecated_metric.empty() && rappor_service) { 694 if (!deprecated_metric.empty() && rappor_service) {
683 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 695 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
684 requesting_origin); 696 requesting_origin);
685 697
686 std::string rappor_metric = deprecated_metric + "2"; 698 std::string rappor_metric = deprecated_metric + "2";
687 rappor_service->RecordSample( 699 rappor_service->RecordSample(
688 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 700 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
689 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 701 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
690 } 702 }
691 } 703 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698