2 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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.
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.
26 #include "WKBundlePage.h"
27 #include "WKBundlePagePrivate.h"
29 #include "InjectedBundleBackForwardList.h"
32 #include "WebURLRequest.h"
33 #include "WKAPICast.h"
34 #include "WKBundleAPICast.h"
36 #include <WebCore/KURL.h>
38 using namespace WebKit;
40 WKTypeID WKBundlePageGetTypeID()
42 return toAPI(WebPage::APIType);
45 void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageContextMenuClient* wkClient)
47 if (wkClient && wkClient->version)
49 toImpl(pageRef)->initializeInjectedBundleContextMenuClient(wkClient);
52 void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClient* wkClient)
54 if (wkClient && wkClient->version)
56 toImpl(pageRef)->initializeInjectedBundleEditorClient(wkClient);
59 void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient* wkClient)
61 if (wkClient && wkClient->version)
63 toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient);
66 void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient)
68 if (wkClient && wkClient->version)
70 toImpl(pageRef)->initializeInjectedBundleLoaderClient(wkClient);
73 void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkClient)
75 if (wkClient && wkClient->version)
77 toImpl(pageRef)->initializeInjectedBundleUIClient(wkClient);
80 WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
82 return toAPI(toImpl(pageRef)->mainFrame());
85 void WKBundlePageStopLoading(WKBundlePageRef pageRef)
87 toImpl(pageRef)->stopLoading();
90 WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pageRef)
92 return toCopiedAPI(toImpl(pageRef)->renderTreeExternalRepresentation());
95 void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument)
97 toImpl(pageRef)->executeEditingCommand(toImpl(name)->string(), toImpl(argument)->string());
100 bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef pageRef, WKStringRef name)
102 return toImpl(pageRef)->isEditingCommandEnabled(toImpl(name)->string());
105 void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef)
107 toImpl(pageRef)->clearMainFrameName();
110 void WKBundlePageClose(WKBundlePageRef pageRef)
112 toImpl(pageRef)->sendClose();
115 double WKBundlePageGetTextZoomFactor(WKBundlePageRef pageRef)
117 return toImpl(pageRef)->textZoomFactor();
120 void WKBundlePageSetTextZoomFactor(WKBundlePageRef pageRef, double zoomFactor)
122 toImpl(pageRef)->setTextZoomFactor(zoomFactor);
125 double WKBundlePageGetPageZoomFactor(WKBundlePageRef pageRef)
127 return toImpl(pageRef)->pageZoomFactor();
130 void WKBundlePageSetPageZoomFactor(WKBundlePageRef pageRef, double zoomFactor)
132 toImpl(pageRef)->setPageZoomFactor(zoomFactor);
135 WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef pageRef)
137 return toAPI(toImpl(pageRef)->backForwardList());
140 void WKBundlePageInstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef)
142 toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef));
145 void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef)
147 toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef));
150 bool WKBundlePageHasLocalDataForURL(WKBundlePageRef pageRef, WKURLRef urlRef)
152 return toImpl(pageRef)->hasLocalDataForURL(WebCore::KURL(WebCore::KURL(), toImpl(urlRef)->string()));
155 bool WKBundlePageCanHandleRequest(WKURLRequestRef requestRef)
157 return WebPage::canHandleRequest(toImpl(requestRef)->resourceRequest());