OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ | 5 #ifndef CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ |
6 #define CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ | 6 #define CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 #include <Security/Authorization.h> | 9 #include <Security/Authorization.h> |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 extern NSString* KSRegistrationStartUpdateNotification; | 46 extern NSString* KSRegistrationStartUpdateNotification; |
47 extern NSString* KSUpdateCheckSuccessfulKey; | 47 extern NSString* KSUpdateCheckSuccessfulKey; |
48 extern NSString* KSUpdateCheckSuccessfullyInstalledKey; | 48 extern NSString* KSUpdateCheckSuccessfullyInstalledKey; |
49 | 49 |
50 extern NSString* KSRegistrationRemoveExistingTag; | 50 extern NSString* KSRegistrationRemoveExistingTag; |
51 #define KSRegistrationPreserveExistingTag nil | 51 #define KSRegistrationPreserveExistingTag nil |
52 | 52 |
53 } // namespace keystone_registration | 53 } // namespace keystone_registration |
54 | 54 |
| 55 typedef enum { |
| 56 kKSReportingAggregationSum = 0, // Adds attribute value across user accounts |
| 57 |
| 58 kKSReportingAggregationDefault = kKSReportingAggregationSum, |
| 59 } KSReportingAggregationType; |
| 60 |
55 @interface KSRegistration : NSObject | 61 @interface KSRegistration : NSObject |
56 | 62 |
57 + (id)registrationWithProductID:(NSString*)productID; | 63 + (id)registrationWithProductID:(NSString*)productID; |
58 | 64 |
59 - (BOOL)registerWithParameters:(NSDictionary*)args; | 65 - (BOOL)registerWithParameters:(NSDictionary*)args; |
60 | 66 |
61 - (BOOL)promoteWithParameters:(NSDictionary*)args | 67 - (BOOL)promoteWithParameters:(NSDictionary*)args |
62 authorization:(AuthorizationRef)authorization; | 68 authorization:(AuthorizationRef)authorization; |
63 | 69 |
64 - (BOOL)setActive; | 70 - (BOOL)setActive; |
| 71 - (BOOL)setActiveWithReportingAttributes:(NSArray*)reportingAttributes |
| 72 error:(NSError**)error; |
65 - (void)checkForUpdateWasUserInitiated:(BOOL)userInitiated; | 73 - (void)checkForUpdateWasUserInitiated:(BOOL)userInitiated; |
66 - (void)startUpdate; | 74 - (void)startUpdate; |
67 - (keystone_registration::KSRegistrationTicketType)ticketType; | 75 - (keystone_registration::KSRegistrationTicketType)ticketType; |
68 | 76 |
69 @end // @interface KSRegistration | 77 @end // @interface KSRegistration |
70 | 78 |
| 79 |
| 80 // Declarations of the Keystone attribute reporting bits needed here. From |
| 81 // KSReportingAttribute.h. |
| 82 @interface KSReportingAttribute : NSObject |
| 83 |
| 84 // How long the attribute will live after being set. The clock starts ticking |
| 85 // after the call to setActiveWithReportingAttributes. |
| 86 - (NSTimeInterval)lifetime; |
| 87 - (BOOL)setLifetime:(NSTimeInterval)lifetime error:(NSError **)error; |
| 88 |
| 89 // The method returns the value stored, as a generic NSObject. Derived classes |
| 90 // accessors provide a more specific data type. |
| 91 - (id<NSObject>)value; |
| 92 |
| 93 // The name of the attribute. setName checks that the name starts with a letter |
| 94 // and contains only Latin letters, digits and '_', '-'. |
| 95 - (NSString *)name; |
| 96 - (BOOL)setName:(NSString *)name error:(NSError **)error; |
| 97 |
| 98 // Confirms if a name is correct. Typically called by setName and helper |
| 99 // methods. See "setName" for definition of "correctness". |
| 100 + (BOOL)verifyAttributeName:(NSString *)name error:(NSError **)error; |
| 101 |
| 102 // Prints information about the attribute. Used for debugging purposes. |
| 103 - (NSString *)description; |
| 104 |
| 105 @end // @interface KSReportingAttribute |
| 106 |
| 107 @interface KSUnsignedReportingAttribute : KSReportingAttribute |
| 108 |
| 109 + (KSUnsignedReportingAttribute *)reportingAttributeWithValue:(uint32_t)value |
| 110 name:(NSString *)name |
| 111 aggregationType:(KSReportingAggregationType)aggregationType |
| 112 error:(NSError **)error; |
| 113 |
| 114 // Get/set the value of the attribute as "unsigned int" |
| 115 - (uint32_t)unsignedIntValue; |
| 116 - (void)setUnsignedIntValue:(uint32_t)value; |
| 117 |
| 118 - (KSReportingAggregationType)aggregationType; |
| 119 - (void)setAggregationType:(KSReportingAggregationType)aggregationType; |
| 120 |
| 121 @end // @interface KSUnsignedReportingAttribute |
| 122 |
71 #endif // CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ | 123 #endif // CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_ |
OLD | NEW |