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

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

Issue 2220323002: Permission Action Reporting: Do not report for Custom Passphrase users. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 4 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 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 553
554 DCHECK(profile); 554 DCHECK(profile);
555 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) 555 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE)
556 return false; 556 return false;
557 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) 557 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled))
558 return false; 558 return false;
559 559
560 ProfileSyncService* profile_sync_service = 560 ProfileSyncService* profile_sync_service =
561 ProfileSyncServiceFactory::GetForProfile(profile); 561 ProfileSyncServiceFactory::GetForProfile(profile);
562 562
563 // Do not report if profile can't get a profile sync service due to disable 563
564 // sync flag. 564 // Do not report if profile can't get a profile sync service or sync cannot
565 if (!profile_sync_service) 565 // start.
566 if (!(profile_sync_service && profile_sync_service->CanSyncStart()))
566 return false; 567 return false;
567 568
568 if (!profile_sync_service->CanSyncStart()) 569 // Do not report for users with a Custom passphrase set. We need to wait for
570 // Sync to be active in order to check the passphrase, so we don't report if
571 // Sync is not active yet.
572 if (!profile_sync_service->IsSyncActive() ||
573 profile_sync_service->IsUsingSecondaryPassphrase()) {
569 return false; 574 return false;
575 }
570 576
571 syncer::ModelTypeSet preferred_data_types = 577 syncer::ModelTypeSet preferred_data_types =
572 profile_sync_service->GetPreferredDataTypes(); 578 profile_sync_service->GetPreferredDataTypes();
573 if (!preferred_data_types.Has(syncer::PROXY_TABS)) 579 if (!(preferred_data_types.Has(syncer::PROXY_TABS) &&
580 preferred_data_types.Has(syncer::PRIORITY_PREFERENCES))) {
574 return false; 581 return false;
575 if (!preferred_data_types.Has(syncer::PRIORITY_PREFERENCES)) 582 }
576 return false;
577 583
578 return true; 584 return true;
579 } 585 }
580 586
581 void PermissionUmaUtil::RecordPermissionAction( 587 void PermissionUmaUtil::RecordPermissionAction(
582 PermissionType permission, 588 PermissionType permission,
583 PermissionAction action, 589 PermissionAction action,
584 PermissionSourceUI source_ui, 590 PermissionSourceUI source_ui,
585 PermissionRequestGestureType gesture_type, 591 PermissionRequestGestureType gesture_type,
586 const GURL& requesting_origin, 592 const GURL& requesting_origin,
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 if (!deprecated_metric.empty() && rappor_service) { 672 if (!deprecated_metric.empty() && rappor_service) {
667 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 673 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
668 requesting_origin); 674 requesting_origin);
669 675
670 std::string rappor_metric = deprecated_metric + "2"; 676 std::string rappor_metric = deprecated_metric + "2";
671 rappor_service->RecordSample( 677 rappor_service->RecordSample(
672 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 678 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
673 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 679 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
674 } 680 }
675 } 681 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698