WKInspector.cpp 4.1 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
/*
 * Copyright (C) 2010 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 * THE POSSIBILITY OF SUCH DAMAGE.
 */

26
#include "config.h"
27 28 29 30 31 32 33 34 35
#include "WKInspector.h"

#include "WKAPICast.h"
#include "WebInspectorProxy.h"

using namespace WebKit;

WKTypeID WKInspectorGetTypeID()
{
36
#if ENABLE(INSPECTOR)
37
    return toAPI(WebInspectorProxy::APIType);
38 39 40
#else
    return 0;
#endif
41 42 43 44
}

WKPageRef WKInspectorGetPage(WKInspectorRef inspectorRef)
{
45
#if ENABLE(INSPECTOR)
46
    return toAPI(toImpl(inspectorRef)->page());
47 48 49
#else
    return 0;
#endif
50
}
51 52 53

bool WKInspectorIsVisible(WKInspectorRef inspectorRef)
{
54
#if ENABLE(INSPECTOR)
55
    return toImpl(inspectorRef)->isVisible();
56 57 58
#else
    return false;
#endif
59 60
}

61 62
bool WKInspectorIsFront(WKInspectorRef inspectorRef)
{
63
#if ENABLE(INSPECTOR)
64
    return toImpl(inspectorRef)->isFront();
65 66 67
#else
    return false;
#endif
68 69
}

70 71
void WKInspectorShow(WKInspectorRef inspectorRef)
{
72
#if ENABLE(INSPECTOR)
73
    toImpl(inspectorRef)->show();
74
#endif
75 76 77 78
}

void WKInspectorClose(WKInspectorRef inspectorRef)
{
79
#if ENABLE(INSPECTOR)
80
    toImpl(inspectorRef)->close();
81
#endif
82 83 84 85
}

void WKInspectorShowConsole(WKInspectorRef inspectorRef)
{
86
#if ENABLE(INSPECTOR)
87
    toImpl(inspectorRef)->showConsole();
88
#endif
89 90
}

91 92
void WKInspectorShowResources(WKInspectorRef inspectorRef)
{
93
#if ENABLE(INSPECTOR)
94
    toImpl(inspectorRef)->showResources();
95
#endif
96 97
}

98 99
void WKInspectorShowMainResourceForFrame(WKInspectorRef inspectorRef, WKFrameRef frameRef)
{
100
#if ENABLE(INSPECTOR)
101
    toImpl(inspectorRef)->showMainResourceForFrame(toImpl(frameRef));
102
#endif
103 104
}

105 106
bool WKInspectorIsAttached(WKInspectorRef inspectorRef)
{
107
#if ENABLE(INSPECTOR)
108
    return toImpl(inspectorRef)->isAttached();
109 110 111
#else
    return false;
#endif
112 113 114 115
}

void WKInspectorAttach(WKInspectorRef inspectorRef)
{
116
#if ENABLE(INSPECTOR)
117
    toImpl(inspectorRef)->attach();
118
#endif
119 120 121 122
}

void WKInspectorDetach(WKInspectorRef inspectorRef)
{
123
#if ENABLE(INSPECTOR)
124
    toImpl(inspectorRef)->detach();
125
#endif
126 127 128 129
}

bool WKInspectorIsDebuggingJavaScript(WKInspectorRef inspectorRef)
{
130
#if ENABLE(INSPECTOR)
131
    return toImpl(inspectorRef)->isDebuggingJavaScript();
132 133 134
#else
    return false;
#endif
135 136 137 138
}

void WKInspectorToggleJavaScriptDebugging(WKInspectorRef inspectorRef)
{
139
#if ENABLE(INSPECTOR)
140
    toImpl(inspectorRef)->toggleJavaScriptDebugging();
141
#endif
142 143 144 145
}

bool WKInspectorIsProfilingJavaScript(WKInspectorRef inspectorRef)
{
146
#if ENABLE(INSPECTOR)
147
    return toImpl(inspectorRef)->isProfilingJavaScript();
148 149 150
#else
    return false;
#endif
151 152 153 154
}

void WKInspectorToggleJavaScriptProfiling(WKInspectorRef inspectorRef)
{
155
#if ENABLE(INSPECTOR)
156
    toImpl(inspectorRef)->toggleJavaScriptProfiling();
157
#endif
158 159 160 161
}

bool WKInspectorIsProfilingPage(WKInspectorRef inspectorRef)
{
162
#if ENABLE(INSPECTOR)
163
    return toImpl(inspectorRef)->isProfilingPage();
164 165 166
#else
    return false;
#endif
167 168 169 170
}

void WKInspectorTogglePageProfiling(WKInspectorRef inspectorRef)
{
171
#if ENABLE(INSPECTOR)
172
    toImpl(inspectorRef)->togglePageProfiling();
173
#endif
174
}