summaryrefslogtreecommitdiffstats
path: root/chrome/browser/mac/keystone_registration.h
blob: 3fa9197fa451703fc31358e27041eb0c81f265d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_
#define CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_

#import <Foundation/Foundation.h>
#include <Security/Authorization.h>

// Declarations of the Keystone registration bits needed here. From
// KSRegistration.h.

namespace keystone_registration {

typedef enum {
  kKSPathExistenceChecker,
} KSExistenceCheckerType;

typedef enum {
  kKSRegistrationUserTicket,
  kKSRegistrationSystemTicket,
  kKSRegistrationDontKnowWhatKindOfTicket,
} KSRegistrationTicketType;

extern NSString* KSRegistrationVersionKey;
extern NSString* KSRegistrationExistenceCheckerTypeKey;
extern NSString* KSRegistrationExistenceCheckerStringKey;
extern NSString* KSRegistrationServerURLStringKey;
extern NSString* KSRegistrationPreserveTrustedTesterTokenKey;
extern NSString* KSRegistrationTagKey;
extern NSString* KSRegistrationTagPathKey;
extern NSString* KSRegistrationTagKeyKey;
extern NSString* KSRegistrationBrandPathKey;
extern NSString* KSRegistrationBrandKeyKey;
extern NSString* KSRegistrationVersionPathKey;
extern NSString* KSRegistrationVersionKeyKey;

extern NSString* KSRegistrationDidCompleteNotification;
extern NSString* KSRegistrationPromotionDidCompleteNotification;

extern NSString* KSRegistrationCheckForUpdateNotification;
extern NSString* KSRegistrationStatusKey;
extern NSString* KSRegistrationUpdateCheckErrorKey;

extern NSString* KSRegistrationStartUpdateNotification;
extern NSString* KSUpdateCheckSuccessfulKey;
extern NSString* KSUpdateCheckSuccessfullyInstalledKey;

extern NSString* KSRegistrationRemoveExistingTag;

extern NSString* KSReportingAttributeValueKey;
extern NSString* KSReportingAttributeExpirationDateKey;
extern NSString* KSReportingAttributeAggregationTypeKey;
#define KSRegistrationPreserveExistingTag nil

}  // namespace keystone_registration

typedef enum {
  kKSReportingAggregationSum = 0,  // Adds attribute value across user accounts
  kKSReportingAggregationDefault = kKSReportingAggregationSum,
} KSReportingAggregationType;

@interface KSRegistration : NSObject

+ (id)registrationWithProductID:(NSString*)productID;

- (BOOL)registerWithParameters:(NSDictionary*)args;

- (BOOL)promoteWithParameters:(NSDictionary*)args
                authorization:(AuthorizationRef)authorization;

- (BOOL)setActive;
- (BOOL)setActiveWithReportingAttributes:(NSArray*)reportingAttributes
                                   error:(NSError**)error;
- (void)checkForUpdateWasUserInitiated:(BOOL)userInitiated;
- (void)startUpdate;
- (keystone_registration::KSRegistrationTicketType)ticketType;

@end  // @interface KSRegistration


// Declarations of the Keystone attribute reporting bits needed here.
// Full definition is at:
// //depot/googlemac/opensource/update-engine/Common/KSReportingAttribute.h
@interface KSReportingAttribute : NSObject

@end  // @interface KSReportingAttribute

@interface KSUnsignedReportingAttribute : KSReportingAttribute

+ (KSUnsignedReportingAttribute *)reportingAttributeWithValue:(uint32_t)value
               name:(NSString *)name
    aggregationType:(KSReportingAggregationType)aggregationType
              error:(NSError **)error;

@end  // @interface KSUnsignedReportingAttribute


#endif  // CHROME_BROWSER_MAC_KEYSTONE_REGISTRATION_H_