blob: 8672dea7368b9811314c25eb35f7f2a972160a0f [file] [log] [blame]
beidson@apple.com74e89da2008-04-01 20:26:27 +00001/*
bfulgham@apple.comd7fd9fd2015-08-20 00:00:38 +00002 * Copyright (C) 2008, 2015 Apple Inc. All Rights Reserved.
beidson@apple.com74e89da2008-04-01 20:26:27 +00003 *
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 WebArchive_h
27#define WebArchive_h
beidson@apple.comdfa17df12008-04-01 23:11:00 +000028
beidson@apple.com74e89da2008-04-01 20:26:27 +000029#include "WebKit.h"
30
beidson@apple.com74e89da2008-04-01 20:26:27 +000031#include <wtf/RefPtr.h>
32
33namespace WebCore {
34 class LegacyWebArchive;
35}
36
Hironori.Fujii@sony.comcc2ddeb2018-12-13 06:44:39 +000037class WebArchive final : public IWebArchive
beidson@apple.com74e89da2008-04-01 20:26:27 +000038{
39public:
adachan@apple.com98102f62008-04-03 19:00:40 +000040 static WebArchive* createInstance();
cdumez@apple.comc12c8162017-05-13 17:33:30 +000041 static WebArchive* createInstance(RefPtr<WebCore::LegacyWebArchive>&&);
beidson@apple.com74e89da2008-04-01 20:26:27 +000042protected:
cdumez@apple.comc12c8162017-05-13 17:33:30 +000043 WebArchive(RefPtr<WebCore::LegacyWebArchive>&&);
beidson@apple.com74e89da2008-04-01 20:26:27 +000044 ~WebArchive();
45
46public:
47 // IUnknown
bfulgham@apple.comd7fd9fd2015-08-20 00:00:38 +000048 virtual HRESULT STDMETHODCALLTYPE QueryInterface(_In_ REFIID riid, _COM_Outptr_ void** ppvObject);
beidson@apple.com74e89da2008-04-01 20:26:27 +000049 virtual ULONG STDMETHODCALLTYPE AddRef();
50 virtual ULONG STDMETHODCALLTYPE Release();
51
52 // IWebArchive
bfulgham@apple.comd7fd9fd2015-08-20 00:00:38 +000053 virtual HRESULT STDMETHODCALLTYPE initWithMainResource(_In_opt_ IWebResource* mainResource,
54 __inout_ecount_full(cSubResources) IWebResource** subResources, int cSubResources,
55 __inout_ecount_full(cSubFrameArchives) IWebArchive** subFrameArchives, int cSubFrameArchives);
56 virtual HRESULT STDMETHODCALLTYPE initWithData(_In_opt_ IStream*);
57 virtual HRESULT STDMETHODCALLTYPE initWithNode(_In_opt_ IDOMNode*);
58 virtual HRESULT STDMETHODCALLTYPE mainResource(_COM_Outptr_opt_ IWebResource**);
59 virtual HRESULT STDMETHODCALLTYPE subResources(_COM_Outptr_opt_ IEnumVARIANT**);
60 virtual HRESULT STDMETHODCALLTYPE subframeArchives(_COM_Outptr_opt_ IEnumVARIANT**);
61 virtual HRESULT STDMETHODCALLTYPE data(_COM_Outptr_opt_ IStream**);
beidson@apple.com74e89da2008-04-01 20:26:27 +000062
63protected:
bfulgham@apple.comd7fd9fd2015-08-20 00:00:38 +000064 ULONG m_refCount { 0 };
bfulgham@apple.com14ef42c2019-08-08 22:03:58 +000065#if USE(CF)
beidson@apple.com74e89da2008-04-01 20:26:27 +000066 RefPtr<WebCore::LegacyWebArchive> m_archive;
bfulgham@apple.com14ef42c2019-08-08 22:03:58 +000067#endif
beidson@apple.com74e89da2008-04-01 20:26:27 +000068};
69
70#endif // WebArchive_h