Mercurial > projects > dstep
annotate dstep/foundation/NSURLAuthenticationChallenge.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | 89f3c3ef1fd2 |
children | b9de51448c6b |
rev | line source |
---|---|
14 | 1 /** |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Aug 3, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.foundation.NSURLAuthenticationChallenge; | |
8 | |
9 import dstep.foundation.NSError; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
10 import dstep.foundation.NSObjCRuntime; |
14 | 11 import dstep.foundation.NSObject; |
12 import dstep.foundation.NSURLCredential; | |
13 import dstep.foundation.NSURLProtectionSpace; | |
14 import dstep.foundation.NSURLResponse; | |
15 import dstep.objc.bridge.Bridge; | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
16 import dstep.objc.objc; |
14 | 17 |
18 class NSURLAuthenticationChallenge : NSObject | |
19 { | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
20 mixin (ObjcWrap); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
21 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
22 this () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
23 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
24 super(typeof(this).alloc.init.objcObject); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
25 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
26 |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
27 typeof(this) init () |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
28 { |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
29 return invokeObjcSelf!(typeof(this), "init"); |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
30 } |
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
31 |
14 | 32 Object initWithProtectionSpace (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender) |
33 { | |
34 return invokeObjcSelf!(Object, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(space, credential, previousFailureCount, response, error, sender); | |
35 } | |
36 | |
37 this (NSURLProtectionSpace space, NSURLCredential credential, NSInteger previousFailureCount, NSURLResponse response, NSError error, INSURLAuthenticationChallengeSender sender) | |
38 { | |
39 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
40 id result = Bridge.invokeObjcMethod!(id, "initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error:sender:", NSURLProtectionSpace, NSURLCredential, NSInteger, NSURLResponse, NSError, INSURLAuthenticationChallengeSender)(objcObject, space, credential, previousFailureCount, response, error, sender); | |
41 | |
42 if (result) | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
43 objcObject = result; |
14 | 44 |
45 dObject = this; | |
46 } | |
47 | |
48 Object initWithAuthenticationChallenge (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender) | |
49 { | |
50 return invokeObjcSelf!(Object, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(challenge, sender); | |
51 } | |
52 | |
53 this (NSURLAuthenticationChallenge challenge, INSURLAuthenticationChallengeSender sender) | |
54 { | |
55 objcObject = Bridge.invokeObjcClassMethod!(id, "alloc")(objcClass); | |
56 id result = Bridge.invokeObjcMethod!(id, "initWithAuthenticationChallenge:sender:", NSURLAuthenticationChallenge, INSURLAuthenticationChallengeSender)(objcObject, challenge, sender); | |
57 | |
58 if (result) | |
16
19885b43130e
Huge update, the bridge actually works now
Jacob Carlborg <doob@me.com>
parents:
14
diff
changeset
|
59 objcObject = result; |
14 | 60 |
61 dObject = this; | |
62 } | |
63 | |
64 NSURLProtectionSpace protectionSpace () | |
65 { | |
66 return invokeObjcSelf!(NSURLProtectionSpace, "protectionSpace"); | |
67 } | |
68 | |
69 NSURLCredential proposedCredential () | |
70 { | |
71 return invokeObjcSelf!(NSURLCredential, "proposedCredential"); | |
72 } | |
73 | |
74 NSInteger previousFailureCount () | |
75 { | |
76 return invokeObjcSelf!(NSInteger, "previousFailureCount"); | |
77 } | |
78 | |
79 NSURLResponse failureResponse () | |
80 { | |
81 return invokeObjcSelf!(NSURLResponse, "failureResponse"); | |
82 } | |
83 | |
84 NSError error () | |
85 { | |
86 return invokeObjcSelf!(NSError, "error"); | |
87 } | |
88 | |
89 INSURLAuthenticationChallengeSender sender () | |
90 { | |
91 return invokeObjcSelf!(INSURLAuthenticationChallengeSender, "sender"); | |
92 } | |
93 } | |
94 | |
95 interface INSURLAuthenticationChallengeSender : INSObject | |
96 { | |
97 void useCredential (NSURLCredential credential, NSURLAuthenticationChallenge challenge); | |
98 void continueWithoutCredentialForAuthenticationChallenge (NSURLAuthenticationChallenge challenge); | |
99 void cancelAuthenticationChallenge (NSURLAuthenticationChallenge challenge); | |
100 } | |
101 |