| OLD | NEW |
| 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.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 case PermissionType::MIDI: | 548 case PermissionType::MIDI: |
| 549 case PermissionType::BACKGROUND_SYNC: | 549 case PermissionType::BACKGROUND_SYNC: |
| 550 case PermissionType::NUM: | 550 case PermissionType::NUM: |
| 551 NOTREACHED() << "PERMISSION " | 551 NOTREACHED() << "PERMISSION " |
| 552 << PermissionUtil::GetPermissionString(permission) | 552 << PermissionUtil::GetPermissionString(permission) |
| 553 << " not accounted for"; | 553 << " not accounted for"; |
| 554 } | 554 } |
| 555 } | 555 } |
| 556 | 556 |
| 557 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { | 557 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { |
| 558 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 558 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 559 switches::kEnablePermissionActionReporting)) | 559 switches::kDisablePermissionActionReporting)) { |
| 560 return false; | 560 return false; |
| 561 } |
| 561 | 562 |
| 562 DCHECK(profile); | 563 DCHECK(profile); |
| 563 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) | 564 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) |
| 564 return false; | 565 return false; |
| 565 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) | 566 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) |
| 566 return false; | 567 return false; |
| 567 | 568 |
| 568 ProfileSyncService* profile_sync_service = | 569 ProfileSyncService* profile_sync_service = |
| 569 ProfileSyncServiceFactory::GetForProfile(profile); | 570 ProfileSyncServiceFactory::GetForProfile(profile); |
| 570 | 571 |
| 571 | |
| 572 // Do not report if profile can't get a profile sync service or sync cannot | 572 // Do not report if profile can't get a profile sync service or sync cannot |
| 573 // start. | 573 // start. |
| 574 if (!(profile_sync_service && profile_sync_service->CanSyncStart())) | 574 if (!(profile_sync_service && profile_sync_service->CanSyncStart())) |
| 575 return false; | 575 return false; |
| 576 | 576 |
| 577 // Do not report for users with a Custom passphrase set. We need to wait for | 577 // Do not report for users with a Custom passphrase set. We need to wait for |
| 578 // Sync to be active in order to check the passphrase, so we don't report if | 578 // Sync to be active in order to check the passphrase, so we don't report if |
| 579 // Sync is not active yet. | 579 // Sync is not active yet. |
| 580 if (!profile_sync_service->IsSyncActive() || | 580 if (!profile_sync_service->IsSyncActive() || |
| 581 profile_sync_service->IsUsingSecondaryPassphrase()) { | 581 profile_sync_service->IsUsingSecondaryPassphrase()) { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 if (!deprecated_metric.empty() && rappor_service) { | 682 if (!deprecated_metric.empty() && rappor_service) { |
| 683 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, | 683 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, |
| 684 requesting_origin); | 684 requesting_origin); |
| 685 | 685 |
| 686 std::string rappor_metric = deprecated_metric + "2"; | 686 std::string rappor_metric = deprecated_metric + "2"; |
| 687 rappor_service->RecordSample( | 687 rappor_service->RecordSample( |
| 688 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, | 688 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, |
| 689 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); | 689 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); |
| 690 } | 690 } |
| 691 } | 691 } |
| OLD | NEW |