OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_MAC_KEYSTONE_REPORTING_ATTRIBUTE_H_ |
| 6 #define CHROME_BROWSER_MAC_KEYSTONE_REPORTING_ATTRIBUTE_H_ |
| 7 |
| 8 // Declarations of the Keystone attribute reporting bits needed here. From |
| 9 // KSReportingAttribute.h. |
| 10 |
| 11 typedef enum { |
| 12 kKSReportingAggregationSum = 0, // Adds attribute value across user accounts |
| 13 |
| 14 kKSReportingAggregationDefault = kKSReportingAggregationSum, |
| 15 } KSReportingAggregationType; |
| 16 |
| 17 @interface KSReportingAttribute : NSObject |
| 18 |
| 19 // How long the attribute will live after being set. The clock starts ticking |
| 20 // after the call to setActiveWithReportingAttributes. |
| 21 - (NSTimeInterval)lifetime; |
| 22 - (BOOL)setLifetime:(NSTimeInterval)lifetime error:(NSError **)error; |
| 23 |
| 24 // The method returns the value stored, as a generic NSObject. Derived classes |
| 25 // accessors provide a more specific data type. |
| 26 - (id<NSObject>)value; |
| 27 |
| 28 // The name of the attribute. setName checks that the name starts with a letter |
| 29 // and contains only Latin letters, digits and '_', '-'. |
| 30 - (NSString *)name; |
| 31 - (BOOL)setName:(NSString *)name error:(NSError **)error; |
| 32 |
| 33 // Confirms if a name is correct. Typically called by setName and helper |
| 34 // methods. See "setName" for definition of "correctness". |
| 35 + (BOOL)verifyAttributeName:(NSString *)name error:(NSError **)error; |
| 36 |
| 37 // Prints information about the attribute. Used for debugging purposes. |
| 38 - (NSString *)description; |
| 39 |
| 40 @end |
| 41 |
| 42 @interface KSUnsignedReportingAttribute : KSReportingAttribute |
| 43 |
| 44 + (KSUnsignedReportingAttribute *)reportingAttributeWithValue:(uint32_t)value |
| 45 name:(NSString *)name |
| 46 aggregationType:(KSReportingAggregationType)aggregationType |
| 47 error:(NSError **)error; |
| 48 |
| 49 // Get/set the value of the attribute as "unsigned int" |
| 50 - (uint32_t)unsignedIntValue; |
| 51 - (void)setUnsignedIntValue:(uint32_t)value; |
| 52 |
| 53 - (KSReportingAggregationType)aggregationType; |
| 54 - (void)setAggregationType:(KSReportingAggregationType)aggregationType; |
| 55 |
| 56 @end |
| 57 |
| 58 #endif // CHROME_BROWSER_MAC_KEYSTONE_REPORTING_ATTRIBUTE_H_ |
OLD | NEW |