pleyo.com

/src/trunk2/BAL/Interfaces/network/AuthenticationChallenge.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2007 Apple Inc.  All rights reserved.
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions
00006  * are met:
00007  * 1. Redistributions of source code must retain the above copyright
00008  *    notice, this list of conditions and the following disclaimer.
00009  * 2. Redistributions in binary form must reproduce the above copyright
00010  *    notice, this list of conditions and the following disclaimer in the
00011  *    documentation and/or other materials provided with the distribution.
00012  *
00013  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
00014  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00015  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
00017  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00018  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00019  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00020  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
00021  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00022  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00023  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
00024  */
00025 #ifndef AuthenticationChallenge_h
00026 #define AuthenticationChallenge_h
00027 
00028 #include "Credential.h"
00029 #include "ProtectionSpace.h"
00030 #include "ResourceResponse.h"
00031 #include "ResourceError.h"
00032 
00033 #include <wtf/RefPtr.h>
00034 
00035 
00036 #if PLATFORM(MAC)
00037 #include <wtf/RetainPtr.h>
00038 #ifndef __OBJC__
00039 typedef struct objc_object *id;
00040 class NSURLAuthenticationChallenge;
00041 #else
00042 @class NSURLAuthenticationChallenge;
00043 #endif
00044 #endif
00045 
00046 #if USE(CFNETWORK)
00047 typedef struct _CFURLAuthChallenge* CFURLAuthChallengeRef;
00048 #endif
00049 
00050 
00051 namespace WebCore {
00052 
00053 class ResourceHandle;
00054 
00055 class AuthenticationChallenge {
00056 
00057 public:
00058     AuthenticationChallenge();
00059     AuthenticationChallenge(const ProtectionSpace& protectionSpace, const Credential& proposedCredential, unsigned previousFailureCount, const ResourceResponse& response, const ResourceError& error);
00060 #if PLATFORM(MAC)
00061     AuthenticationChallenge(NSURLAuthenticationChallenge *);
00062 #elif USE(CFNETWORK)
00063     AuthenticationChallenge(CFURLAuthChallengeRef, ResourceHandle* sourceHandle);
00064 #endif
00065 
00066     unsigned previousFailureCount() const;
00067     const Credential& proposedCredential() const;
00068     const ProtectionSpace& protectionSpace() const;
00069     const ResourceResponse& failureResponse() const;
00070     const ResourceError& error() const;
00071     
00072     bool isNull() const;
00073     void nullify();
00074     
00075 #if PLATFORM(MAC)
00076     id sender() const { return m_sender.get(); }
00077     NSURLAuthenticationChallenge *nsURLAuthenticationChallenge() const { return m_macChallenge.get(); }
00078 #elif USE(CFNETWORK)
00079     ResourceHandle* sourceHandle() const { return m_sourceHandle.get(); }
00080     CFURLAuthChallengeRef cfURLAuthChallengeRef() const { return m_cfChallenge.get(); }
00081 #endif
00082 private:
00083     bool m_isNull;
00084     ProtectionSpace m_protectionSpace;
00085     Credential m_proposedCredential;
00086     unsigned m_previousFailureCount;
00087     ResourceResponse m_failureResponse;
00088     ResourceError m_error;
00089 
00090 #if PLATFORM(MAC)
00091     RetainPtr<id> m_sender;
00092     RetainPtr<NSURLAuthenticationChallenge *> m_macChallenge;
00093 #elif USE(CFNETWORK)
00094     RefPtr<ResourceHandle> m_sourceHandle;
00095     RetainPtr<CFURLAuthChallengeRef> m_cfChallenge;
00096 #endif
00097 
00098 };
00099 
00100 bool operator==(const AuthenticationChallenge&, const AuthenticationChallenge&);
00101 bool operator!=(const AuthenticationChallenge&, const AuthenticationChallenge&);
00102 }
00103 #endif
00104 

Generated on Wed Nov 21 20:04:17 2007 for Origyn Web Browser by Doxygen 1.5.3

pleyo.com
pleyo.com