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

Unified Diff: chrome/browser/mac/keystone_glue.mm

Issue 593243002: Profile_Metrics integration with Keystone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove separate attribute header; refactor setActive methods. Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/mac/keystone_glue.mm
diff --git a/chrome/browser/mac/keystone_glue.mm b/chrome/browser/mac/keystone_glue.mm
index 2f0f19cddbd6e0d7a801f4b93d0d53f1808756a0..c996cc1fad96edbcc7ad4db7e95d245455784f4f 100644
--- a/chrome/browser/mac/keystone_glue.mm
+++ b/chrome/browser/mac/keystone_glue.mm
@@ -119,6 +119,9 @@ class PerformBridge : public base::RefCountedThreadSafe<PerformBridge> {
// Called when Keystone registration completes.
- (void)registrationComplete:(NSNotification*)notification;
+// Set the registration active and pass profile count parameters.
+- (void)setRegistrationActive;
+
// Called periodically to announce activity by pinging the Keystone server.
- (void)markActive:(NSTimer*)timer;
@@ -491,6 +494,43 @@ NSString* const kVersionKey = @"KSVersion";
nil];
}
+- (void)setRegistrationActive {
+ if (numProfiles_ == 0) {
+ [registration_ setActive];
Mark Mentovai 2014/10/09 21:26:20 What’s the point of this? Why wouldn’t we want to
Mike Lerman 2014/10/10 15:32:29 There should never be zero profiles - that's inval
+ return;
+ }
+
+ NSError* reportingError = nil;
+ KSUnsignedReportingAttribute* numProfilesAttribute =
+ [KSUnsignedReportingAttribute
+ reportingAttributeWithValue:numProfiles_
+ name:@"_NumAccounts"
+ aggregationType:kKSReportingAggregationSum
+ error:&reportingError];
+ if (reportingError != nil)
+ VLOG(INFO) << [reportingError localizedDescription];
Mark Mentovai 2014/10/09 21:26:20 What is VLOG(INFO)? VLOG() takes an integer argume
Mike Lerman 2014/10/10 15:32:29 I suppose so! VLOG and LOG should have a similar i
+
+ reportingError = nil;
+ KSUnsignedReportingAttribute* numSignedInProfilesAttribute =
+ [KSUnsignedReportingAttribute
+ reportingAttributeWithValue:numSignedInProfiles_
+ name:@"_NumSignedIn"
+ aggregationType:kKSReportingAggregationSum
+ error:&reportingError];
+ if (reportingError != nil)
+ VLOG(INFO) << [reportingError localizedDescription];
+
+ NSArray* profileCountsInformation =
+ [NSArray arrayWithObjects:numProfilesAttribute,
+ numSignedInProfilesAttribute,
+ nil];
+
+ reportingError = nil;
+ if (![registration_ setActiveWithReportingAttributes:profileCountsInformation
+ error:&reportingError])
+ VLOG(INFO) << [reportingError localizedDescription];
+}
+
- (void)registerWithKeystone {
[self updateStatus:kAutoupdateRegistering version:nil];
@@ -512,13 +552,13 @@ NSString* const kVersionKey = @"KSVersion";
// posted, and -registrationComplete: will be called.
// Mark an active RIGHT NOW; don't wait an hour for the first one.
- [registration_ setActive];
+ [self setRegistrationActive];
// Set up hourly activity pings.
timer_ = [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour
target:self
selector:@selector(markActive:)
- userInfo:registration_
+ userInfo:nil
repeats:YES];
}
@@ -541,8 +581,7 @@ NSString* const kVersionKey = @"KSVersion";
}
- (void)markActive:(NSTimer*)timer {
- KSRegistration* ksr = [timer userInfo];
- [ksr setActive];
+ [self setRegistrationActive];
}
- (void)checkForUpdate {
@@ -1049,6 +1088,13 @@ NSString* const kVersionKey = @"KSVersion";
return tagSuffix;
}
+
+- (void)updateProfileCountsWithNumProfiles:(uint32_t)numProfiles
+ numSignedInProfiles:(uint32_t)numSignedInProfiles {
+ numProfiles_ = numProfiles;
+ numSignedInProfiles_ = numSignedInProfiles;
+}
+
@end // @implementation KeystoneGlue
namespace {

Powered by Google App Engine
This is Rietveld 408576698