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

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

Issue 2069343002: Pass profile to PermissionUmaUtil::PermissionIgnored (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add-hooks-to-permission-layer
Patch Set: merge Created 4 years, 5 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
« no previous file with comments | « chrome/browser/permissions/permission_request_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 DCHECK(requests.size() == 1); 293 DCHECK(requests.size() == 1);
294 294
295 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied, 295 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied,
296 requests[0]->GetPermissionRequestType()); 296 requests[0]->GetPermissionRequestType());
297 } 297 }
298 298
299 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { 299 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) {
300 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 300 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
301 switches::kEnablePermissionActionReporting)) 301 switches::kEnablePermissionActionReporting))
302 return false; 302 return false;
303 // TODO(stefanocs): Remove this check once all callsites have been updated 303
304 // to not pass a nullptr. 304 DCHECK(profile);
305 if (!profile)
306 return false;
307 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) 305 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE)
308 return false; 306 return false;
309 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) 307 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled))
310 return false; 308 return false;
311 309
312 ProfileSyncService* profile_sync_service = 310 ProfileSyncService* profile_sync_service =
313 ProfileSyncServiceFactory::GetForProfile(profile); 311 ProfileSyncServiceFactory::GetForProfile(profile);
314 312
315 // Do not report if profile can't get a profile sync service due to disable 313 // Do not report if profile can't get a profile sync service due to disable
316 // sync flag. 314 // sync flag.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 if (!deprecated_metric.empty() && rappor_service) { 410 if (!deprecated_metric.empty() && rappor_service) {
413 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 411 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
414 requesting_origin); 412 requesting_origin);
415 413
416 std::string rappor_metric = deprecated_metric + "2"; 414 std::string rappor_metric = deprecated_metric + "2";
417 rappor_service->RecordSample( 415 rappor_service->RecordSample(
418 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 416 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
419 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 417 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
420 } 418 }
421 } 419 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_request_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698