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

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: Rebase 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_queue_controller.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 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 DCHECK(requests.size() == 1); 292 DCHECK(requests.size() == 1);
293 293
294 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied, 294 PERMISSION_BUBBLE_TYPE_UMA(kPermissionsPromptDenied,
295 requests[0]->GetPermissionBubbleType()); 295 requests[0]->GetPermissionBubbleType());
296 } 296 }
297 297
298 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) { 298 bool PermissionUmaUtil::IsOptedIntoPermissionActionReporting(Profile* profile) {
299 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 299 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
300 switches::kEnablePermissionActionReporting)) 300 switches::kEnablePermissionActionReporting))
301 return false; 301 return false;
302 // TODO(stefanocs): Remove this check once all callsites have been updated
303 // to not pass a nullptr.
304 if (!profile)
timvolodine 2016/07/20 18:19:58 should there be DCHECK(profile) now?
305 return false;
306 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE) 302 if (profile->GetProfileType() == Profile::INCOGNITO_PROFILE)
307 return false; 303 return false;
308 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled)) 304 if (!profile->GetPrefs()->GetBoolean(prefs::kSafeBrowsingEnabled))
309 return false; 305 return false;
310 306
311 ProfileSyncService* profile_sync_service = 307 ProfileSyncService* profile_sync_service =
312 ProfileSyncServiceFactory::GetForProfile(profile); 308 ProfileSyncServiceFactory::GetForProfile(profile);
313 309
314 // Do not report if profile can't get a profile sync service due to disable 310 // Do not report if profile can't get a profile sync service due to disable
315 // sync flag. 311 // sync flag.
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 if (!deprecated_metric.empty() && rappor_service) { 407 if (!deprecated_metric.empty() && rappor_service) {
412 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric, 408 rappor::SampleDomainAndRegistryFromGURL(rappor_service, deprecated_metric,
413 requesting_origin); 409 requesting_origin);
414 410
415 std::string rappor_metric = deprecated_metric + "2"; 411 std::string rappor_metric = deprecated_metric + "2";
416 rappor_service->RecordSample( 412 rappor_service->RecordSample(
417 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE, 413 rappor_metric, rappor::LOW_FREQUENCY_ETLD_PLUS_ONE_RAPPOR_TYPE,
418 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin)); 414 rappor::GetDomainAndRegistrySampleFromGURL(requesting_origin));
419 } 415 }
420 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/permission_queue_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698