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"
30 #include "WKAPICast.h"
31 #include "WKBundleAPICast.h"
34 using namespace WebKit;
36 WKTypeID WKBundlePageGetTypeID()
38 return toAPI(WebPage::APIType);
41 void WKBundlePageSetContextMenuClient(WKBundlePageRef pageRef, WKBundlePageContextMenuClient* wkClient)
43 if (wkClient && wkClient->version)
45 toImpl(pageRef)->initializeInjectedBundleContextMenuClient(wkClient);
48 void WKBundlePageSetEditorClient(WKBundlePageRef pageRef, WKBundlePageEditorClient* wkClient)
50 if (wkClient && wkClient->version)
52 toImpl(pageRef)->initializeInjectedBundleEditorClient(wkClient);
55 void WKBundlePageSetFormClient(WKBundlePageRef pageRef, WKBundlePageFormClient* wkClient)
57 if (wkClient && wkClient->version)
59 toImpl(pageRef)->initializeInjectedBundleFormClient(wkClient);
62 void WKBundlePageSetLoaderClient(WKBundlePageRef pageRef, WKBundlePageLoaderClient* wkClient)
64 if (wkClient && wkClient->version)
66 toImpl(pageRef)->initializeInjectedBundleLoaderClient(wkClient);
69 void WKBundlePageSetUIClient(WKBundlePageRef pageRef, WKBundlePageUIClient* wkClient)
71 if (wkClient && wkClient->version)
73 toImpl(pageRef)->initializeInjectedBundleUIClient(wkClient);
76 WKBundleFrameRef WKBundlePageGetMainFrame(WKBundlePageRef pageRef)
78 return toAPI(toImpl(pageRef)->mainFrame());
81 void WKBundlePageStopLoading(WKBundlePageRef pageRef)
83 toImpl(pageRef)->stopLoading();
86 WKStringRef WKBundlePageCopyRenderTreeExternalRepresentation(WKBundlePageRef pageRef)
88 return toCopiedAPI(toImpl(pageRef)->renderTreeExternalRepresentation());
91 void WKBundlePageExecuteEditingCommand(WKBundlePageRef pageRef, WKStringRef name, WKStringRef argument)
93 toImpl(pageRef)->executeEditingCommand(toImpl(name)->string(), toImpl(argument)->string());
96 bool WKBundlePageIsEditingCommandEnabled(WKBundlePageRef pageRef, WKStringRef name)
98 return toImpl(pageRef)->isEditingCommandEnabled(toImpl(name)->string());
101 void WKBundlePageClearMainFrameName(WKBundlePageRef pageRef)
103 toImpl(pageRef)->clearMainFrameName();
106 void WKBundlePageClose(WKBundlePageRef pageRef)
108 toImpl(pageRef)->sendClose();
111 double WKBundlePageGetTextZoomFactor(WKBundlePageRef pageRef)
113 return toImpl(pageRef)->textZoomFactor();
116 void WKBundlePageSetTextZoomFactor(WKBundlePageRef pageRef, double zoomFactor)
118 toImpl(pageRef)->setTextZoomFactor(zoomFactor);
121 double WKBundlePageGetPageZoomFactor(WKBundlePageRef pageRef)
123 return toImpl(pageRef)->pageZoomFactor();
126 void WKBundlePageSetPageZoomFactor(WKBundlePageRef pageRef, double zoomFactor)
128 toImpl(pageRef)->setPageZoomFactor(zoomFactor);
131 WKBundleBackForwardListRef WKBundlePageGetBackForwardList(WKBundlePageRef pageRef)
133 return toAPI(toImpl(pageRef)->backForwardList());
136 void WKBundlePageInstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef)
138 toImpl(pageRef)->installPageOverlay(toImpl(pageOverlayRef));
141 void WKBundlePageUninstallPageOverlay(WKBundlePageRef pageRef, WKBundlePageOverlayRef pageOverlayRef)
143 toImpl(pageRef)->uninstallPageOverlay(toImpl(pageOverlayRef));