| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "core/platform/network/ResourceHandleTypes.h" | 29 #include "core/platform/network/ResourceHandleTypes.h" |
| 30 #include "core/platform/network/ResourceLoadPriority.h" | 30 #include "core/platform/network/ResourceLoadPriority.h" |
| 31 #include <wtf/Forward.h> | 31 #include <wtf/Forward.h> |
| 32 #include <wtf/OwnPtr.h> | 32 #include <wtf/OwnPtr.h> |
| 33 #include <wtf/RefCounted.h> | 33 #include <wtf/RefCounted.h> |
| 34 #include <wtf/Vector.h> | 34 #include <wtf/Vector.h> |
| 35 | 35 |
| 36 namespace WebCore { | 36 namespace WebCore { |
| 37 class KURL; | 37 class KURL; |
| 38 class NetworkingContext; | |
| 39 class ResourceError; | 38 class ResourceError; |
| 40 class ResourceHandleClient; | 39 class ResourceHandleClient; |
| 41 class ResourceHandleInternal; | 40 class ResourceHandleInternal; |
| 42 class ResourceRequest; | 41 class ResourceRequest; |
| 43 class ResourceResponse; | 42 class ResourceResponse; |
| 44 | 43 |
| 45 template <typename T> class Timer; | 44 template <typename T> class Timer; |
| 46 | 45 |
| 47 class ResourceHandle : public RefCounted<ResourceHandle> { | 46 class ResourceHandle : public RefCounted<ResourceHandle> { |
| 48 public: | 47 public: |
| 49 static PassRefPtr<ResourceHandle> create(NetworkingContext*, const ResourceR
equest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff, Sto
redCredentials); | 48 static PassRefPtr<ResourceHandle> create(const ResourceRequest&, ResourceHan
dleClient*, bool defersLoading, bool shouldContentSniff, StoredCredentials); |
| 50 static void loadResourceSynchronously(NetworkingContext*, const ResourceRequ
est&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data); | 49 static void loadResourceSynchronously(const ResourceRequest&, StoredCredenti
als, ResourceError&, ResourceResponse&, Vector<char>& data); |
| 51 | 50 |
| 52 static void cacheMetadata(const ResourceResponse&, const Vector<char>&); | 51 static void cacheMetadata(const ResourceResponse&, const Vector<char>&); |
| 53 | 52 |
| 54 virtual ~ResourceHandle(); | 53 virtual ~ResourceHandle(); |
| 55 | 54 |
| 56 virtual void cancel(); | 55 virtual void cancel(); |
| 57 | 56 |
| 58 // The client may be 0, in which case no callbacks will be made. | 57 // The client may be 0, in which case no callbacks will be made. |
| 59 ResourceHandleClient* client() const; | 58 ResourceHandleClient* client() const; |
| 60 void setClient(ResourceHandleClient*); | 59 void setClient(ResourceHandleClient*); |
| 61 | 60 |
| 62 void setDefersLoading(bool); | 61 void setDefersLoading(bool); |
| 63 | 62 |
| 64 void didChangePriority(ResourceLoadPriority); | 63 void didChangePriority(ResourceLoadPriority); |
| 65 | 64 |
| 66 ResourceRequest& firstRequest(); | 65 ResourceRequest& firstRequest(); |
| 67 | 66 |
| 68 NetworkingContext* context() const; | |
| 69 | |
| 70 typedef PassRefPtr<ResourceHandle> (*BuiltinConstructor)(const ResourceReque
st& request, ResourceHandleClient* client); | 67 typedef PassRefPtr<ResourceHandle> (*BuiltinConstructor)(const ResourceReque
st& request, ResourceHandleClient* client); |
| 71 static void registerBuiltinConstructor(const AtomicString& protocol, Builtin
Constructor); | 68 static void registerBuiltinConstructor(const AtomicString& protocol, Builtin
Constructor); |
| 72 | 69 |
| 73 typedef void (*BuiltinSynchronousLoader)(NetworkingContext*, const ResourceR
equest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& dat
a); | 70 typedef void (*BuiltinSynchronousLoader)(const ResourceRequest&, StoredCrede
ntials, ResourceError&, ResourceResponse&, Vector<char>& data); |
| 74 static void registerBuiltinSynchronousLoader(const AtomicString& protocol, B
uiltinSynchronousLoader); | 71 static void registerBuiltinSynchronousLoader(const AtomicString& protocol, B
uiltinSynchronousLoader); |
| 75 | 72 |
| 76 protected: | 73 protected: |
| 77 ResourceHandle(NetworkingContext*, const ResourceRequest&, ResourceHandleCli
ent*, bool defersLoading, bool shouldContentSniff); | 74 ResourceHandle(const ResourceRequest&, ResourceHandleClient*, bool defersLoa
ding, bool shouldContentSniff); |
| 78 | 75 |
| 79 private: | 76 private: |
| 80 bool start(StoredCredentials); | 77 void start(StoredCredentials); |
| 81 friend class ResourceHandleInternal; | 78 friend class ResourceHandleInternal; |
| 82 OwnPtr<ResourceHandleInternal> d; | 79 OwnPtr<ResourceHandleInternal> d; |
| 83 }; | 80 }; |
| 84 | 81 |
| 85 } | 82 } |
| 86 | 83 |
| 87 #endif // ResourceHandle_h | 84 #endif // ResourceHandle_h |
| OLD | NEW |