1e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke/*
2e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * Copyright (C) 2010 Apple Inc. All rights reserved.
3e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
4e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * Redistribution and use in source and binary forms, with or without
5e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * modification, are permitted provided that the following conditions
6e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * are met:
7e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * 1.  Redistributions of source code must retain the above copyright
8e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     notice, this list of conditions and the following disclaimer.
9e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * 2.  Redistributions in binary form must reproduce the above copyright
10e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     notice, this list of conditions and the following disclaimer in the
11e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *     documentation and/or other materials provided with the distribution.
12e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke *
13e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
14e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
17e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
18e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
19e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
22e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke */
24e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
25e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#ifndef InspectorApplicationCacheAgent_h
26e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#define InspectorApplicationCacheAgent_h
27e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
28e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#if ENABLE(INSPECTOR) && ENABLE(OFFLINE_WEB_APPLICATIONS)
29e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
30e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#include "ApplicationCacheHost.h"
3181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch#include "InspectorFrontend.h"
32e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#include <wtf/Noncopyable.h>
33dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch#include <wtf/PassRefPtr.h>
34e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
35e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkenamespace WebCore {
36e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
3765f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdochclass Frame;
38dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass InspectorArray;
392fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockclass InspectorAgent;
40e8b154fd68f9b33be40a3590e58347f353835f5cSteve Blockclass InspectorFrontend;
41dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass InspectorObject;
42dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdochclass InspectorValue;
4381bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochclass InstrumentingAgents;
4481bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochclass Page;
45e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkeclass ResourceResponse;
46e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
4781bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdochtypedef String ErrorString;
4881bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch
49ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdochclass InspectorApplicationCacheAgent {
50ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddbBen Murdoch    WTF_MAKE_NONCOPYABLE(InspectorApplicationCacheAgent); WTF_MAKE_FAST_ALLOCATED;
51e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkepublic:
5281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    InspectorApplicationCacheAgent(InstrumentingAgents*, Page*);
53e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    ~InspectorApplicationCacheAgent() { }
54e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
5581bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void setFrontend(InspectorFrontend*);
5681bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    void clearFrontend();
572fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
58e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    // Backend to Frontend
5965f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    void updateApplicationCacheStatus(Frame*);
6065f03d4f644ce73618e5f4f50dd694b26f55ae12Ben Murdoch    void networkStateChanged();
61e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
62e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke    // From Frontend
632bde8e466a4451c7319e3a072d118917957d6554Steve Block    void getApplicationCaches(ErrorString*, RefPtr<InspectorObject>* applicationCaches);
64e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
65e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarkeprivate:
66dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    PassRefPtr<InspectorObject> buildObjectForApplicationCache(const ApplicationCacheHost::ResourceInfoList&, const ApplicationCacheHost::CacheInfo&);
67dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    PassRefPtr<InspectorArray> buildArrayForApplicationCacheResources(const ApplicationCacheHost::ResourceInfoList&);
68dd8bb3de4f353a81954234999f1fea748aee2ea9Ben Murdoch    PassRefPtr<InspectorObject> buildObjectForApplicationCacheResource(const ApplicationCacheHost::ResourceInfo&);
69e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
7081bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    InstrumentingAgents* m_instrumentingAgents;
7181bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    Page* m_inspectedPage;
7281bc750723a18f21cd17d1b173cd2a4dda9cea6eBen Murdoch    InspectorFrontend::ApplicationCache* m_frontend;
73e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke};
74e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
75e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke} // namespace WebCore
76e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke
77e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#endif // ENABLE(INSPECTOR) && ENABLE(OFFLINE_WEB_APPLICATIONS)
78e458d70a0d18538346f41b503114c9ebe6b2ce12Leon Clarke#endif // InspectorApplicationCacheAgent_h
79