blob: d96b596dabfbe9068ac53410687bfa2d18618b23 [file] [log] [blame]
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +00001/*
2 * Copyright (C) 2013 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
26#ifndef WebArchive_h
27#define WebArchive_h
28
mitz@apple.com111c4e82014-02-11 18:00:45 +000029#if PLATFORM(COCOA)
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000030
31#include "APIObject.h"
32#include <wtf/PassRefPtr.h>
33#include <wtf/RefPtr.h>
34
andersca@apple.comfee681d2013-11-13 22:05:12 +000035namespace API {
36class Array;
andersca@apple.com2e5d7c62013-12-16 20:21:24 +000037class Data;
andersca@apple.comfee681d2013-11-13 22:05:12 +000038}
39
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000040namespace WebCore {
41class LegacyWebArchive;
42class Range;
43}
44
andersca@apple.come54ba962014-05-06 22:44:56 +000045namespace API {
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000046
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000047class WebArchiveResource;
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000048
andersca@apple.combe156ca2013-12-10 21:28:37 +000049class WebArchive : public API::ObjectImpl<API::Object::Type::WebArchive> {
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000050public:
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000051 virtual ~WebArchive();
52
gyuyoung.kim@webkit.org5f7960e2015-06-17 03:33:26 +000053 static Ref<WebArchive> create(WebArchiveResource* mainResource, PassRefPtr<API::Array> subresources, PassRefPtr<API::Array> subframeArchives);
54 static Ref<WebArchive> create(API::Data*);
55 static Ref<WebArchive> create(PassRefPtr<WebCore::LegacyWebArchive>);
56 static Ref<WebArchive> create(WebCore::Range*);
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000057
58 WebArchiveResource* mainResource();
andersca@apple.comfee681d2013-11-13 22:05:12 +000059 API::Array* subresources();
60 API::Array* subframeArchives();
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000061
zandobersek@gmail.com8de57cd2015-04-27 20:13:53 +000062 Ref<API::Data> data();
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000063
64 WebCore::LegacyWebArchive* coreLegacyWebArchive();
65
66private:
andersca@apple.comfee681d2013-11-13 22:05:12 +000067 WebArchive(WebArchiveResource* mainResource, PassRefPtr<API::Array> subresources, PassRefPtr<API::Array> subframeArchives);
andersca@apple.com2e5d7c62013-12-16 20:21:24 +000068 WebArchive(API::Data*);
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000069 WebArchive(PassRefPtr<WebCore::LegacyWebArchive>);
70
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000071 RefPtr<WebCore::LegacyWebArchive> m_legacyWebArchive;
72 RefPtr<WebArchiveResource> m_cachedMainResource;
andersca@apple.comfee681d2013-11-13 22:05:12 +000073 RefPtr<API::Array> m_cachedSubresources;
74 RefPtr<API::Array> m_cachedSubframeArchives;
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000075};
76
andersca@apple.come54ba962014-05-06 22:44:56 +000077} // namespace API
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000078
mitz@apple.com111c4e82014-02-11 18:00:45 +000079#endif // PLATFORM(COCOA)
enrica@apple.com7eb1d5b2013-01-31 21:14:58 +000080
81#endif // WebArchive_h