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

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

Issue 2458453002: [sensors] Add Permission guard to the generic sensor apis.
Patch Set: Remove resetPermission + Rebase Created 4 years 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 PermissionType::VIDEO_CAPTURE: 514 case PermissionType::VIDEO_CAPTURE:
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 PermissionType::FLASH: 518 case PermissionType::FLASH:
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 PermissionType::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 case PermissionType::MIDI: 528 case PermissionType::MIDI:
525 case PermissionType::BACKGROUND_SYNC: 529 case PermissionType::BACKGROUND_SYNC:
526 case PermissionType::NUM: 530 case PermissionType::NUM:
527 NOTREACHED() << "PERMISSION " 531 NOTREACHED() << "PERMISSION "
528 << PermissionUtil::GetPermissionString(permission) 532 << PermissionUtil::GetPermissionString(permission)
529 << " not accounted for"; 533 << " not accounted for";
530 } 534 }
531 } 535 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 toggle_enabled); 567 toggle_enabled);
564 break; 568 break;
565 case PermissionType::VIDEO_CAPTURE: 569 case PermissionType::VIDEO_CAPTURE:
566 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture", 570 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.VideoCapture",
567 toggle_enabled); 571 toggle_enabled);
568 break; 572 break;
569 case PermissionType::FLASH: 573 case PermissionType::FLASH:
570 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.Flash", 574 UMA_HISTOGRAM_BOOLEAN("Permissions.Prompt.Denied.Persisted.Flash",
571 toggle_enabled); 575 toggle_enabled);
572 break; 576 break;
577 case PermissionType::SENSORS:
578 // TODO(riju): when UMA is ready.
579 // The user is not prompted for these permissions, thus there is no accept
580 // recorded for them.
581 break;
573 // The user is not prompted for these permissions, thus there is no deny 582 // The user is not prompted for these permissions, thus there is no deny
574 // recorded for them. 583 // recorded for them.
575 case PermissionType::MIDI: 584 case PermissionType::MIDI:
576 case PermissionType::BACKGROUND_SYNC: 585 case PermissionType::BACKGROUND_SYNC:
577 case PermissionType::NUM: 586 case PermissionType::NUM:
578 NOTREACHED() << "PERMISSION " 587 NOTREACHED() << "PERMISSION "
579 << PermissionUtil::GetPermissionString(permission) 588 << PermissionUtil::GetPermissionString(permission)
580 << " not accounted for"; 589 << " not accounted for";
581 } 590 }
582 } 591 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 "Permissions.Action.SecureOrigin.Notifications", 662 "Permissions.Action.SecureOrigin.Notifications",
654 "Permissions.Action.InsecureOrigin.Notifications", 663 "Permissions.Action.InsecureOrigin.Notifications",
655 action); 664 action);
656 break; 665 break;
657 case PermissionType::MIDI_SYSEX: 666 case PermissionType::MIDI_SYSEX:
658 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.MidiSysEx", 667 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.MidiSysEx",
659 "Permissions.Action.SecureOrigin.MidiSysEx", 668 "Permissions.Action.SecureOrigin.MidiSysEx",
660 "Permissions.Action.InsecureOrigin.MidiSysEx", 669 "Permissions.Action.InsecureOrigin.MidiSysEx",
661 action); 670 action);
662 break; 671 break;
672 // TODO(riju) : when UMA is ready.
673 case PermissionType::SENSORS:
674 /*
675 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.Sensors",
676 "Permissions.Action.SecureOrigin.Sensors",
677 "Permissions.Action.InsecureOrigin.Sensors",
678 action);
679 */
680 break;
663 case PermissionType::PUSH_MESSAGING: 681 case PermissionType::PUSH_MESSAGING:
664 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.PushMessaging", 682 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.PushMessaging",
665 "Permissions.Action.SecureOrigin.PushMessaging", 683 "Permissions.Action.SecureOrigin.PushMessaging",
666 "Permissions.Action.InsecureOrigin.PushMessaging", 684 "Permissions.Action.InsecureOrigin.PushMessaging",
667 action); 685 action);
668 break; 686 break;
669 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: 687 case PermissionType::PROTECTED_MEDIA_IDENTIFIER:
670 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.ProtectedMedia", 688 PERMISSION_ACTION_UMA(secure_origin, "Permissions.Action.ProtectedMedia",
671 "Permissions.Action.SecureOrigin.ProtectedMedia", 689 "Permissions.Action.SecureOrigin.ProtectedMedia",
672 "Permissions.Action.InsecureOrigin.ProtectedMedia", 690 "Permissions.Action.InsecureOrigin.ProtectedMedia",
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 if (!deprecated_metric.empty() && rappor_service) { 732 if (!deprecated_metric.empty() && rappor_service) {
715 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 733 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
716 requesting_origin); 734 requesting_origin);
717 735
718 std::string rappor_metric = deprecated_metric + "2"; 736 std::string rappor_metric = deprecated_metric + "2";
719 rappor_service->RecordSample( 737 rappor_service->RecordSample(
720 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 738 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
721 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 739 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
722 } 740 }
723 } 741 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698