WebResourceLoader.h 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /*
  2. * Copyright (C) 2012 Apple Inc. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. * 1. Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * 2. Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. *
  13. * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
  14. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  15. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  16. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
  17. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  18. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  19. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  20. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  21. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  22. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  23. * THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef WebResourceLoader_h
  26. #define WebResourceLoader_h
  27. #if ENABLE(NETWORK_PROCESS)
  28. #include "Connection.h"
  29. #include "MessageSender.h"
  30. #include "ShareableResource.h"
  31. #include <wtf/PassRefPtr.h>
  32. #include <wtf/RefCounted.h>
  33. #include <wtf/RefPtr.h>
  34. namespace CoreIPC {
  35. class DataReference;
  36. }
  37. namespace WebCore {
  38. class ProtectionSpace;
  39. class ResourceBuffer;
  40. class ResourceError;
  41. class ResourceLoader;
  42. class ResourceRequest;
  43. class ResourceResponse;
  44. }
  45. namespace WebKit {
  46. class PlatformCertificateInfo;
  47. typedef uint64_t ResourceLoadIdentifier;
  48. class WebResourceLoader : public RefCounted<WebResourceLoader>, public CoreIPC::MessageSender {
  49. public:
  50. static PassRefPtr<WebResourceLoader> create(PassRefPtr<WebCore::ResourceLoader>);
  51. ~WebResourceLoader();
  52. void didReceiveWebResourceLoaderMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&);
  53. WebCore::ResourceLoader* resourceLoader() const { return m_coreLoader.get(); }
  54. void detachFromCoreLoader();
  55. private:
  56. WebResourceLoader(PassRefPtr<WebCore::ResourceLoader>);
  57. // CoreIPC::MessageSender
  58. virtual CoreIPC::Connection* messageSenderConnection() OVERRIDE;
  59. virtual uint64_t messageSenderDestinationID() OVERRIDE;
  60. void cancelResourceLoader();
  61. void willSendRequest(const WebCore::ResourceRequest&, const WebCore::ResourceResponse& redirectResponse);
  62. void didSendData(uint64_t bytesSent, uint64_t totalBytesToBeSent);
  63. void didReceiveResponseWithCertificateInfo(const WebCore::ResourceResponse&, const PlatformCertificateInfo&, bool needsContinueDidReceiveResponseMessage);
  64. void didReceiveData(const CoreIPC::DataReference&, int64_t encodedDataLength);
  65. void didFinishResourceLoad(double finishTime);
  66. void didFailResourceLoad(const WebCore::ResourceError&);
  67. void didReceiveResource(const ShareableResource::Handle&, double finishTime);
  68. void canAuthenticateAgainstProtectionSpace(const WebCore::ProtectionSpace&);
  69. RefPtr<WebCore::ResourceLoader> m_coreLoader;
  70. };
  71. } // namespace WebKit
  72. #endif // ENABLE(NETWORK_PROCESS)
  73. #endif // WebResourceLoader_h