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

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

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: rebase + blink reformat Created 3 years, 8 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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 "Permissions.Prompt.Accepted.Persisted.AudioCapture", toggle_enabled); 512 "Permissions.Prompt.Accepted.Persisted.AudioCapture", toggle_enabled);
513 break; 513 break;
514 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 514 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
515 UMA_HISTOGRAM_BOOLEAN( 515 UMA_HISTOGRAM_BOOLEAN(
516 "Permissions.Prompt.Accepted.Persisted.VideoCapture", toggle_enabled); 516 "Permissions.Prompt.Accepted.Persisted.VideoCapture", toggle_enabled);
517 break; 517 break;
518 case CONTENT_SETTINGS_TYPE_PLUGINS: 518 case CONTENT_SETTINGS_TYPE_PLUGINS:
519 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Accepted.Persisted.Flash", 519 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Accepted.Persisted.Flash",
520 toggle_enabled); 520 toggle_enabled);
521 break; 521 break;
522
523 case CONTENT_SETTINGS_TYPE_SENSORS:
524 // TODO(riju): when UMA is ready.
525 break;
522 // The user is not prompted for these permissions, thus there is no accept 526 // The user is not prompted for these permissions, thus there is no accept
523 // recorded for them. 527 // recorded for them.
524 default: 528 default:
525 NOTREACHED() << "PERMISSION " 529 NOTREACHED() << "PERMISSION "
526 << PermissionUtil::GetPermissionString(permission) 530 << PermissionUtil::GetPermissionString(permission)
527 << " not accounted for"; 531 << " not accounted for";
528 } 532 }
529 } 533 }
530 534
531 void PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle( 535 void PermissionUmaUtil::PermissionPromptDeniedWithPersistenceToggle(
(...skipping 29 matching lines...) Expand all
561 toggle_enabled); 565 toggle_enabled);
562 break; 566 break;
563 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 567 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
564 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture", 568 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture",
565 toggle_enabled); 569 toggle_enabled);
566 break; 570 break;
567 case CONTENT_SETTINGS_TYPE_PLUGINS: 571 case CONTENT_SETTINGS_TYPE_PLUGINS:
568 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.Flash", 572 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.Flash",
569 toggle_enabled); 573 toggle_enabled);
570 break; 574 break;
575 case CONTENT_SETTINGS_TYPE_SENSORS:
576 // TODO(riju): when UMA is ready.
577 break;
571 // The user is not prompted for these permissions, thus there is no deny 578 // The user is not prompted for these permissions, thus there is no deny
572 // recorded for them. 579 // recorded for them.
573 default: 580 default:
574 NOTREACHED() << "PERMISSION " 581 NOTREACHED() << "PERMISSION "
575 << PermissionUtil::GetPermissionString(permission) 582 << PermissionUtil::GetPermissionString(permission)
576 << " not accounted for"; 583 << " not accounted for";
577 } 584 }
578 } 585 }
579 586
580 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { 587 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 656 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
650 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Notifications", 657 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Notifications",
651 "Permissions.Action.SecureOrigin.Notifications", 658 "Permissions.Action.SecureOrigin.Notifications",
652 "Permissions.Action.InsecureOrigin.Notifications", 659 "Permissions.Action.InsecureOrigin.Notifications",
653 action); 660 action);
654 break; 661 break;
655 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: 662 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX:
656 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.MidiSysEx", action, 663 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.MidiSysEx", action,
657 PermissionAction::NUM); 664 PermissionAction::NUM);
658 break; 665 break;
666 // TODO(riju) : when UMA is ready.
667 case CONTENT_SETTINGS_TYPE_SENSORS:
668 /*
669 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Sensors",
670 "Permissions.Action.SecureOrigin.Sensors",
671 "Permissions.Action.InsecureOrigin.Sensors",
672 action);
673 */
674 break;
659 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: 675 case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING:
660 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.PushMessaging", action, 676 UMA_HISTOGRAM_ENUMERATION("Permissions.Action.PushMessaging", action,
661 PermissionAction::NUM); 677 PermissionAction::NUM);
662 break; 678 break;
663 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: 679 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER:
664 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.ProtectedMedia", 680 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.ProtectedMedia",
665 "Permissions.Action.SecureOrigin.ProtectedMedia", 681 "Permissions.Action.SecureOrigin.ProtectedMedia",
666 "Permissions.Action.InsecureOrigin.ProtectedMedia", 682 "Permissions.Action.InsecureOrigin.ProtectedMedia",
667 action); 683 action);
668 break; 684 break;
(...skipping 24 matching lines...) Expand all
693 709
694 const std::string rappor_metric = GetRapporMetric(permission, action); 710 const std::string rappor_metric = GetRapporMetric(permission, action);
695 rappor::RapporServiceImpl* rappor_service = 711 rappor::RapporServiceImpl* rappor_service =
696 g_browser_process->rappor_service(); 712 g_browser_process->rappor_service();
697 if (!rappor_metric.empty() && rappor_service) { 713 if (!rappor_metric.empty() && rappor_service) {
698 rappor_service->RecordSampleString( 714 rappor_service->RecordSampleString(
699 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 715 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
700 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 716 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
701 } 717 }
702 } 718 }
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