webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
WebResource.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2015 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. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  */
25 
26 #ifndef WebResource_h
27 #define WebResource_h
28 
29 #include "WebKit.h"
30 #include <WebCore/COMPtr.h>
31 #include <WebCore/URL.h>
32 #include <WebCore/ResourceResponse.h>
33 #include <WebCore/SharedBuffer.h>
34 #include <wtf/PassRefPtr.h>
35 #include <wtf/text/WTFString.h>
36 
37 class WebResource : public IWebResource {
38 public:
39  static WebResource* createInstance(PassRefPtr<WebCore::SharedBuffer> data, const WebCore::ResourceResponse& response);
40 protected:
41  WebResource(IStream* data, const WebCore::URL& url, const WTF::String& mimeType, const WTF::String& textEncodingName, const WTF::String& frameName);
42  ~WebResource();
43 
44 public:
45  // IUnknown
46  virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject);
47  virtual ULONG STDMETHODCALLTYPE AddRef();
48  virtual ULONG STDMETHODCALLTYPE Release();
49 
50  // IWebResource
51  virtual HRESULT STDMETHODCALLTYPE initWithData(_In_opt_ IStream* data, _In_ BSTR url, _In_ BSTR mimeType, _In_ BSTR textEncodingName, _In_ BSTR frameName);
52  virtual HRESULT STDMETHODCALLTYPE data(_COM_Outptr_opt_ IStream** data);
53  virtual HRESULT STDMETHODCALLTYPE URL(__deref_opt_out BSTR* url);
54  virtual HRESULT STDMETHODCALLTYPE MIMEType(__deref_opt_out BSTR* mime);
55  virtual HRESULT STDMETHODCALLTYPE textEncodingName(__deref_opt_out BSTR* encodingName);
56  virtual HRESULT STDMETHODCALLTYPE frameName(__deref_opt_out BSTR* name);
57 
58 private:
59  ULONG m_refCount { 0 };
60  COMPtr<IStream> m_data;
61  WebCore::URL m_url;
62  WTF::String m_mimeType;
63  WTF::String m_textEncodingName;
64  WTF::String m_frameName;
65 };
66 
67 #endif
NSString * textEncodingName
Definition: WebResource.h:80
Definition: IWebResource.idl:44
NSString * MIMEType
Definition: WebResource.h:74
virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void **ppvObject)
Definition: WebResource.cpp:65
unsigned long ULONG
Definition: MD5.h:32
NSURL * URL
Definition: WebResource.h:68
HRESULT
Definition: RenderThemeWin.cpp:150
Definition: WTFString.h:78
virtual HRESULT STDMETHODCALLTYPE initWithData(_In_opt_ IStream *data, _In_ BSTR url, _In_ BSTR mimeType, _In_ BSTR textEncodingName, _In_ BSTR frameName)
Definition: WebResource.cpp:97
virtual ULONG STDMETHODCALLTYPE Release()
Definition: WebResource.cpp:86
Definition: WebResource.h:39
wchar_t * BSTR
Definition: BString.h:36
virtual ULONG STDMETHODCALLTYPE AddRef()
Definition: WebResource.cpp:81
~WebResource()
Definition: WebResource.cpp:48
EGLImageKHR EGLint * name
Definition: eglext.h:851
WebResource(IStream *data, const WebCore::URL &url, const WTF::String &mimeType, const WTF::String &textEncodingName, const WTF::String &frameName)
Definition: WebResource.cpp:37
EGLStreamKHR EGLint EGLint EGLint const void * data
Definition: eglext.h:984
url
Definition: setup.py:223
Definition: URL.h:52
NSData * data
Definition: WebResource.h:62
Definition: ResourceResponse.h:39
NSString * frameName
Definition: WebResource.h:86
static WebResource * createInstance(PassRefPtr< WebCore::SharedBuffer > data, const WebCore::ResourceResponse &response)
Definition: WebResource.cpp:54