diff options
Diffstat (limited to 'Source/WebKit/chromium/public')
269 files changed, 22898 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/public/WebAccessibilityNotification.h b/Source/WebKit/chromium/public/WebAccessibilityNotification.h new file mode 100644 index 000000000..de68d37b0 --- /dev/null +++ b/Source/WebKit/chromium/public/WebAccessibilityNotification.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAccessibilityNotification_h +#define WebAccessibilityNotification_h + +namespace WebKit { + +// These values must match WebCore::AXObjectCache::AXNotification values. +// Enforced in AssertMatchingEnums.cpp. +enum WebAccessibilityNotification { + WebAccessibilityNotificationActiveDescendantChanged, + WebAccessibilityNotificationAutocorrectionOccured, + WebAccessibilityNotificationCheckedStateChanged, + WebAccessibilityNotificationChildrenChanged, + WebAccessibilityNotificationFocusedUIElementChanged, + WebAccessibilityNotificationLayoutComplete, + WebAccessibilityNotificationLoadComplete, + WebAccessibilityNotificationSelectedChildrenChanged, + WebAccessibilityNotificationSelectedTextChanged, + WebAccessibilityNotificationValueChanged, + WebAccessibilityNotificationScrolledToAnchor, + WebAccessibilityNotificationLiveRegionChanged, + WebAccessibilityNotificationMenuListItemSelected, + WebAccessibilityNotificationMenuListValueChanged, + WebAccessibilityNotificationRowCountChanged, + WebAccessibilityNotificationRowCollapsed, + WebAccessibilityNotificationRowExpanded, + WebAccessibilityNotificationInvalidStatusChanged, + + // FIXME: now that we're using AssertMatchingEnums, we don't need a + // catch-all "invalid" notification enum. Remove this once it's been + // removed from Chromium. + WebAccessibilityNotificationInvalid, +}; + +} // namespace WebKit + +#endif // WebAccessibilityNotification_h diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h new file mode 100644 index 000000000..9c67b7766 --- /dev/null +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAccessibilityObject_h +#define WebAccessibilityObject_h + +#include "WebAccessibilityRole.h" +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebCore { class AccessibilityObject; } + +namespace WebKit { + +class WebNode; +class WebDocument; +class WebString; +class WebURL; +struct WebPoint; +struct WebRect; + +// A container for passing around a reference to AccessibilityObject. +class WebAccessibilityObject { +public: + ~WebAccessibilityObject() { reset(); } + + WebAccessibilityObject() { } + WebAccessibilityObject(const WebAccessibilityObject& o) { assign(o); } + WebAccessibilityObject& operator=(const WebAccessibilityObject& o) + { + assign(o); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebAccessibilityObject&); + WEBKIT_EXPORT bool equals(const WebAccessibilityObject&) const; + + bool isNull() const { return m_private.isNull(); } + + // Static methods for enabling accessibility. + WEBKIT_EXPORT static void enableAccessibility(); + WEBKIT_EXPORT static bool accessibilityEnabled(); + + WEBKIT_EXPORT int axID() const; + + WEBKIT_EXPORT WebString accessibilityDescription() const; + WEBKIT_EXPORT WebString actionVerb() const; + WEBKIT_EXPORT bool canSetFocusAttribute() const; + WEBKIT_EXPORT bool canSetValueAttribute() const; + WEBKIT_EXPORT bool isValid() const; + + WEBKIT_EXPORT unsigned childCount() const; + + WEBKIT_EXPORT WebAccessibilityObject childAt(unsigned) const; + WEBKIT_EXPORT WebAccessibilityObject firstChild() const; + WEBKIT_EXPORT WebAccessibilityObject focusedChild() const; + WEBKIT_EXPORT WebAccessibilityObject lastChild() const; + WEBKIT_EXPORT WebAccessibilityObject nextSibling() const; + WEBKIT_EXPORT WebAccessibilityObject parentObject() const; + WEBKIT_EXPORT WebAccessibilityObject previousSibling() const; + + WEBKIT_EXPORT bool canSetSelectedAttribute() const; + + WEBKIT_EXPORT bool isAnchor() const; + WEBKIT_EXPORT bool isAriaReadOnly() const; + WEBKIT_EXPORT bool isButtonStateMixed() const; + WEBKIT_EXPORT bool isChecked() const; + WEBKIT_EXPORT bool isCollapsed() const; + WEBKIT_EXPORT bool isControl() const; + WEBKIT_EXPORT bool isEnabled() const; + WEBKIT_EXPORT bool isFocused() const; + WEBKIT_EXPORT bool isHovered() const; + WEBKIT_EXPORT bool isIndeterminate() const; + WEBKIT_EXPORT bool isLinked() const; + WEBKIT_EXPORT bool isLoaded() const; + WEBKIT_EXPORT bool isMultiSelectable() const; + WEBKIT_EXPORT bool isOffScreen() const; + WEBKIT_EXPORT bool isPasswordField() const; + WEBKIT_EXPORT bool isPressed() const; + WEBKIT_EXPORT bool isReadOnly() const; + WEBKIT_EXPORT bool isRequired() const; + WEBKIT_EXPORT bool isSelected() const; + WEBKIT_EXPORT bool isSelectedOptionActive() const; + WEBKIT_EXPORT bool isVertical() const; + WEBKIT_EXPORT bool isVisible() const; + WEBKIT_EXPORT bool isVisited() const; + + WEBKIT_EXPORT WebString accessKey() const; + WEBKIT_EXPORT bool ariaHasPopup() const; + WEBKIT_EXPORT bool ariaLiveRegionAtomic() const; + WEBKIT_EXPORT bool ariaLiveRegionBusy() const; + WEBKIT_EXPORT WebString ariaLiveRegionRelevant() const; + WEBKIT_EXPORT WebString ariaLiveRegionStatus() const; + WEBKIT_EXPORT WebRect boundingBoxRect() const; + WEBKIT_EXPORT double estimatedLoadingProgress() const; + WEBKIT_EXPORT WebString helpText() const; + WEBKIT_EXPORT int headingLevel() const; + WEBKIT_EXPORT int hierarchicalLevel() const; + WEBKIT_EXPORT WebAccessibilityObject hitTest(const WebPoint&) const; + WEBKIT_EXPORT WebString keyboardShortcut() const; + WEBKIT_EXPORT bool performDefaultAction() const; + WEBKIT_EXPORT WebAccessibilityRole roleValue() const; + WEBKIT_EXPORT unsigned selectionEnd() const; + WEBKIT_EXPORT unsigned selectionStart() const; + WEBKIT_EXPORT void setFocused(bool) const; + WEBKIT_EXPORT WebString stringValue() const; + WEBKIT_EXPORT WebString title() const; + WEBKIT_EXPORT WebAccessibilityObject titleUIElement() const; + WEBKIT_EXPORT WebURL url() const; + + WEBKIT_EXPORT WebString valueDescription() const; + WEBKIT_EXPORT float valueForRange() const; + WEBKIT_EXPORT float maxValueForRange() const; + WEBKIT_EXPORT float minValueForRange() const; + + WEBKIT_EXPORT WebNode node() const; + WEBKIT_EXPORT WebDocument document() const; + WEBKIT_EXPORT bool hasComputedStyle() const; + WEBKIT_EXPORT WebString computedStyleDisplay() const; + WEBKIT_EXPORT bool accessibilityIsIgnored() const; + WEBKIT_EXPORT bool lineBreaks(WebVector<int>&) const; + + // For a table + WEBKIT_EXPORT unsigned columnCount() const; + WEBKIT_EXPORT unsigned rowCount() const; + WEBKIT_EXPORT WebAccessibilityObject cellForColumnAndRow(unsigned column, unsigned row) const; + + // For a table cell + WEBKIT_EXPORT unsigned cellColumnIndex() const; + WEBKIT_EXPORT unsigned cellColumnSpan() const; + WEBKIT_EXPORT unsigned cellRowIndex() const; + WEBKIT_EXPORT unsigned cellRowSpan() const; + +#if WEBKIT_IMPLEMENTATION + WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); + WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&); + operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const; +#endif + +private: + WebPrivatePtr<WebCore::AccessibilityObject> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebAccessibilityRole.h b/Source/WebKit/chromium/public/WebAccessibilityRole.h new file mode 100644 index 000000000..196845730 --- /dev/null +++ b/Source/WebKit/chromium/public/WebAccessibilityRole.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAccessibilityRole_h +#define WebAccessibilityRole_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// These values must match WebCore::AccessibilityRole values +enum WebAccessibilityRole { + WebAccessibilityRoleAnnotation = 1, + WebAccessibilityRoleApplication, + WebAccessibilityRoleApplicationAlert, + WebAccessibilityRoleApplicationAlertDialog, + WebAccessibilityRoleApplicationDialog, + WebAccessibilityRoleApplicationLog, + WebAccessibilityRoleApplicationMarquee, + WebAccessibilityRoleApplicationStatus, + WebAccessibilityRoleApplicationTimer, + WebAccessibilityRoleBrowser, + WebAccessibilityRoleBusyIndicator, + WebAccessibilityRoleButton, + WebAccessibilityRoleCell, + WebAccessibilityRoleCheckBox, + WebAccessibilityRoleColorWell, + WebAccessibilityRoleColumn, + WebAccessibilityRoleColumnHeader, + WebAccessibilityRoleComboBox, + WebAccessibilityRoleDefinitionListTerm, + WebAccessibilityRoleDefinitionListDefinition, + WebAccessibilityRoleDirectory, + WebAccessibilityRoleDisclosureTriangle, + WebAccessibilityRoleDiv, + WebAccessibilityRoleDocument, + WebAccessibilityRoleDocumentArticle, + WebAccessibilityRoleDocumentMath, + WebAccessibilityRoleDocumentNote, + WebAccessibilityRoleDocumentRegion, + WebAccessibilityRoleDrawer, + WebAccessibilityRoleEditableText, + WebAccessibilityRoleForm, + WebAccessibilityRoleGrid, + WebAccessibilityRoleGroup, + WebAccessibilityRoleGrowArea, + WebAccessibilityRoleHeading, + WebAccessibilityRoleHelpTag, + WebAccessibilityRoleIgnored, + WebAccessibilityRoleImage, + WebAccessibilityRoleImageMap, + WebAccessibilityRoleImageMapLink, + WebAccessibilityRoleIncrementor, + WebAccessibilityRoleLabel, + WebAccessibilityRoleLandmarkApplication, + WebAccessibilityRoleLandmarkBanner, + WebAccessibilityRoleLandmarkComplementary, + WebAccessibilityRoleLandmarkContentInfo, + WebAccessibilityRoleLandmarkMain, + WebAccessibilityRoleLandmarkNavigation, + WebAccessibilityRoleLandmarkSearch, + WebAccessibilityRoleLink, + WebAccessibilityRoleList, + WebAccessibilityRoleListBox, + WebAccessibilityRoleListBoxOption, + WebAccessibilityRoleListItem, + WebAccessibilityRoleListMarker, + WebAccessibilityRoleMatte, + WebAccessibilityRoleMenu, + WebAccessibilityRoleMenuBar, + WebAccessibilityRoleMenuButton, + WebAccessibilityRoleMenuItem, + WebAccessibilityRoleMenuListPopup, + WebAccessibilityRoleMenuListOption, + WebAccessibilityRoleOutline, + WebAccessibilityRoleParagraph, + WebAccessibilityRolePopUpButton, + WebAccessibilityRolePresentational, + WebAccessibilityRoleProgressIndicator, + WebAccessibilityRoleRadioButton, + WebAccessibilityRoleRadioGroup, + WebAccessibilityRoleRowHeader, + WebAccessibilityRoleRow, + WebAccessibilityRoleRuler, + WebAccessibilityRoleRulerMarker, + WebAccessibilityRoleScrollArea, + WebAccessibilityRoleScrollBar, + WebAccessibilityRoleSheet, + WebAccessibilityRoleSlider, + WebAccessibilityRoleSliderThumb, + WebAccessibilityRoleSpinButton, + WebAccessibilityRoleSpinButtonPart, + WebAccessibilityRoleSplitGroup, + WebAccessibilityRoleSplitter, + WebAccessibilityRoleStaticText, + WebAccessibilityRoleSystemWide, + WebAccessibilityRoleTabGroup, + WebAccessibilityRoleTabList, + WebAccessibilityRoleTabPanel, + WebAccessibilityRoleTab, + WebAccessibilityRoleTable, + WebAccessibilityRoleTableHeaderContainer, + WebAccessibilityRoleTextArea, + WebAccessibilityRoleTreeRole, + WebAccessibilityRoleTreeGrid, + WebAccessibilityRoleTreeItemRole, + WebAccessibilityRoleTextField, + WebAccessibilityRoleToolbar, + WebAccessibilityRoleUnknown, + WebAccessibilityRoleUserInterfaceTooltip, + WebAccessibilityRoleValueIndicator, + WebAccessibilityRoleWebArea, + WebAccessibilityRoleWebCoreLink, + WebAccessibilityRoleWindow, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebAnimationController.h b/Source/WebKit/chromium/public/WebAnimationController.h new file mode 100644 index 000000000..8b13eb8ba --- /dev/null +++ b/Source/WebKit/chromium/public/WebAnimationController.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAnimationController_h +#define WebAnimationController_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebElement; +class WebString; +class WebURL; + +// WebAnimationController can be used to control animations in a frame. It is +// owned by a WebFrame and its life span is bound to that WebFrame. +class WebAnimationController { +public: + virtual bool pauseAnimationAtTime(WebElement&, + const WebString& animationName, + double time) = 0; + virtual bool pauseTransitionAtTime(WebElement&, + const WebString& propertyName, + double time) = 0; + + virtual unsigned numberOfActiveAnimations() const = 0; + virtual void suspendAnimations() const = 0; + virtual void resumeAnimations() const = 0; + +protected: + ~WebAnimationController() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebApplicationCacheHost.h b/Source/WebKit/chromium/public/WebApplicationCacheHost.h new file mode 100644 index 000000000..bd5221807 --- /dev/null +++ b/Source/WebKit/chromium/public/WebApplicationCacheHost.h @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebApplicationCacheHost_h +#define WebApplicationCacheHost_h + +#include "platform/WebCommon.h" +#include "platform/WebURL.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebApplicationCacheHostClient; +class WebFrame; +class WebURL; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +// This interface is used by webkit to call out to the embedder. Webkit uses +// the WebFrameClient::createApplicationCacheHost method to create instances, +// and calls delete when the instance is no longer needed. +class WebApplicationCacheHost { +public: + // These values must match WebCore::ApplicationCacheHost::Status values + enum Status { + Uncached, + Idle, + Checking, + Downloading, + UpdateReady, + Obsolete + }; + + // These values must match WebCore::ApplicationCacheHost::EventID values + enum EventID { + CheckingEvent, + ErrorEvent, + NoUpdateEvent, + DownloadingEvent, + ProgressEvent, + UpdateReadyEvent, + CachedEvent, + ObsoleteEvent + }; + + virtual ~WebApplicationCacheHost() { } + + // Called for every request made within the context. + virtual void willStartMainResourceRequest(WebURLRequest& r, const WebFrame*) { } + virtual void willStartSubResourceRequest(WebURLRequest&) { } + + // One or the other selectCache methods is called after having parsed the <html> tag. + // The latter returns false if the current document has been identified as a "foreign" + // entry, in which case the frame navigation will be restarted by webkit. + virtual void selectCacheWithoutManifest() { } + virtual bool selectCacheWithManifest(const WebURL& manifestURL) { return true; } + + // Called as the main resource is retrieved. + virtual void didReceiveResponseForMainResource(const WebURLResponse&) { } + virtual void didReceiveDataForMainResource(const char* data, int len) { } + virtual void didFinishLoadingMainResource(bool success) { } + + // Called on behalf of the scriptable interface. + virtual Status status() { return Uncached; } + virtual bool startUpdate() { return false; } + virtual bool swapCache() { return false; } + + // Structures and methods to support inspecting Application Caches. + struct CacheInfo { + WebURL manifestURL; // Empty if there is no associated cache. + double creationTime; + double updateTime; + long long totalSize; + CacheInfo() : creationTime(0), updateTime(0), totalSize(0) { } + }; + struct ResourceInfo { + WebURL url; + long long size; + bool isMaster; + bool isManifest; + bool isExplicit; + bool isForeign; + bool isFallback; + ResourceInfo() : size(0), isMaster(false), isManifest(false), isExplicit(false), isForeign(false), isFallback(false) { } + }; + virtual void getAssociatedCacheInfo(CacheInfo*) { } + virtual void getResourceList(WebVector<ResourceInfo>*) { } + virtual void deleteAssociatedCacheGroup() { } +}; + +} // namespace WebKit + +#endif // WebApplicationCacheHost_h diff --git a/Source/WebKit/chromium/public/WebApplicationCacheHostClient.h b/Source/WebKit/chromium/public/WebApplicationCacheHostClient.h new file mode 100644 index 000000000..da57a4b33 --- /dev/null +++ b/Source/WebKit/chromium/public/WebApplicationCacheHostClient.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebApplicationCacheHostClient_h +#define WebApplicationCacheHostClient_h + +#include "WebApplicationCacheHost.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +// This interface is used by the embedder to call into webkit. +class WebApplicationCacheHostClient { +public: + // Called when a different cache, including possibly no cache, is associated with the host. + virtual void didChangeCacheAssociation() = 0; + + // Called to fire events in the scriptable interface. + virtual void notifyEventListener(WebApplicationCacheHost::EventID) = 0; + virtual void notifyProgressEventListener(const WebURL&, int num_total, int num_complete) = 0; + +protected: + // Should not be deleted by the embedder. + virtual ~WebApplicationCacheHostClient() { } +}; + +} // namespace WebKit + +#endif // WebApplicationCacheHostClient_h + diff --git a/Source/WebKit/chromium/public/WebArrayBuffer.h b/Source/WebKit/chromium/public/WebArrayBuffer.h new file mode 100644 index 000000000..81c9cb83b --- /dev/null +++ b/Source/WebKit/chromium/public/WebArrayBuffer.h @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebArrayBuffer_h +#define WebArrayBuffer_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +#if WEBKIT_USING_V8 +namespace v8 { +class Value; +template <class T> class Handle; +} +#endif + +namespace WTF { class ArrayBuffer; } + +namespace WebKit { + +class WebArrayBuffer { +public: + ~WebArrayBuffer() { reset(); } + + WebArrayBuffer() { } + WebArrayBuffer(const WebArrayBuffer& b) { assign(b); } + WebArrayBuffer& operator=(const WebArrayBuffer& b) + { + assign(b); + return *this; + } + + WEBKIT_EXPORT static WebArrayBuffer create(unsigned numElements, unsigned elementByteSize); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebArrayBuffer&); + + bool isNull() const { return m_private.isNull(); } + WEBKIT_EXPORT void* data() const; + WEBKIT_EXPORT unsigned byteLength() const; + +#if WEBKIT_USING_V8 + WEBKIT_EXPORT v8::Handle<v8::Value> toV8Value(); +#endif + +#if WEBKIT_IMPLEMENTATION + WebArrayBuffer(const WTF::PassRefPtr<WTF::ArrayBuffer>&); + WebArrayBuffer& operator=(const PassRefPtr<WTF::ArrayBuffer>&); + operator WTF::PassRefPtr<WTF::ArrayBuffer>() const; +#endif + +protected: + WebPrivatePtr<WTF::ArrayBuffer> m_private; +}; + +} // namespace WebKit + +#endif // WebArrayBuffer_h diff --git a/Source/WebKit/chromium/public/WebAttribute.h b/Source/WebKit/chromium/public/WebAttribute.h new file mode 100644 index 000000000..ff4b3a7f8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebAttribute.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAttribute_h +#define WebAttribute_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class Attribute; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM attribute. +class WebAttribute { +public: + ~WebAttribute() { reset(); } + + WebAttribute() { } + WebAttribute(const WebAttribute& n) { assign(n); } + WebAttribute& operator=(const WebAttribute& n) + { + assign(n); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebAttribute&); + + WEBKIT_EXPORT WebString localName() const; + WEBKIT_EXPORT WebString value() const; + +#if WEBKIT_IMPLEMENTATION + WebAttribute(const WTF::PassRefPtr<WebCore::Attribute>&); +#endif + +private: + WebPrivatePtr<WebCore::Attribute> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebAudioSourceProvider.h b/Source/WebKit/chromium/public/WebAudioSourceProvider.h new file mode 100644 index 000000000..c0010f806 --- /dev/null +++ b/Source/WebKit/chromium/public/WebAudioSourceProvider.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011, Google 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. + */ + +#ifndef WebAudioSourceProvider_h +#define WebAudioSourceProvider_h + +#include "platform/WebVector.h" + +namespace WebKit { + +class WebAudioSourceProviderClient; + +// Abstract interface for a pull-model client. +class WebAudioSourceProvider { +public: + // provideInput() gets called repeatedly to render time-slices of a continuous audio stream. + virtual void provideInput(const WebVector<float*>& audioData, size_t numberOfFrames) = 0; + + // If a client is set, we call it back when the audio format is available. + virtual void setClient(WebAudioSourceProviderClient*) { }; + + virtual ~WebAudioSourceProvider() { } +}; + +} // WebKit + +#endif // WebAudioSourceProvider_h diff --git a/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h b/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h new file mode 100644 index 000000000..ab21a0e0c --- /dev/null +++ b/Source/WebKit/chromium/public/WebAudioSourceProviderClient.h @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2011, Google 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. + */ + +#ifndef WebAudioSourceProviderClient_h +#define WebAudioSourceProviderClient_h + +namespace WebKit { + +class WebAudioSourceProviderClient { +public: + virtual void setFormat(size_t numberOfChannels, float sampleRate) = 0; +protected: + virtual ~WebAudioSourceProviderClient() { } +}; + +} // WebKit + +#endif // WebAudioSourceProviderClient_h diff --git a/Source/WebKit/chromium/public/WebAutofillClient.h b/Source/WebKit/chromium/public/WebAutofillClient.h new file mode 100644 index 000000000..5824f170a --- /dev/null +++ b/Source/WebKit/chromium/public/WebAutofillClient.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebAutofillClient_h +#define WebAutofillClient_h + +namespace WebKit { + +class WebInputElement; +class WebKeyboardEvent; +class WebNode; +class WebString; + +class WebAutofillClient { +public: + // Informs the browser that the user has accepted an Autofill suggestion for + // a WebNode. |uniqueID| is used as a key into the set of Autofill profiles, + // and should never be negative. If it is 0, then the suggestion is an + // Autocomplete suggestion; and |value| stores the suggested text. |index| + // is an index of the selected suggestion in the list of suggestions provided + // by the client. + virtual void didAcceptAutofillSuggestion(const WebNode&, + const WebString& value, + const WebString& label, + int uniqueID, + unsigned index) { } + + // Informs the browser that the user has selected an Autofill suggestion for + // a WebNode. This happens when the user hovers over a suggestion or uses + // the arrow keys to navigate to a suggestion. + virtual void didSelectAutofillSuggestion(const WebNode&, + const WebString& name, + const WebString& label, + int uniqueID) { } + + // Informs the browser that the user has cleared the selection from the + // Autofill suggestions popup. This happens when a user uses the arrow + // keys to navigate outside the range of possible selections. + virtual void didClearAutofillSelection(const WebNode&) { } + + // Instructs the browser to remove the Autocomplete entry specified from + // its DB. + virtual void removeAutocompleteSuggestion(const WebString& name, + const WebString& value) { } + + // These methods are called when the users edits a text-field. + virtual void textFieldDidEndEditing(const WebInputElement&) { } + virtual void textFieldDidChange(const WebInputElement&) { } + virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKeyboardEvent&) { } + +protected: + ~WebAutofillClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebBindings.h b/Source/WebKit/chromium/public/WebBindings.h new file mode 100644 index 000000000..34a320557 --- /dev/null +++ b/Source/WebKit/chromium/public/WebBindings.h @@ -0,0 +1,180 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebBindings_h +#define WebBindings_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" +#include <bindings/npruntime.h> + +#if WEBKIT_USING_V8 +namespace v8 { +class Value; +template <class T> class Handle; +template <class T> class Local; +} +#endif + +namespace WebKit { + +class WebArrayBuffer; +class WebArrayBufferView; +class WebDragData; +class WebElement; +class WebNode; +class WebRange; + +// A haphazard collection of functions for dealing with plugins. +class WebBindings { +public: + // NPN Functions ------------------------------------------------------ + // These are all defined in npruntime.h and are well documented. + + // NPN_Construct + WEBKIT_EXPORT static bool construct(NPP, NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); + + // NPN_CreateObject + WEBKIT_EXPORT static NPObject* createObject(NPP, NPClass*); + + // NPN_Enumerate + WEBKIT_EXPORT static bool enumerate(NPP, NPObject*, NPIdentifier**, uint32_t* identifierCount); + + // NPN_Evaluate + WEBKIT_EXPORT static bool evaluate(NPP, NPObject*, NPString* script, NPVariant* result); + + // NPN_EvaluateHelper + WEBKIT_EXPORT static bool evaluateHelper(NPP, bool popupsAllowed, NPObject*, NPString* script, NPVariant* result); + + // NPN_GetIntIdentifier + WEBKIT_EXPORT static NPIdentifier getIntIdentifier(int32_t number); + + // NPN_GetProperty + WEBKIT_EXPORT static bool getProperty(NPP, NPObject*, NPIdentifier property, NPVariant *result); + + // NPN_GetStringIdentifier + WEBKIT_EXPORT static NPIdentifier getStringIdentifier(const NPUTF8* string); + + // NPN_GetStringIdentifiers + WEBKIT_EXPORT static void getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier*); + + // NPN_HasMethod + WEBKIT_EXPORT static bool hasMethod(NPP, NPObject*, NPIdentifier method); + + // NPN_HasProperty + WEBKIT_EXPORT static bool hasProperty(NPP, NPObject*, NPIdentifier property); + + // NPN_IdentifierIsString + WEBKIT_EXPORT static bool identifierIsString(NPIdentifier); + + // NPN_InitializeVariantWithStringCopy (though sometimes prefixed with an underscore) + WEBKIT_EXPORT static void initializeVariantWithStringCopy(NPVariant*, const NPString*); + + // NPN_IntFromIdentifier + WEBKIT_EXPORT static int32_t intFromIdentifier(NPIdentifier); + + // NPN_Invoke + WEBKIT_EXPORT static bool invoke(NPP, NPObject*, NPIdentifier method, const NPVariant* args, uint32_t argCount, NPVariant* result); + + // NPN_InvokeDefault + WEBKIT_EXPORT static bool invokeDefault(NPP, NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); + + // NPN_ReleaseObject + WEBKIT_EXPORT static void releaseObject(NPObject*); + + // NPN_ReleaseVariantValue + WEBKIT_EXPORT static void releaseVariantValue(NPVariant*); + + // NPN_RemoveProperty + WEBKIT_EXPORT static bool removeProperty(NPP, NPObject*, NPIdentifier); + + // NPN_RetainObject + WEBKIT_EXPORT static NPObject* retainObject(NPObject*); + + // NPN_SetException + WEBKIT_EXPORT static void setException(NPObject*, const NPUTF8* message); + + // NPN_SetProperty + WEBKIT_EXPORT static bool setProperty(NPP, NPObject*, NPIdentifier, const NPVariant*); + + // _NPN_UnregisterObject + WEBKIT_EXPORT static void unregisterObject(NPObject*); + + // NPN_UTF8FromIdentifier + WEBKIT_EXPORT static NPUTF8* utf8FromIdentifier(NPIdentifier); + + // Miscellaneous utility functions ---------------------------------------- + + // Complement to NPN_Get___Identifier functions. Extracts data from the NPIdentifier data + // structure. If isString is true upon return, string will be set but number's value is + // undefined. If iString is false, the opposite is true. + WEBKIT_EXPORT static void extractIdentifierData(const NPIdentifier&, const NPUTF8*& string, int32_t& number, bool& isString); + + // DumpRenderTree support ------------------------------------------------- + + // Return true (success) if the given npobj is a range object. + // If so, return that range as a WebRange object. + WEBKIT_EXPORT static bool getRange(NPObject* range, WebRange*); + + // Return true (success) if the given npobj is an ArrayBuffer object. + // If so, return it as a WebArrayBuffer object. + WEBKIT_EXPORT static bool getArrayBuffer(NPObject* arrayBuffer, WebArrayBuffer*); + + // Return true (success) if the given npobj is an ArrayBufferView object. + // If so, return it as a WebArrayBufferView object. + WEBKIT_EXPORT static bool getArrayBufferView(NPObject* arrayBufferView, WebArrayBufferView*); + + // Return true (success) if the given npobj is an element. + // If so, return that element as a WebElement object. + WEBKIT_EXPORT static bool getElement(NPObject* element, WebElement*); + + WEBKIT_EXPORT static NPObject* makeIntArray(const WebVector<int>&); + WEBKIT_EXPORT static NPObject* makeStringArray(const WebVector<WebString>&); + + // Exceptions ------------------------------------------------------------- + + typedef void (ExceptionHandler)(void* data, const NPUTF8* message); + + // The exception handler will be notified of any exceptions thrown while + // operating on a NPObject. + WEBKIT_EXPORT static void pushExceptionHandler(ExceptionHandler, void* data); + WEBKIT_EXPORT static void popExceptionHandler(); + +#if WEBKIT_USING_V8 + // Conversion utilities to/from V8 native objects and NPVariant wrappers. + WEBKIT_EXPORT static void toNPVariant(v8::Local<v8::Value>, NPObject* root, NPVariant* result); + WEBKIT_EXPORT static v8::Handle<v8::Value> toV8Value(const NPVariant*); +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebBlob.h b/Source/WebKit/chromium/public/WebBlob.h new file mode 100644 index 000000000..a9c05f4e7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebBlob.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebBlob_h +#define WebBlob_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" + +#if WEBKIT_USING_V8 +namespace v8 { +class Value; +template <class T> class Handle; +} +#endif + +namespace WebCore { class Blob; } + +namespace WebKit { + +class WebBlob { +public: + ~WebBlob() { reset(); } + + WebBlob() { } + WebBlob(const WebBlob& b) { assign(b); } + WebBlob& operator=(const WebBlob& b) + { + assign(b); + return *this; + } + + WEBKIT_EXPORT static WebBlob createFromFile(const WebString& path, long long size); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebBlob&); + + bool isNull() const { return m_private.isNull(); } + +#if WEBKIT_USING_V8 + WEBKIT_EXPORT v8::Handle<v8::Value> toV8Value(); +#endif + +#if WEBKIT_IMPLEMENTATION + WebBlob(const WTF::PassRefPtr<WebCore::Blob>&); + WebBlob& operator=(const WTF::PassRefPtr<WebCore::Blob>&); + operator WTF::PassRefPtr<WebCore::Blob>() const; +#endif + +protected: + WebPrivatePtr<WebCore::Blob> m_private; +}; + +} // namespace WebKit + +#endif // WebBlob_h diff --git a/Source/WebKit/chromium/public/WebCache.h b/Source/WebKit/chromium/public/WebCache.h new file mode 100644 index 000000000..d17d0c700 --- /dev/null +++ b/Source/WebKit/chromium/public/WebCache.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCache_h +#define WebCache_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// An interface to query and configure WebKit's resource cache. +class WebCache { +public: + struct UsageStats { + // Capacities. + size_t minDeadCapacity; + size_t maxDeadCapacity; + size_t capacity; + // Utilization. + size_t liveSize; + size_t deadSize; + }; + + // A struct mirroring WebCore::MemoryCache::TypeStatistic. + struct ResourceTypeStat { + size_t count; + size_t size; + size_t liveSize; + size_t decodedSize; + }; + + // A struct mirroring WebCore::MemoryCache::Statistics. + struct ResourceTypeStats { + ResourceTypeStat images; + ResourceTypeStat cssStyleSheets; + ResourceTypeStat scripts; + ResourceTypeStat xslStyleSheets; + ResourceTypeStat fonts; + }; + + // Sets the capacities of the resource cache, evicting objects as necessary. + WEBKIT_EXPORT static void setCapacities(size_t minDeadCapacity, + size_t maxDeadCapacity, + size_t capacity); + + // Clears the cache (as much as possible; some resources may not be + // cleared if they are actively referenced). Note that this method + // only removes resources from live list, w/o releasing cache memory. + WEBKIT_EXPORT static void clear(); + + // Prunes resource cache. Destroys decoded images data and returns + // memory to the system. + WEBKIT_EXPORT static void prune(); + + // Gets the usage statistics from the resource cache. + WEBKIT_EXPORT static void getUsageStats(UsageStats*); + + // Get usage stats about the resource cache. + WEBKIT_EXPORT static void getResourceTypeStats(ResourceTypeStats*); + +private: + WebCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebColorChooser.h b/Source/WebKit/chromium/public/WebColorChooser.h new file mode 100644 index 000000000..057f66e67 --- /dev/null +++ b/Source/WebKit/chromium/public/WebColorChooser.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebColorChooser_h +#define WebColorChooser_h + +#include "platform/WebColor.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +// This represents a color chooser. +class WebColorChooser { +public: + virtual ~WebColorChooser() { } + + // Set selected color in the color chooser. + virtual void setSelectedColor(const WebColor color) { } + + // Calling this ends the color chooser and the client won't be recieving + // didChooseColor callbacks anymore. + virtual void endChooser() { } +}; + +} + +#endif // WebColorChooser_h diff --git a/Source/WebKit/chromium/public/WebColorChooserClient.h b/Source/WebKit/chromium/public/WebColorChooserClient.h new file mode 100644 index 000000000..a80a984c7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebColorChooserClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebColorChooserClient_h +#define WebColorChooserClient_h + +#include "platform/WebColor.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +// Receives calls from WebColorChooser and passes it to the WebCore side. +class WebColorChooserClient { +public: + virtual ~WebColorChooserClient() { } + + // Called when user selects a color in the color chooser. + virtual void didChooseColor(const WebColor&) { } + + // Called when color chooser has ended. + virtual void didEndChooser() { } +}; + +} + +#endif // WebColorChooserClient_h diff --git a/Source/WebKit/chromium/public/WebCommonWorkerClient.h b/Source/WebKit/chromium/public/WebCommonWorkerClient.h new file mode 100644 index 000000000..2ffb54d57 --- /dev/null +++ b/Source/WebKit/chromium/public/WebCommonWorkerClient.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCommonWorkerClient_h +#define WebCommonWorkerClient_h + +#include "platform/WebCommon.h" +#include "platform/WebFileSystem.h" + +namespace WebKit { + +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebFrame; +class WebNotificationPresenter; +class WebString; +class WebWorker; +class WebWorkerClient; + +class WebCommonWorkerClient { +public: + // Called on the main webkit thread before opening a web database. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; + + // Called on the main webkit thread before opening a file system. + virtual bool allowFileSystem() = 0; + + // Called on the main webkit thread before opening a file system. + virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) = 0; +}; + + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCompositionUnderline.h b/Source/WebKit/chromium/public/WebCompositionUnderline.h new file mode 100644 index 000000000..74a8701bb --- /dev/null +++ b/Source/WebKit/chromium/public/WebCompositionUnderline.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCompositionUnderline_h +#define WebCompositionUnderline_h + +#include "platform/WebColor.h" + +namespace WebKit { + +// Class WebCompositionUnderline is intended to be used with WebWidget's +// setComposition() method. +struct WebCompositionUnderline { + WebCompositionUnderline() + : startOffset(0) + , endOffset(0) + , color(0) + , thick(false) { } + + WebCompositionUnderline(unsigned s, unsigned e, WebColor c, bool t) + : startOffset(s) + , endOffset(e) + , color(c) + , thick(t) { } + + unsigned startOffset; + unsigned endOffset; + WebColor color; + bool thick; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCompositor.h b/Source/WebKit/chromium/public/WebCompositor.h new file mode 100644 index 000000000..32b60e284 --- /dev/null +++ b/Source/WebKit/chromium/public/WebCompositor.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebCompositor_h +#define WebCompositor_h + +#include "WebCompositorInputHandler.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebInputEvent; +class WebThread; + +#define WEBCOMPOSITOR_HAS_INITIALIZE + +// This class contains global routines for interacting with the +// compositor. +// +// All calls to the WebCompositor must be made from the main thread. +// +// This class currently temporarily inherits from WebCompositorInputHandler +// while we migrate downstream code to use WebCompositorInputHandler directly. +class WebCompositor : public WebCompositorInputHandler { +public: + // Initializes the compositor. Threaded compositing is enabled by passing in + // a non-null WebThread. No compositor classes or methods should be used + // prior to calling initialize. + WEBKIT_EXPORT static void initialize(WebThread*); + + // Shuts down the compositor. This must be called when all compositor data + // types have been deleted. No compositor classes or methods should be used + // after shutdown. + WEBKIT_EXPORT static void shutdown(); + +protected: + virtual ~WebCompositor() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCompositorClient.h b/Source/WebKit/chromium/public/WebCompositorClient.h new file mode 100644 index 000000000..c275f7055 --- /dev/null +++ b/Source/WebKit/chromium/public/WebCompositorClient.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebCompositorClient_h +#define WebCompositorClient_h + +#include "WebCompositorInputHandlerClient.h" + +namespace WebKit { + +// This class will go away once downstream code has transitioned +// to WebCompositorInputHandlerClient. +class WebCompositorClient : public WebCompositorInputHandlerClient { +public: +protected: + virtual ~WebCompositorClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandler.h b/Source/WebKit/chromium/public/WebCompositorInputHandler.h new file mode 100644 index 000000000..bc58748bd --- /dev/null +++ b/Source/WebKit/chromium/public/WebCompositorInputHandler.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebCompositorInputHandler_h +#define WebCompositorInputHandler_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebCompositor; +class WebCompositorInputHandlerClient; +class WebInputEvent; +class WebThread; + +// This represents the compositor associated with a WebWidget. All calls to the WebCompositor must +// be made from the compositor thread. +class WebCompositorInputHandler { +public: + // The return value is temporarily WebCompositor until all downstream code + // is switched to use WebCompositorInputHandler. + WEBKIT_EXPORT static WebCompositor* fromIdentifier(int); + + virtual void setClient(WebCompositorInputHandlerClient*) = 0; + virtual void handleInputEvent(const WebInputEvent&) = 0; + +protected: + virtual ~WebCompositorInputHandler() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h new file mode 100644 index 000000000..e8bb55598 --- /dev/null +++ b/Source/WebKit/chromium/public/WebCompositorInputHandlerClient.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebCompositorInputHandlerClient_h +#define WebCompositorInputHandlerClient_h + +namespace WebKit { + +class WebCompositorInputHandlerClient { +public: + // Callbacks invoked from the compositor thread. + virtual void willShutdown() = 0; + + // Exactly one of the following two callbacks will be invoked after every call to WebCompositor::handleInputEvent(): + + // Called when the WebCompositor handled the input event and no further processing is required. + virtual void didHandleInputEvent() = 0; + + // Called when the WebCompositor did not handle the input event. If sendToWidget is true, the input event + // should be forwarded to the WebWidget associated with this compositor for further processing. + virtual void didNotHandleInputEvent(bool sendToWidget) = 0; + +protected: + virtual ~WebCompositorInputHandlerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebConsoleMessage.h b/Source/WebKit/chromium/public/WebConsoleMessage.h new file mode 100644 index 000000000..5f16d5802 --- /dev/null +++ b/Source/WebKit/chromium/public/WebConsoleMessage.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebConsoleMessage_h +#define WebConsoleMessage_h + +#include "platform/WebString.h" + +namespace WebKit { + +struct WebConsoleMessage { + enum Level { + LevelTip, + LevelLog, + LevelWarning, + LevelError + }; + + Level level; + WebString text; + + WebConsoleMessage() + : level(LevelLog) { } + WebConsoleMessage(Level level, const WebString& text) + : level(level) + , text(text) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebContextMenuData.h b/Source/WebKit/chromium/public/WebContextMenuData.h new file mode 100644 index 000000000..e17e23717 --- /dev/null +++ b/Source/WebKit/chromium/public/WebContextMenuData.h @@ -0,0 +1,183 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebContextMenuData_h +#define WebContextMenuData_h + +#include "WebHistoryItem.h" +#include "WebMenuItemInfo.h" +#include "WebNode.h" +#include "WebReferrerPolicy.h" +#include "platform/WebPoint.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" +#include "platform/WebVector.h" + +#define WEBCONTEXT_MEDIATYPEFILE_DEFINED + +namespace WebKit { + +// This struct is passed to WebViewClient::ShowContextMenu. +struct WebContextMenuData { + enum MediaType { + // No special node is in context. + MediaTypeNone, + // An image node is selected. + MediaTypeImage, + // A video node is selected. + MediaTypeVideo, + // An audio node is selected. + MediaTypeAudio, + // A file node is selected. + MediaTypeFile, + // A plugin node is selected. + MediaTypePlugin, + }; + // The type of media the context menu is being invoked on. + MediaType mediaType; + + // The x and y position of the mouse pointer (relative to the webview). + WebPoint mousePosition; + + // The absolute URL of the link that is in context. + WebURL linkURL; + + // The absolute URL of the image/video/audio that is in context. + WebURL srcURL; + + // Whether the image in context has been blocked. + bool isImageBlocked; + + // The absolute URL of the page in context. + WebURL pageURL; + + // The absolute keyword search URL including the %s search tag when the + // "Add as search engine..." option is clicked (left empty if not used). + WebURL keywordURL; + + // The absolute URL of the subframe in context. + WebURL frameURL; + + // The encoding for the frame in context. + WebString frameEncoding; + + // History state of the subframe in context. + WebHistoryItem frameHistoryItem; + + enum MediaFlags { + MediaNone = 0x0, + MediaInError = 0x1, + MediaPaused = 0x2, + MediaMuted = 0x4, + MediaLoop = 0x8, + MediaCanSave = 0x10, + MediaHasAudio = 0x20, + MediaHasVideo = 0x40, + MediaControlRootElement = 0x80, + MediaCanPrint = 0x100, + }; + + // Extra attributes describing media elements. + int mediaFlags; + + // The raw text of the selection in context. + WebString selectedText; + + // Whether speech input is enabled. + bool isSpeechInputEnabled; + + // Whether spell checking is enabled. + bool isSpellCheckingEnabled; + + // The editable (possibily) misspelled word. + WebString misspelledWord; + + // If misspelledWord is not empty, holds suggestions from the dictionary. + WebVector<WebString> dictionarySuggestions; + + // Whether context is editable. + bool isEditable; + + enum CheckableMenuItemFlags { + CheckableMenuItemDisabled = 0x0, + CheckableMenuItemEnabled = 0x1, + CheckableMenuItemChecked = 0x2, + }; + + // Writing direction menu items - values are unions of + // CheckableMenuItemFlags. + // Currently only used on OS X. + int writingDirectionDefault; + int writingDirectionLeftToRight; + int writingDirectionRightToLeft; + + enum EditFlags { + CanDoNone = 0x0, + CanUndo = 0x1, + CanRedo = 0x2, + CanCut = 0x4, + CanCopy = 0x8, + CanPaste = 0x10, + CanDelete = 0x20, + CanSelectAll = 0x40, + CanTranslate = 0x80, + }; + + // Which edit operations are available in the context. + int editFlags; + + // Security information for the context. + WebCString securityInfo; + + // The referrer policy applicable to this context. + WebReferrerPolicy referrerPolicy; + + // Custom context menu items provided by the WebCore internals. + WebVector<WebMenuItemInfo> customItems; + + // The node that was clicked. + WebNode node; + + WebContextMenuData() + : mediaType(MediaTypeNone) + , isImageBlocked(false) + , mediaFlags(MediaNone) + , isSpeechInputEnabled(false) + , isSpellCheckingEnabled(false) + , isEditable(false) + , writingDirectionDefault(CheckableMenuItemDisabled) + , writingDirectionLeftToRight(CheckableMenuItemEnabled) + , writingDirectionRightToLeft(CheckableMenuItemEnabled) + , editFlags(0) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h b/Source/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h new file mode 100644 index 000000000..025f35ddf --- /dev/null +++ b/Source/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCrossOriginPreflightResultCache_h +#define WebCrossOriginPreflightResultCache_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// An interface to configure WebKit's cross-origin preflight result cache. +class WebCrossOriginPreflightResultCache { +public: + // Clears the cache. + WEBKIT_EXPORT static void clear(); + +private: + WebCrossOriginPreflightResultCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebCursorInfo.h b/Source/WebKit/chromium/public/WebCursorInfo.h new file mode 100644 index 000000000..cc8bc59bd --- /dev/null +++ b/Source/WebKit/chromium/public/WebCursorInfo.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCursorInfo_h +#define WebCursorInfo_h + +#include "platform/WebImage.h" +#include "platform/WebPoint.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Cursor; } +#endif + +#ifdef WIN32 +typedef struct HICON__* HICON; +typedef HICON HCURSOR; +#endif + +namespace WebKit { + +struct WebCursorInfo { + enum Type { + TypePointer, + TypeCross, + TypeHand, + TypeIBeam, + TypeWait, + TypeHelp, + TypeEastResize, + TypeNorthResize, + TypeNorthEastResize, + TypeNorthWestResize, + TypeSouthResize, + TypeSouthEastResize, + TypeSouthWestResize, + TypeWestResize, + TypeNorthSouthResize, + TypeEastWestResize, + TypeNorthEastSouthWestResize, + TypeNorthWestSouthEastResize, + TypeColumnResize, + TypeRowResize, + TypeMiddlePanning, + TypeEastPanning, + TypeNorthPanning, + TypeNorthEastPanning, + TypeNorthWestPanning, + TypeSouthPanning, + TypeSouthEastPanning, + TypeSouthWestPanning, + TypeWestPanning, + TypeMove, + TypeVerticalText, + TypeCell, + TypeContextMenu, + TypeAlias, + TypeProgress, + TypeNoDrop, + TypeCopy, + TypeNone, + TypeNotAllowed, + TypeZoomIn, + TypeZoomOut, + TypeGrab, + TypeGrabbing, + TypeCustom + }; + + Type type; + WebPoint hotSpot; + WebImage customImage; + +#ifdef WIN32 + // On Windows, TypeCustom may alternatively reference an externally + // defined HCURSOR. If type is TypeCustom and externalHandle is non- + // null, then customData should be ignored. The WebCursorInfo is not + // responsible for managing the lifetime of this cursor handle. + HCURSOR externalHandle; +#endif + + explicit WebCursorInfo(Type type = TypePointer) + : type(type) + { +#ifdef WIN32 + externalHandle = 0; +#endif + } + +#if WEBKIT_IMPLEMENTATION + explicit WebCursorInfo(const WebCore::Cursor&); +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMEvent.h b/Source/WebKit/chromium/public/WebDOMEvent.h new file mode 100644 index 000000000..ec3877c43 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMEvent.h @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDOMEvent_h +#define WebDOMEvent_h + +#include "WebNode.h" +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebCore { class Event; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDOMEvent { +public: + enum PhaseType { + CapturingPhase = 1, + AtTarget = 2, + BubblingPhase = 3 + }; + + ~WebDOMEvent() { reset(); } + + WebDOMEvent() : m_private(0) { } + WebDOMEvent(const WebDOMEvent& e) : m_private(0) { assign(e); } + WebDOMEvent& operator=(const WebDOMEvent& e) + { + assign(e); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebDOMEvent&); + + bool isNull() const { return !m_private; } + + WEBKIT_EXPORT WebString type() const; + WEBKIT_EXPORT WebNode target() const; + WEBKIT_EXPORT WebNode currentTarget() const; + + WEBKIT_EXPORT PhaseType eventPhase() const; + WEBKIT_EXPORT bool bubbles() const; + WEBKIT_EXPORT bool cancelable() const; + + WEBKIT_EXPORT bool isUIEvent() const; + WEBKIT_EXPORT bool isMouseEvent() const; + WEBKIT_EXPORT bool isMutationEvent() const; + WEBKIT_EXPORT bool isKeyboardEvent() const; + WEBKIT_EXPORT bool isTextEvent() const; + WEBKIT_EXPORT bool isCompositionEvent() const; + WEBKIT_EXPORT bool isDragEvent() const; + WEBKIT_EXPORT bool isClipboardEvent() const; + WEBKIT_EXPORT bool isMessageEvent() const; + WEBKIT_EXPORT bool isWheelEvent() const; + WEBKIT_EXPORT bool isBeforeTextInsertedEvent() const; + WEBKIT_EXPORT bool isOverflowEvent() const; + WEBKIT_EXPORT bool isPageTransitionEvent() const; + WEBKIT_EXPORT bool isPopStateEvent() const; + WEBKIT_EXPORT bool isProgressEvent() const; + WEBKIT_EXPORT bool isXMLHttpRequestProgressEvent() const; + WEBKIT_EXPORT bool isWebKitAnimationEvent() const; + WEBKIT_EXPORT bool isWebKitTransitionEvent() const; + WEBKIT_EXPORT bool isBeforeLoadEvent() const; + +#if WEBKIT_IMPLEMENTATION + WebDOMEvent(const WTF::PassRefPtr<WebCore::Event>&); + operator WTF::PassRefPtr<WebCore::Event>() const; +#endif + + template<typename T> T to() + { + T res; + res.WebDOMEvent::assign(*this); + return res; + } + + template<typename T> const T toConst() const + { + T res; + res.WebDOMEvent::assign(*this); + return res; + } + +protected: + typedef WebCore::Event WebDOMEventPrivate; + void assign(WebDOMEventPrivate*); + WebDOMEventPrivate* m_private; + + template<typename T> T* unwrap() + { + return static_cast<T*>(m_private); + } + + template<typename T> const T* constUnwrap() const + { + return static_cast<const T*>(m_private); + } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMEventListener.h b/Source/WebKit/chromium/public/WebDOMEventListener.h new file mode 100644 index 000000000..f879b366e --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMEventListener.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDOMEventListener_h +#define WebDOMEventListener_h + +#include "platform/WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class EventTarget; } +#endif + +namespace WebKit { + +class EventListenerWrapper; +class WebDOMEvent; +class WebDOMEventListenerPrivate; +class WebNode; +class WebString; + +class WebDOMEventListener { +public: + WEBKIT_EXPORT WebDOMEventListener(); + WEBKIT_EXPORT virtual ~WebDOMEventListener(); + + // Called when an event is received. + virtual void handleEvent(const WebDOMEvent&) = 0; + +#if WEBKIT_IMPLEMENTATION + void notifyEventListenerDeleted(EventListenerWrapper*); + EventListenerWrapper* createEventListenerWrapper(const WebString& eventType, bool useCapture, WebCore::EventTarget*); + EventListenerWrapper* getEventListenerWrapper(const WebString& eventType, bool useCapture, WebCore::EventTarget*); +#endif + +private: + WebDOMEventListenerPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMMessageEvent.h b/Source/WebKit/chromium/public/WebDOMMessageEvent.h new file mode 100644 index 000000000..355b73715 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMMessageEvent.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ +#ifndef WebDOMMessageEvent_h +#define WebDOMMessageEvent_h + +#include "WebDOMEvent.h" +#include "WebMessagePortChannel.h" +#include "platform/WebSerializedScriptValue.h" + +#if WEBKIT_IMPLEMENTATION +#include "Event.h" +#include "MessageEvent.h" +#endif + +namespace WebKit { + +class WebFrame; +class WebString; + +class WebDOMMessageEvent : public WebDOMEvent { +public: + WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId); + + WEBKIT_EXPORT WebSerializedScriptValue data() const; + WEBKIT_EXPORT WebString origin() const; + +#if WEBKIT_IMPLEMENTATION + explicit WebDOMMessageEvent(const WTF::PassRefPtr<WebCore::MessageEvent>& e) : WebDOMEvent(e) { } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMMouseEvent.h b/Source/WebKit/chromium/public/WebDOMMouseEvent.h new file mode 100644 index 000000000..373c9ee44 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMMouseEvent.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ +#ifndef WebDOMMouseEvent_h +#define WebDOMMouseEvent_h + +#include "WebDOMEvent.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Event; } +#endif + +namespace WebKit { + +class WebDOMMouseEvent : public WebDOMEvent { +public: + WEBKIT_EXPORT int screenX() const; + WEBKIT_EXPORT int screenY() const; + WEBKIT_EXPORT int clientX() const; + WEBKIT_EXPORT int clientY() const; + WEBKIT_EXPORT int offsetX(); + WEBKIT_EXPORT int offsetY(); + WEBKIT_EXPORT int pageX() const; + WEBKIT_EXPORT int pageY() const; + WEBKIT_EXPORT int x() const; + WEBKIT_EXPORT int y() const; + + WEBKIT_EXPORT int button() const; + WEBKIT_EXPORT bool buttonDown() const; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMMutationEvent.h b/Source/WebKit/chromium/public/WebDOMMutationEvent.h new file mode 100644 index 000000000..8eb3b12a5 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMMutationEvent.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ +#ifndef WebDOMMutationEvent_h +#define WebDOMMutationEvent_h + +#include "WebDOMEvent.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Event; } +#endif + +namespace WebKit { + +class WebDOMMutationEvent : public WebDOMEvent { +public: + enum AttrChangeType { + Modification = 1, + Addition = 2, + Removal = 3 + }; + + WEBKIT_EXPORT WebNode relatedNode() const; + WEBKIT_EXPORT WebString prevValue() const; + WEBKIT_EXPORT WebString newValue() const; + WEBKIT_EXPORT WebString attrName() const; + WEBKIT_EXPORT AttrChangeType attrChange() const; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDOMStringList.h b/Source/WebKit/chromium/public/WebDOMStringList.h new file mode 100644 index 000000000..b7a2807b9 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDOMStringList.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDOMStringList_h +#define WebDOMStringList_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" + +namespace WebCore { class DOMStringList; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDOMStringList { +public: + ~WebDOMStringList() { reset(); } + + WEBKIT_EXPORT WebDOMStringList(); + WebDOMStringList(const WebDOMStringList& l) { assign(l); } + WebDOMStringList& operator=(const WebDOMStringList& l) + { + assign(l); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebDOMStringList&); + + WEBKIT_EXPORT void append(const WebString&); + WEBKIT_EXPORT unsigned length() const; + WEBKIT_EXPORT WebString item(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebDOMStringList(const WTF::PassRefPtr<WebCore::DOMStringList>&); + WebDOMStringList& operator=(const WTF::PassRefPtr<WebCore::DOMStringList>&); + operator WTF::PassRefPtr<WebCore::DOMStringList>() const; +#endif + +private: + WebPrivatePtr<WebCore::DOMStringList> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDataSource.h b/Source/WebKit/chromium/public/WebDataSource.h new file mode 100644 index 000000000..07b63490c --- /dev/null +++ b/Source/WebKit/chromium/public/WebDataSource.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDataSource_h +#define WebDataSource_h + +#include "WebNavigationType.h" +#include "WebTextDirection.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebApplicationCacheHost; +class WebString; +class WebURL; +class WebURLRequest; +class WebURLResponse; +template <typename T> class WebVector; + +class WebDataSource { +public: + class ExtraData { + public: + virtual ~ExtraData() { } + }; + + // Returns the original request that resulted in this datasource. + virtual const WebURLRequest& originalRequest() const = 0; + + // Returns the request corresponding to this datasource. It may + // include additional request headers added by WebKit that were not + // present in the original request. This request may also correspond + // to a location specified by a redirect that was followed. + virtual const WebURLRequest& request() const = 0; + + // Returns the response associated with this datasource. + virtual const WebURLResponse& response() const = 0; + + // When this datasource was created as a result of WebFrame::loadData, + // there may be an associated unreachableURL. + virtual bool hasUnreachableURL() const = 0; + virtual WebURL unreachableURL() const = 0; + + // Returns all redirects that occurred (both client and server) before + // at last committing the current page. This will contain one entry + // for each intermediate URL, and one entry for the last URL (so if + // there are no redirects, it will contain exactly the current URL, and + // if there is one redirect, it will contain the source and destination + // URL). + virtual void redirectChain(WebVector<WebURL>&) const = 0; + + // Returns the title for the current page. + virtual WebString pageTitle() const = 0; + + // Returns the text direction of the title for the current page. + virtual WebTextDirection pageTitleDirection() const = 0; + + // The type of navigation that triggered the creation of this datasource. + virtual WebNavigationType navigationType() const = 0; + + // The time in seconds (since the epoch) of the event that triggered + // the creation of this datasource. Returns 0 if unknown. + virtual double triggeringEventTime() const = 0; + + // Extra data associated with this datasource. If non-null, the extra + // data pointer will be deleted when the datasource is destroyed. + // Setting the extra data pointer will cause any existing non-null + // extra data pointer to be deleted. + virtual ExtraData* extraData() const = 0; + virtual void setExtraData(ExtraData*) = 0; + + // The application cache host associated with this datasource. + virtual WebApplicationCacheHost* applicationCacheHost() = 0; + + // Set deferMainResourceDataLoad flag on the loader. This is used for + // testing. + virtual void setDeferMainResourceDataLoad(bool) = 0; + +protected: + ~WebDataSource() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDatabase.h b/Source/WebKit/chromium/public/WebDatabase.h new file mode 100644 index 000000000..66a24a144 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDatabase.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDatabase_h +#define WebDatabase_h + +#include "WebSecurityOrigin.h" +#include "platform/WebCommon.h" + +namespace WebCore { class AbstractDatabase; } + +namespace WebKit { + +class WebDatabaseObserver; +class WebString; + +class WebDatabase { +public: + WEBKIT_EXPORT WebString name() const; + WEBKIT_EXPORT WebString displayName() const; + WEBKIT_EXPORT unsigned long estimatedSize() const; + WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + WEBKIT_EXPORT bool isSyncDatabase() const; + + WEBKIT_EXPORT static void setObserver(WebDatabaseObserver*); + WEBKIT_EXPORT static WebDatabaseObserver* observer(); + + WEBKIT_EXPORT static void updateDatabaseSize( + const WebString& originIdentifier, const WebString& name, long long size); + WEBKIT_EXPORT static void updateSpaceAvailable( + const WebString& originIdentifier, long long spaceAvailable); + WEBKIT_EXPORT static void resetSpaceAvailable( + const WebString& originIdentifier); + + WEBKIT_EXPORT static void closeDatabaseImmediately( + const WebString& originIdentifier, const WebString& databaseName); + +#if WEBKIT_IMPLEMENTATION + WebDatabase(const WebCore::AbstractDatabase*); +#endif + +private: + WebDatabase() { } + const WebCore::AbstractDatabase* m_database; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDatabaseObserver.h b/Source/WebKit/chromium/public/WebDatabaseObserver.h new file mode 100644 index 000000000..99e7db71f --- /dev/null +++ b/Source/WebKit/chromium/public/WebDatabaseObserver.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDatabaseObserver_h +#define WebDatabaseObserver_h + +namespace WebKit { +class WebDatabase; + +class WebDatabaseObserver { +public: + virtual void databaseOpened(const WebDatabase&) = 0; + virtual void databaseModified(const WebDatabase&) = 0; + virtual void databaseClosed(const WebDatabase&) = 0; + + virtual void reportOpenDatabaseResult(const WebDatabase&, int errorSite, int webSqlErrorCode, int sqliteErrorCode) { } + virtual void reportChangeVersionResult(const WebDatabase&, int errorSite, int webSqlErrorCode, int sqliteErrorCode) { } + virtual void reportStartTransactionResult(const WebDatabase&, int errorSite, int webSqlErrorCode, int sqliteErrorCode) { } + virtual void reportCommitTransactionResult(const WebDatabase&, int errorSite, int webSqlErrorCode, int sqliteErrorCode) { } + virtual void reportExecuteStatementResult(const WebDatabase&, int errorSite, int webSqlErrorCode, int sqliteErrorCode) { } + virtual void reportVacuumDatabaseResult(const WebDatabase&, int sqliteErrorCode) { } + +protected: + ~WebDatabaseObserver() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDevToolsAgent.h b/Source/WebKit/chromium/public/WebDevToolsAgent.h new file mode 100644 index 000000000..0a66db362 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDevToolsAgent.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDevToolsAgent_h +#define WebDevToolsAgent_h + +#include "platform/WebCommon.h" + +namespace WebKit { +class WebDevToolsAgentClient; +class WebDevToolsMessageTransport; +class WebFrame; +class WebString; +class WebURLRequest; +class WebURLResponse; +class WebView; +struct WebDevToolsMessageData; +struct WebPoint; +struct WebURLError; + +class WebDevToolsAgent { +public: + virtual ~WebDevToolsAgent() {} + + // Returns WebKit WebInspector protocol version. + WEBKIT_EXPORT static WebString inspectorProtocolVersion(); + + // Returns true if and only if the given protocol version is supported by the WebKit Web Inspector. + WEBKIT_EXPORT static bool supportsInspectorProtocolVersion(const WebString& version); + + virtual void attach() = 0; + virtual void reattach(const WebString& savedState) = 0; + virtual void detach() = 0; + + virtual void didNavigate() = 0; + + virtual void dispatchOnInspectorBackend(const WebString& message) = 0; + + virtual void inspectElementAt(const WebPoint&) = 0; + virtual void setProcessId(long) = 0; + + // Exposed for LayoutTestController. + virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; + virtual void setJavaScriptProfilingEnabled(bool) = 0; + + class MessageDescriptor { + public: + virtual ~MessageDescriptor() { } + virtual WebDevToolsAgent* agent() = 0; + virtual WebString message() = 0; + }; + // Asynchronously request debugger to pause immediately and run the command. + WEBKIT_EXPORT static void interruptAndDispatch(MessageDescriptor*); + WEBKIT_EXPORT static bool shouldInterruptForMessage(const WebString&); + WEBKIT_EXPORT static void processPendingMessages(); + + // Returns a disconnect event that can be dispatched on the front-end + // in order to let it know that it has disconnected from the agent. + WEBKIT_EXPORT static WebString disconnectEventAsText(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDevToolsAgentClient.h b/Source/WebKit/chromium/public/WebDevToolsAgentClient.h new file mode 100644 index 000000000..9c63b119d --- /dev/null +++ b/Source/WebKit/chromium/public/WebDevToolsAgentClient.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDevToolsAgentClient_h +#define WebDevToolsAgentClient_h + +#include "platform/WebCString.h" +#include "platform/WebCommon.h" + +namespace WebKit { +class WebString; +struct WebDevToolsMessageData; + +class WebDevToolsAgentClient { +public: + virtual void sendMessageToInspectorFrontend(const WebString&) { } + virtual void sendDebuggerOutput(const WebString&) { } + + // Returns the identifier of the entity hosting this agent. + virtual int hostIdentifier() { return -1; } + + // Save the agent state in order to pass it later into WebDevToolsAgent::reattach + // if the same client is reattached to another agent. + virtual void saveAgentRuntimeState(const WebString&) { } + + class WebKitClientMessageLoop { + public: + virtual ~WebKitClientMessageLoop() { } + virtual void run() = 0; + virtual void quitNow() = 0; + }; + virtual WebKitClientMessageLoop* createClientMessageLoop() { return 0; } + + virtual void clearBrowserCache() { } + virtual void clearBrowserCookies() { } + +protected: + ~WebDevToolsAgentClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDevToolsFrontend.h b/Source/WebKit/chromium/public/WebDevToolsFrontend.h new file mode 100644 index 000000000..e05e73b0d --- /dev/null +++ b/Source/WebKit/chromium/public/WebDevToolsFrontend.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDevToolsFrontend_h +#define WebDevToolsFrontend_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebDevToolsFrontendClient; +class WebString; +class WebView; + +// WebDevToolsFrontend represents DevTools client sitting in the Glue. It provides +// direct and delegate Apis to the host. +class WebDevToolsFrontend { +public: + WEBKIT_EXPORT static WebDevToolsFrontend* create(WebView* view, + WebDevToolsFrontendClient* client, + const WebString& applicationLocale); + + virtual ~WebDevToolsFrontend() {} + + virtual void dispatchOnInspectorFrontend(const WebString&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h new file mode 100644 index 000000000..acb5f9849 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDevToolsFrontendClient.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDevToolsFrontendClient_h +#define WebDevToolsFrontendClient_h + +namespace WebKit { + +class WebString; +struct WebFloatPoint; +struct WebDevToolsMessageData; + +class WebDevToolsFrontendClient { +public: + WebDevToolsFrontendClient() { } + + virtual void sendMessageToBackend(const WebString&) { } + + virtual void activateWindow() { } + virtual void closeWindow() { } + virtual void requestDockWindow() { } + virtual void requestUndockWindow() { } + virtual void requestSetDockSide(const WebString& side) { } + virtual void moveWindowBy(const WebFloatPoint&) { } + virtual void saveAs(const WebString& fileName, const WebString& content) { } + +protected: + virtual ~WebDevToolsFrontendClient() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDeviceOrientation.h b/Source/WebKit/chromium/public/WebDeviceOrientation.h new file mode 100644 index 000000000..7e8aa7244 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDeviceOrientation.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebDeviceOrientation_h +#define WebDeviceOrientation_h + +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +namespace WebCore { class DeviceOrientation; } +#endif + +namespace WebKit { + +class WebDeviceOrientation { +public: + WebDeviceOrientation(bool canProvideAlpha, double alpha, bool canProvideBeta, double beta, bool canProvideGamma, double gamma) + : m_isNull(false), + m_canProvideAlpha(canProvideAlpha), + m_alpha(alpha), + m_canProvideBeta(canProvideBeta), + m_beta(beta), + m_canProvideGamma(canProvideGamma), + m_gamma(gamma) + { + } + + static WebDeviceOrientation nullOrientation() { return WebDeviceOrientation(); } + + bool isNull() { return m_isNull; } + bool canProvideAlpha() { return m_canProvideAlpha; } + double alpha() { return m_alpha; } + bool canProvideBeta() { return m_canProvideBeta; } + double beta() { return m_beta; } + bool canProvideGamma() { return m_canProvideGamma; } + double gamma() { return m_gamma; } + +#if WEBKIT_IMPLEMENTATION + WebDeviceOrientation(const WTF::PassRefPtr<WebCore::DeviceOrientation>&); + WebDeviceOrientation& operator=(const WTF::PassRefPtr<WebCore::DeviceOrientation>&); + operator WTF::PassRefPtr<WebCore::DeviceOrientation>() const; +#endif + +private: + WebDeviceOrientation() + : m_isNull(true), + m_canProvideAlpha(false), + m_alpha(0), + m_canProvideBeta(false), + m_beta(0), + m_canProvideGamma(false), + m_gamma(0) + { + } + + bool m_isNull; + bool m_canProvideAlpha; + double m_alpha; + bool m_canProvideBeta; + double m_beta; + bool m_canProvideGamma; + double m_gamma; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientation_h diff --git a/Source/WebKit/chromium/public/WebDeviceOrientationClient.h b/Source/WebKit/chromium/public/WebDeviceOrientationClient.h new file mode 100644 index 000000000..4df866559 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDeviceOrientationClient.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebDeviceOrientationClient_h +#define WebDeviceOrientationClient_h + +namespace WebKit { + +class WebDeviceOrientation; +class WebDeviceOrientationController; + +class WebDeviceOrientationClient { +public: + virtual ~WebDeviceOrientationClient() {} + + virtual void setController(WebDeviceOrientationController*) = 0; + virtual void startUpdating() = 0; + virtual void stopUpdating() = 0; + + virtual WebDeviceOrientation lastOrientation() const = 0; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationClient_h diff --git a/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h b/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h new file mode 100644 index 000000000..f029bcc6d --- /dev/null +++ b/Source/WebKit/chromium/public/WebDeviceOrientationClientMock.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebDeviceOrientationClientMock_h +#define WebDeviceOrientationClientMock_h + +#include "WebDeviceOrientationClient.h" +#include "platform/WebCommon.h" +#include "platform/WebPrivateOwnPtr.h" + +namespace WebCore { class DeviceOrientationClientMock; } + +namespace WebKit { + +class WebDeviceOrientationClientMock : public WebDeviceOrientationClient { +public: + WEBKIT_EXPORT static WebDeviceOrientationClientMock* create(); + ~WebDeviceOrientationClientMock() { reset(); } + + virtual void setController(WebDeviceOrientationController*); + virtual void startUpdating(); + virtual void stopUpdating(); + virtual WebDeviceOrientation lastOrientation() const; + + WEBKIT_EXPORT void setOrientation(WebDeviceOrientation&); + +private: + WebDeviceOrientationClientMock() { initialize(); } + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + + WebPrivateOwnPtr<WebCore::DeviceOrientationClientMock> m_clientMock; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationClientMock_h diff --git a/Source/WebKit/chromium/public/WebDeviceOrientationController.h b/Source/WebKit/chromium/public/WebDeviceOrientationController.h new file mode 100644 index 000000000..f53e96201 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDeviceOrientationController.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebDeviceOrientationController_h +#define WebDeviceOrientationController_h + +#include "platform/WebCommon.h" + +namespace WebCore { class DeviceOrientationController; } + +namespace WebKit { + +class WebDeviceOrientation; + +class WebDeviceOrientationController { +public: + WebDeviceOrientationController(WebCore::DeviceOrientationController* c) + : m_controller(c) + { + } + + WEBKIT_EXPORT void didChangeDeviceOrientation(const WebDeviceOrientation&); + +#if WEBKIT_IMPLEMENTATION + WebCore::DeviceOrientationController* controller() const; +#endif + +private: + WebCore::DeviceOrientationController* m_controller; +}; + +} // namespace WebKit + +#endif // WebDeviceOrientationController_h diff --git a/Source/WebKit/chromium/public/WebDocument.h b/Source/WebKit/chromium/public/WebDocument.h new file mode 100644 index 000000000..6725e79e1 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDocument.h @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDocument_h +#define WebDocument_h + +#include "WebNode.h" +#include "WebSecurityOrigin.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { +class Document; +class DocumentType; +} +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebAccessibilityObject; +class WebDocumentType; +class WebElement; +class WebFormElement; +class WebFrame; +class WebNodeCollection; +class WebNodeList; +class WebString; +class WebURL; + +// Provides readonly access to some properties of a DOM document. +class WebDocument : public WebNode { +public: + enum UserStyleLevel { + UserStyleUserLevel, + UserStyleAuthorLevel + }; + + WebDocument() { } + WebDocument(const WebDocument& e) : WebNode(e) { } + + WebDocument& operator=(const WebDocument& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebDocument& e) { WebNode::assign(e); } + + WEBKIT_EXPORT WebURL url() const; + // Note: Security checks should use the securityOrigin(), not url(). + WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + + WEBKIT_EXPORT WebString encoding() const; + + // The url of the OpenSearch Desription Document (if any). + WEBKIT_EXPORT WebURL openSearchDescriptionURL() const; + + // Returns the frame the document belongs to or 0 if the document is frameless. + WEBKIT_EXPORT WebFrame* frame() const; + WEBKIT_EXPORT bool isHTMLDocument() const; + WEBKIT_EXPORT bool isXHTMLDocument() const; + WEBKIT_EXPORT bool isPluginDocument() const; + WEBKIT_EXPORT WebURL baseURL() const; + WEBKIT_EXPORT WebURL firstPartyForCookies() const; + WEBKIT_EXPORT WebElement documentElement() const; + WEBKIT_EXPORT WebElement body() const; + WEBKIT_EXPORT WebElement head(); + WEBKIT_EXPORT WebString title() const; + WEBKIT_EXPORT WebNodeCollection all(); + WEBKIT_EXPORT void forms(WebVector<WebFormElement>&) const; + WEBKIT_EXPORT WebURL completeURL(const WebString&) const; + WEBKIT_EXPORT WebElement getElementById(const WebString&) const; + WEBKIT_EXPORT WebNode focusedNode() const; + WEBKIT_EXPORT WebDocumentType doctype() const; + WEBKIT_EXPORT void cancelFullScreen(); + WEBKIT_EXPORT WebElement fullScreenElement() const; + WEBKIT_EXPORT WebDOMEvent createEvent(const WebString& eventType); + + // Accessibility support. These methods should only be called on the + // top-level document, because one accessibility cache spans all of + // the documents on the page. + + // Gets the accessibility object for this document. + WEBKIT_EXPORT WebAccessibilityObject accessibilityObject() const; + + // Gets the accessibility object for an object on this page by ID. + WEBKIT_EXPORT WebAccessibilityObject accessibilityObjectFromID(int axID) const; + // Inserts the given CSS source code as a user stylesheet in the document. + // Meant for programatic/one-off injection, as opposed to + // WebView::addUserStyleSheet which inserts styles for the lifetime of the + // WebView. + WEBKIT_EXPORT void insertUserStyleSheet(const WebString& sourceCode, UserStyleLevel); + +#if WEBKIT_IMPLEMENTATION + WebDocument(const WTF::PassRefPtr<WebCore::Document>&); + WebDocument& operator=(const WTF::PassRefPtr<WebCore::Document>&); + operator WTF::PassRefPtr<WebCore::Document>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDocumentType.h b/Source/WebKit/chromium/public/WebDocumentType.h new file mode 100644 index 000000000..a9113bb41 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDocumentType.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDocumentType_h +#define WebDocumentType_h + +#include "WebNode.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class DocumentType; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebString; + +// Provides readonly access to some properties of a DOM document type. +class WebDocumentType : public WebNode { +public: + WebDocumentType() { } + WebDocumentType(const WebDocumentType& e) : WebNode(e) { } + + WebDocumentType& operator=(const WebDocumentType& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebDocumentType& e) { WebNode::assign(e); } + + WEBKIT_EXPORT WebString name() const; + +#if WEBKIT_IMPLEMENTATION + WebDocumentType(const WTF::PassRefPtr<WebCore::DocumentType>&); + WebDocumentType& operator=(const WTF::PassRefPtr<WebCore::DocumentType>&); + operator WTF::PassRefPtr<WebCore::DocumentType>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebDragOperation.h b/Source/WebKit/chromium/public/WebDragOperation.h new file mode 100644 index 000000000..050b74f47 --- /dev/null +++ b/Source/WebKit/chromium/public/WebDragOperation.h @@ -0,0 +1,59 @@ +/* +* Copyright (C) 2009 Google 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: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * 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. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +* OWNER OR 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. +*/ + +#ifndef WebDragOperation_h +#define WebDragOperation_h + +#include <limits.h> + +namespace WebKit { + +// "Verb" of a drag-and-drop operation as negotiated between the source and +// destination. +// (These constants match their equivalents in WebCore's DragActions.h and +// should not be renumbered.) +enum WebDragOperation { + WebDragOperationNone = 0, + WebDragOperationCopy = 1, + WebDragOperationLink = 2, + WebDragOperationGeneric = 4, + WebDragOperationPrivate = 8, + WebDragOperationMove = 16, + WebDragOperationDelete = 32, + WebDragOperationEvery = UINT_MAX +}; + +// Alternate typedef to make it clear when this is being used as a mask +// with potentially multiple value bits set. +typedef WebDragOperation WebDragOperationsMask; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebEditingAction.h b/Source/WebKit/chromium/public/WebEditingAction.h new file mode 100644 index 000000000..4e7610017 --- /dev/null +++ b/Source/WebKit/chromium/public/WebEditingAction.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebEditingAction_h +#define WebEditingAction_h + +namespace WebKit { + +enum WebEditingAction { + WebEditingActionTyped, + WebEditingActionPasted, + WebEditingActionDropped, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebElement.h b/Source/WebKit/chromium/public/WebElement.h new file mode 100644 index 000000000..a3a06121d --- /dev/null +++ b/Source/WebKit/chromium/public/WebElement.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebElement_h +#define WebElement_h + +#include "WebNode.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Element; } +#endif + +namespace WebKit { +class WebNamedNodeMap; +struct WebRect; + + // Provides access to some properties of a DOM element node. + class WebElement : public WebNode { + public: + WebElement() : WebNode() { } + WebElement(const WebElement& e) : WebNode(e) { } + + WebElement& operator=(const WebElement& e) { WebNode::assign(e); return *this; } + void assign(const WebElement& e) { WebNode::assign(e); } + + WEBKIT_EXPORT bool isFormControlElement() const; + WEBKIT_EXPORT bool isTextFormControlElement() const; + WEBKIT_EXPORT WebString tagName() const; + WEBKIT_EXPORT bool hasTagName(const WebString&) const; + WEBKIT_EXPORT bool hasAttribute(const WebString&) const; + WEBKIT_EXPORT WebString getAttribute(const WebString&) const; + WEBKIT_EXPORT bool setAttribute(const WebString& name, const WebString& value); + WEBKIT_EXPORT WebNamedNodeMap attributes() const; + WEBKIT_EXPORT WebString innerText(); + WEBKIT_EXPORT WebDocument document() const; + WEBKIT_EXPORT void requestFullScreen(); + + // Returns the language code specified for this element. This attribute + // is inherited, so the returned value is drawn from the closest parent + // element that has the lang attribute set, or from the HTTP + // "Content-Language" header as a fallback. + WEBKIT_EXPORT WebString computeInheritedLanguage() const; + + // Returns the bounds of the element in viewport space. The bounds + // have been adjusted to include any transformations. This view is + // also called the Root View in WebKit. + // This function will update the layout if required. + WEBKIT_EXPORT WebRect boundsInViewportSpace(); + +#if WEBKIT_IMPLEMENTATION + WebElement(const WTF::PassRefPtr<WebCore::Element>&); + WebElement& operator=(const WTF::PassRefPtr<WebCore::Element>&); + operator WTF::PassRefPtr<WebCore::Element>() const; +#endif + }; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebExceptionCode.h b/Source/WebKit/chromium/public/WebExceptionCode.h new file mode 100644 index 000000000..61d53d9e2 --- /dev/null +++ b/Source/WebKit/chromium/public/WebExceptionCode.h @@ -0,0 +1,41 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebExceptionCode_h +#define WebExceptionCode_h + +namespace WebKit { + +// This should match how ExceptionCode is defined in WebCore. +typedef int WebExceptionCode; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebExternalPopupMenu.h b/Source/WebKit/chromium/public/WebExternalPopupMenu.h new file mode 100644 index 000000000..49630cf33 --- /dev/null +++ b/Source/WebKit/chromium/public/WebExternalPopupMenu.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebExternalPopupMenu_h +#define WebExternalPopupMenu_h + +namespace WebKit { + +struct WebRect; + +class WebExternalPopupMenu { +public: + virtual void show(const WebRect& bounds) = 0; + virtual void close() = 0; +}; + +} // namespace WebKit + +#endif // WebExternalPopupMenu_h diff --git a/Source/WebKit/chromium/public/WebExternalPopupMenuClient.h b/Source/WebKit/chromium/public/WebExternalPopupMenuClient.h new file mode 100644 index 000000000..974e37639 --- /dev/null +++ b/Source/WebKit/chromium/public/WebExternalPopupMenuClient.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebExternalPopupMenuClient_h +#define WebExternalPopupMenuClient_h + +#include "platform/WebVector.h" + +namespace WebKit { + +class WebExternalPopupMenuClient { +public: + // Should be called when the currently selected item in the popup menu + // changed. Can be -1 if there is no selection. + virtual void didChangeSelection(int index) = 0; + + // Should be called when an index has been accepted. + // Note that it is not safe to access this WebExternalPopupClientMenu after + // this has been called as it might not be valid anymore. + virtual void didAcceptIndex(int index) = 0; + + // Should be called when a set of indices have been selected. + // Note that it is not safe to access this WebExternalPopupClientMenu after + // this has been called as it might not be valid anymore. + virtual void didAcceptIndices(const WebVector<int>& indices) = 0; + + // Should be called when the popup menu was discarded (closed without a + // selection. + // Note that it is not safe to access this WebExternalPopupClientMenu after + // this has been called as it might not be valid anymore. + virtual void didCancel() = 0; +}; + +} // namespace WebKit + +#endif // WebExternalPopupMenuClient_h diff --git a/Source/WebKit/chromium/public/WebFileChooserCompletion.h b/Source/WebKit/chromium/public/WebFileChooserCompletion.h new file mode 100644 index 000000000..14bace4c2 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileChooserCompletion.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileChooserCompletion_h +#define WebFileChooserCompletion_h + +namespace WebKit { + +class WebString; +template <typename T> class WebVector; + +// Gets called back when WebViewClient finished choosing a file. +class WebFileChooserCompletion { +public: + // Called with zero or more file names. Zero-lengthed vector means that + // the user cancelled or that file choosing failed. The callback instance + // is destroyed when this method is called. + virtual void didChooseFile(const WebVector<WebString>& fileNames) = 0; +protected: + virtual ~WebFileChooserCompletion() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileChooserParams.h b/Source/WebKit/chromium/public/WebFileChooserParams.h new file mode 100644 index 000000000..da462ef98 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileChooserParams.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2010, 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileChooserParams_h +#define WebFileChooserParams_h + +#include "WebFileChooserCompletion.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { + +struct WebFileChooserParams { + // If |multiSelect| is true, the dialog allows the user to select multiple files. + bool multiSelect; + // If |directory| is true, the dialog allows the user to select a directory. + bool directory; + // If |saveAs| is true, the dialog allows the user to select a possibly + // non-existent file. This can be used for a "Save As" dialog. + bool saveAs; + // |title| is the title for a file chooser dialog. It can be an empty string. + WebString title; + // |initialValue| is a filename which the dialog should select by default. + // It can be an empty string. + WebString initialValue; + // This contains MIME type strings such as "audio/*" "text/plain". + // The dialog may restrict selectable files to the specified MIME types. + // This list comes from an 'accept' attribute value of an INPUT element, and + // it contains only lower-cased MIME type strings of which format is valid. + WebVector<WebString> acceptMIMETypes; + // |selectedFiles| has filenames which a file upload control already selected. + // A WebViewClient implementation may ask a user to select + // - removing a file from the selected files, + // - appending other files, or + // - replacing with other files + // before opening a file chooser dialog. + WebVector<WebString> selectedFiles; + + WebFileChooserParams() + : multiSelect(false) + , directory(false) + , saveAs(false) + { + } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileError.h b/Source/WebKit/chromium/public/WebFileError.h new file mode 100644 index 000000000..e7a17c329 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileError.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ +#ifndef WebFileError_h +#define WebFileError_h + +namespace WebKit { + +// File-related error code defined in HTML5 File API. +enum WebFileError { + WebFileErrorNotFound = 1, + WebFileErrorSecurity = 2, + WebFileErrorAbort = 3, + WebFileErrorNotReadable = 4, + WebFileErrorEncoding = 5, + WebFileErrorNoModificationAllowed = 6, + WebFileErrorInvalidState = 7, + WebFileErrorSyntax = 8, + WebFileErrorInvalidModification = 9, + WebFileErrorQuotaExceeded = 10, + WebFileErrorTypeMismatch = 11, + WebFileErrorPathExists = 12, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileInfo.h b/Source/WebKit/chromium/public/WebFileInfo.h new file mode 100644 index 000000000..bf152fe75 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileInfo.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileInfo_h +#define WebFileInfo_h + +#include "platform/WebString.h" + +namespace WebKit { + +struct WebFileInfo { + // The last modification time of the file, in seconds. + // The value 0.0 means that the time is not set. + double modificationTime; + + // The length of the file in bytes. + // The value -1 means that the length is not set. + long long length; + + enum Type { + TypeUnknown = 0, + TypeFile, + TypeDirectory + }; + + Type type; + + WebString platformPath; + + WebFileInfo() : modificationTime(0.0), length(-1), type(TypeUnknown) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileSystemCallbacks.h b/Source/WebKit/chromium/public/WebFileSystemCallbacks.h new file mode 100644 index 000000000..3f66507fe --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileSystemCallbacks.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileSystemCallbacks_h +#define WebFileSystemCallbacks_h + +#include "WebFileError.h" +#include "WebFileSystemEntry.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebString; +class WebURL; +struct WebFileInfo; + +// Temporary hack to ease a 4-phase Chromium/WebKit commit. +#define WEBFILESYSTEMCALLBACKS_USE_URL_NOT_STRING 1 + +class WebFileSystemCallbacks { +public: + // Callback for WebFileSystem's various operations that don't require + // return values. + virtual void didSucceed() = 0; + + // Callback for WebFileSystem::readMetadata. Called with the file metadata + // for the requested path. + virtual void didReadMetadata(const WebFileInfo&) = 0; + + // Callback for WebFileSystem::readDirectory. Called with a vector of + // file entries in the requested directory. This callback might be called + // multiple times if the directory has many entries. |hasMore| must be + // true when there are more entries. + virtual void didReadDirectory(const WebVector<WebFileSystemEntry>&, bool hasMore) = 0; + + // Callback for WebFrameClient::openFileSystem. Called with a name and + // root URL for the FileSystem when the request is accepted. + virtual void didOpenFileSystem(const WebString& name, const WebURL& rootURL) = 0; + + // Called with an error code when a requested operation hasn't been + // completed. + virtual void didFail(WebFileError) = 0; + +protected: + virtual ~WebFileSystemCallbacks() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileSystemEntry.h b/Source/WebKit/chromium/public/WebFileSystemEntry.h new file mode 100644 index 000000000..9caa7bf96 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileSystemEntry.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileSystemEntry_h +#define WebFileSystemEntry_h + +#include "platform/WebString.h" + +namespace WebKit { + +struct WebFileSystemEntry { + WebFileSystemEntry() : isDirectory(false) { } + + // The name of the entry. + WebString name; + + // This flag indicates if the entry is directory or not. + bool isDirectory; +}; + +} // namespace WebKit + +#endif // WebFileSystemEntry_h diff --git a/Source/WebKit/chromium/public/WebFileUtilities.h b/Source/WebKit/chromium/public/WebFileUtilities.h new file mode 100644 index 000000000..8b3b7b26b --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileUtilities.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileUtilities_h +#define WebFileUtilities_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" + +#ifdef WIN32 +typedef void *HANDLE; +#endif + +namespace WebKit { + +class WebFileUtilities { +public: +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + virtual void revealFolderInOS(const WebString& path) { } + virtual bool fileExists(const WebString& path) { return false; } + virtual bool deleteFile(const WebString& path) { return false; } + virtual bool deleteEmptyDirectory(const WebString& path) { return false; } + virtual bool getFileSize(const WebString& path, long long& result) { return false; } + virtual bool getFileModificationTime(const WebString& path, double& result) { return false; } + virtual WebString directoryName(const WebString& path) { return WebString(); } + virtual WebString pathByAppendingComponent(const WebString& path, const WebString& component) { return WebString(); } + virtual bool makeAllDirectories(const WebString& path) { return false; } + virtual WebString getAbsolutePath(const WebString& path) { return WebString(); } + virtual bool isDirectory(const WebString& path) { return false; } + virtual WebURL filePathToURL(const WebString& path) { return WebURL(); } + virtual FileHandle openFile(const WebString& path, int mode) { return FileHandle(); } + // Should set the FileHandle to a invalid value if the file is closed successfully. + virtual void closeFile(FileHandle&) { } + virtual long long seekFile(FileHandle, long long offset, int origin) { return 0; } + virtual bool truncateFile(FileHandle, long long offset) { return false; } + virtual int readFromFile(FileHandle, char* data, int length) { return 0; } + virtual int writeToFile(FileHandle, const char* data, int length) { return 0; } + +protected: + ~WebFileUtilities() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileWriter.h b/Source/WebKit/chromium/public/WebFileWriter.h new file mode 100644 index 000000000..fad6fac5d --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileWriter.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileWriter_h +#define WebFileWriter_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebURL; + +class WebFileWriter { +public: + virtual ~WebFileWriter() { } + + // Only one write or one truncate operation can be in progress at a time. + // These functions are asynchronous and will report results through the WebFileWriter's associated WebFileWriterClient. + virtual void write(long long position, const WebURL& blobURL) = 0; + virtual void truncate(long long length) = 0; + + // Cancel will attempt to abort a running write or truncate. However, it may not be possible to cancel an in-progress action, or the call may have come in too late. Partial writes are possible. + // Do not call cancel when there is no write or truncate in progress. + virtual void cancel() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFileWriterClient.h b/Source/WebKit/chromium/public/WebFileWriterClient.h new file mode 100644 index 000000000..4b9b4b6a3 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFileWriterClient.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileWriterClient_h +#define WebFileWriterClient_h + +#include "WebFileError.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebFileWriterClient { +public: + // Called for each chunk of a write, to indicate progress. + // On the final chunk, when the write is finished, complete will be true. + virtual void didWrite(long long bytes, bool complete) = 0; + + // Called once when the truncate completes successfully. + virtual void didTruncate() = 0; + + // Called if the write or truncate fails, or if it is cancelled before the write or truncate completes. Completion of an operation will be signalled exactly once, either by didFail, didTruncate, or didWrite(..., true). + virtual void didFail(WebFileError) = 0; + +protected: + virtual ~WebFileWriterClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFindOptions.h b/Source/WebKit/chromium/public/WebFindOptions.h new file mode 100644 index 000000000..ab1dcb221 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFindOptions.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFindOptions_h +#define WebFindOptions_h + +#include "platform/WebString.h" + +namespace WebKit { + +// Options used when performing a find-in-page query. +struct WebFindOptions { + // Whether to search forward or backward within the page. + bool forward; + + // Whether search should be case-sensitive. + bool matchCase; + + // Whether this operation is the first request or a follow-up. + bool findNext; + + WebFindOptions() + : forward(true) + , matchCase(false) + , findNext(false) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFont.h b/Source/WebKit/chromium/public/WebFont.h new file mode 100644 index 000000000..9826565a6 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFont.h @@ -0,0 +1,100 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFont_h +#define WebFont_h + +#include "platform/WebCanvas.h" +#include "platform/WebColor.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +struct WebFontDescription; +struct WebFloatPoint; +struct WebFloatRect; +struct WebPoint; +struct WebRect; +struct WebTextRun; + +class WebFont { +public: + virtual ~WebFont() { } + + WEBKIT_EXPORT static WebFont* create(const WebFontDescription&); + + virtual WebFontDescription fontDescription() const = 0; + + virtual int ascent() const = 0; + virtual int descent() const = 0; + virtual int height() const = 0; + virtual int lineSpacing() const = 0; + virtual float xHeight() const = 0; + + // Draws the text run to the given canvas. The text is positioned at the + // given left-hand point at the baseline. + // + // The text will be clipped to the given clip rect. |canvasIsOpaque| is + // used to control whether subpixel antialiasing is possible. If there is a + // possibility the area drawn could be semi-transparent, subpixel + // antialiasing will be disabled. + // + // |from| and |to| allow the caller to specify a subrange of the given text + // run to draw. If |to| is -1, the entire run will be drawn. + virtual void drawText(WebCanvas*, const WebTextRun&, const WebFloatPoint& leftBaseline, WebColor, + const WebRect& clip, bool canvasIsOpaque, + int from = 0, int to = -1) const = 0; + + // Measures the width in pixels of the given text run. + virtual int calculateWidth(const WebTextRun&) const = 0; + + // Returns the character offset corresponding to the given horizontal pixel + // position as measured from from the left of the run. + virtual int offsetForPosition(const WebTextRun&, float position) const = 0; + + // Returns the rectangle representing the selection rect for the subrange + // |from| -> |to| of the given text run. You can use -1 for |to| to specify + // the entire run (this will do something similar to calling width()). + // + // The rect will be positioned as if the text was drawn at the given + // |leftBaseline| position. |height| indicates the height of the selection + // rect you want, typically this will just be the height() of this font. + // + // To get the pixel offset of some character (the opposite of + // offsetForPosition()), pass in a |leftBaseline| = (0, 0), |from| = 0, and + // |to| = the character you want. The right edge of the resulting selection + // rect will tell you the right side of the character. + virtual WebFloatRect selectionRectForText(const WebTextRun&, const WebFloatPoint& leftBaseline, + int height, int from = 0, int to = -1) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFontCache.h b/Source/WebKit/chromium/public/WebFontCache.h new file mode 100644 index 000000000..ca5ddb8d6 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFontCache.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontCache_h +#define WebFontCache_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// An interface to query and configure WebKit's font cache. +class WebFontCache { +public: + // Returns the number of items in the font data cache. + WEBKIT_EXPORT static size_t fontDataCount(); + + // Returns the number of inactive items in the font data cache. + WEBKIT_EXPORT static size_t inactiveFontDataCount(); + + // Clears the cache. + WEBKIT_EXPORT static void clear(); + + // Purges inactive font data. + WEBKIT_EXPORT static void prune(); + +private: + WebFontCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFontDescription.h b/Source/WebKit/chromium/public/WebFontDescription.h new file mode 100644 index 000000000..5625bb86c --- /dev/null +++ b/Source/WebKit/chromium/public/WebFontDescription.h @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontDescription_h +#define WebFontDescription_h + +#include "platform/WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FontDescription; } +#endif + +namespace WebKit { + +struct WebFontDescription { + enum GenericFamily { + GenericFamilyNone, + GenericFamilyStandard, + GenericFamilySerif, + GenericFamilySansSerif, + GenericFamilyMonospace, + GenericFamilyCursive, + GenericFamilyFantasy + }; + + enum Smoothing { + SmoothingAuto, + SmoothingNone, + SmoothingGrayscale, + SmoothingSubpixel + }; + + enum Weight { + Weight100, + Weight200, + Weight300, + Weight400, + Weight500, + Weight600, + Weight700, + Weight800, + Weight900, + WeightNormal = Weight400, + WeightBold = Weight700 + }; + + WebFontDescription() + : genericFamily(GenericFamilyNone) + , size(0) + , italic(false) + , smallCaps(false) + , weight(WeightNormal) + , smoothing(SmoothingAuto) + , letterSpacing(0) + , wordSpacing(0) + { + } + + WebString family; + GenericFamily genericFamily; + float size; + bool italic; + bool smallCaps; + Weight weight; + Smoothing smoothing; + + short letterSpacing; + short wordSpacing; + +#if WEBKIT_IMPLEMENTATION + WebFontDescription(const WebCore::FontDescription&, short fontLetterSpacing, short fontWordSpacing); + + operator WebCore::FontDescription() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFormControlElement.h b/Source/WebKit/chromium/public/WebFormControlElement.h new file mode 100644 index 000000000..b64e0d510 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFormControlElement.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFormControlElement_h +#define WebFormControlElement_h + +#include "WebElement.h" +#include "WebFormElement.h" +#include "platform/WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLFormControlElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM form control element node. +class WebFormControlElement : public WebElement { +public: + WebFormControlElement() : WebElement() { } + WebFormControlElement(const WebFormControlElement& e) : WebElement(e) { } + + WebFormControlElement& operator=(const WebFormControlElement& e) + { + WebElement::assign(e); + return *this; + } + void assign(const WebFormControlElement& e) { WebElement::assign(e); } + + WEBKIT_EXPORT bool isEnabled() const; + WEBKIT_EXPORT bool isReadOnly() const; + WEBKIT_EXPORT WebString formControlName() const; + WEBKIT_EXPORT WebString formControlType() const; + + WEBKIT_EXPORT void dispatchFormControlChangeEvent(); + + // Returns the name that should be used for the specified |element| when + // storing autofill data. This is either the field name or its id, an empty + // string if it has no name and no id. + WEBKIT_EXPORT WebString nameForAutofill() const; + + WEBKIT_EXPORT WebFormElement form() const; + +#if WEBKIT_IMPLEMENTATION + WebFormControlElement(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + WebFormControlElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormControlElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormControlElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFormElement.h b/Source/WebKit/chromium/public/WebFormElement.h new file mode 100644 index 000000000..1ef431fa3 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFormElement.h @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFormElement_h +#define WebFormElement_h + +#include "WebElement.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLFormElement; } +#endif + +namespace WebKit { + + class WebInputElement; + class WebFormControlElement; + + // A container for passing around a reference to a form element. Provides + // some information about the form. + class WebFormElement : public WebElement { + public: + ~WebFormElement() { reset(); } + + WebFormElement() : WebElement() { } + WebFormElement(const WebFormElement& element) : WebElement(element) { } + + WebFormElement& operator=(const WebFormElement& element) + { + WebElement::assign(element); + return *this; + } + void assign(const WebFormElement& element) { WebElement::assign(element); } + + WEBKIT_EXPORT bool autoComplete() const; + WEBKIT_EXPORT WebString action() const; + WEBKIT_EXPORT WebString name() const; + WEBKIT_EXPORT WebString method() const; + WEBKIT_EXPORT bool wasUserSubmitted() const; + WEBKIT_EXPORT void submit(); + // FIXME: Deprecate and replace with WebVector<WebElement>. + WEBKIT_EXPORT void getNamedElements(const WebString&, WebVector<WebNode>&); + WEBKIT_EXPORT void getFormControlElements(WebVector<WebFormControlElement>&) const; + +#if WEBKIT_IMPLEMENTATION + WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; +#endif + }; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFrame.h b/Source/WebKit/chromium/public/WebFrame.h new file mode 100644 index 000000000..85bbda108 --- /dev/null +++ b/Source/WebKit/chromium/public/WebFrame.h @@ -0,0 +1,643 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFrame_h +#define WebFrame_h + +#include "WebIconURL.h" +#include "WebNode.h" +#include "WebReferrerPolicy.h" +#include "WebURLLoaderOptions.h" +#include "platform/WebCanvas.h" +#include "platform/WebFileSystem.h" +#include "platform/WebURL.h" + +struct NPObject; + +#if WEBKIT_USING_V8 +namespace v8 { +class Context; +class Value; +template <class T> class Handle; +template <class T> class Local; +} +#endif + +namespace WebKit { + +class WebAnimationController; +class WebData; +class WebDataSource; +class WebDocument; +class WebElement; +class WebFormElement; +class WebHistoryItem; +class WebInputElement; +class WebPerformance; +class WebRange; +class WebSecurityOrigin; +class WebString; +class WebURL; +class WebURLLoader; +class WebURLRequest; +class WebView; +struct WebConsoleMessage; +struct WebFindOptions; +struct WebPoint; +struct WebRect; +struct WebScriptSource; +struct WebSize; +struct WebURLLoaderOptions; + +template <typename T> class WebVector; + +class WebFrame { +public: + // Control of renderTreeAsText output + enum RenderAsTextControl { + RenderAsTextNormal = 0, + RenderAsTextDebug = 1 << 0, + RenderAsTextPrinting = 1 << 1 + }; + typedef unsigned RenderAsTextControls; + + // Returns the number of live WebFrame objects, used for leak checking. + WEBKIT_EXPORT static int instanceCount(); + + // The two functions below retrieve the WebFrame instances relating the + // currently executing JavaScript. Since JavaScript can make function + // calls across frames, though, we need to be more precise. + // + // For example, imagine that a JS function in frame A calls a function + // in frame B, which calls native code, which wants to know what the + // 'active' frame is. + // + // The 'entered context' is the context where execution first entered + // the script engine; the context that is at the bottom of the JS + // function stack. frameForEnteredContext() would return frame A in + // our example. + // + // The 'current context' is the context the JS engine is currently + // inside of; the context that is at the top of the JS function stack. + // frameForCurrentContext() would return frame B in our example. + WEBKIT_EXPORT static WebFrame* frameForEnteredContext(); + WEBKIT_EXPORT static WebFrame* frameForCurrentContext(); + +#if WEBKIT_USING_V8 + // Returns the frame corresponding to the given context. This can return 0 + // if the context is detached from the frame, or if the context doesn't + // correspond to a frame (e.g., workers). + WEBKIT_EXPORT static WebFrame* frameForContext(v8::Handle<v8::Context>); +#endif + + // Returns the frame inside a given frame or iframe element. Returns 0 if + // the given element is not a frame, iframe or if the frame is empty. + WEBKIT_EXPORT static WebFrame* fromFrameOwnerElement(const WebElement&); + + + // Basic properties --------------------------------------------------- + + // The name of this frame. + virtual WebString name() const = 0; + + // Sets the name of this frame. For child frames (frames that are not a + // top-most frame) the actual name may have a suffix appended to make the + // frame name unique within the hierarchy. + virtual void setName(const WebString&) = 0; + + // A globally unique identifier for this frame. + virtual long long identifier() const = 0; + + // The urls of the given combination types of favicon (if any) specified by + // the document loaded in this frame. The iconTypes is a bit-mask of + // WebIconURL::Type values, used to select from the available set of icon + // URLs + virtual WebVector<WebIconURL> iconURLs(int iconTypes) const = 0; + + // The referrer policy of the document associated with this frame. + virtual WebReferrerPolicy referrerPolicy() const = 0; + + + // Geometry ----------------------------------------------------------- + + // NOTE: These routines do not force page layout so their results may + // not be accurate if the page layout is out-of-date. + + // If set to false, do not draw scrollbars on this frame's view. + virtual void setCanHaveScrollbars(bool) = 0; + + // The scroll offset from the top-left corner of the frame in pixels. + virtual WebSize scrollOffset() const = 0; + virtual void setScrollOffset(const WebSize&) = 0; + + // The minimum and maxium scroll positions in pixels. + virtual WebSize minimumScrollOffset() const = 0; + virtual WebSize maximumScrollOffset() const = 0; + + // The size of the contents area. + virtual WebSize contentsSize() const = 0; + + // Returns the minimum preferred width of the content contained in the + // current document. + virtual int contentsPreferredWidth() const = 0; + + // Returns the scroll height of the document element. This is + // equivalent to the DOM property of the same name, and is the minimum + // height required to display the document without scrollbars. + virtual int documentElementScrollHeight() const = 0; + + // Returns true if the contents (minus scrollbars) has non-zero area. + virtual bool hasVisibleContent() const = 0; + + virtual bool hasHorizontalScrollbar() const = 0; + virtual bool hasVerticalScrollbar() const = 0; + + + // Hierarchy ---------------------------------------------------------- + + // Returns the containing view. + virtual WebView* view() const = 0; + + // Returns the frame that opened this frame or 0 if there is none. + virtual WebFrame* opener() const = 0; + + // Sets the frame that opened this one or 0 if there is none. + virtual void setOpener(const WebFrame*) = 0; + + // Reset the frame that opened this frame to 0. + // This is executed between layout tests runs + void clearOpener() { setOpener(0); } + + // Returns the parent frame or 0 if this is a top-most frame. + virtual WebFrame* parent() const = 0; + + // Returns the top-most frame in the hierarchy containing this frame. + virtual WebFrame* top() const = 0; + + // Returns the first/last child frame. + virtual WebFrame* firstChild() const = 0; + virtual WebFrame* lastChild() const = 0; + + // Returns the next/previous sibling frame. + virtual WebFrame* nextSibling() const = 0; + virtual WebFrame* previousSibling() const = 0; + + // Returns the next/previous frame in "frame traversal order" + // optionally wrapping around. + virtual WebFrame* traverseNext(bool wrap) const = 0; + virtual WebFrame* traversePrevious(bool wrap) const = 0; + + // Returns the child frame identified by the given name. + virtual WebFrame* findChildByName(const WebString& name) const = 0; + + // Returns the child frame identified by the given xpath expression. + virtual WebFrame* findChildByExpression(const WebString& xpath) const = 0; + + + // Content ------------------------------------------------------------ + + virtual WebDocument document() const = 0; + + virtual WebAnimationController* animationController() = 0; + + virtual WebPerformance performance() const = 0; + + + // Scripting ---------------------------------------------------------- + + // Returns a NPObject corresponding to this frame's DOMWindow. + virtual NPObject* windowObject() const = 0; + + // Binds a NPObject as a property of this frame's DOMWindow. + virtual void bindToWindowObject(const WebString& name, NPObject*) = 0; + + // Executes script in the context of the current page. + virtual void executeScript(const WebScriptSource&) = 0; + + // Executes JavaScript in a new world associated with the web frame. + // The script gets its own global scope and its own prototypes for + // intrinsic JavaScript objects (String, Array, and so-on). It also + // gets its own wrappers for all DOM nodes and DOM constructors. + // extensionGroup is an embedder-provided specifier that controls which + // v8 extensions are loaded into the new context - see + // WebKit::registerExtension for the corresponding specifier. + virtual void executeScriptInIsolatedWorld( + int worldID, const WebScriptSource* sources, unsigned numSources, + int extensionGroup) = 0; + + // Associates an isolated world (see above for description) with a security + // origin. XMLHttpRequest instances used in that world will be considered + // to come from that origin, not the frame's. + virtual void setIsolatedWorldSecurityOrigin( + int worldID, const WebSecurityOrigin&) = 0; + + // Logs to the console associated with this frame. + virtual void addMessageToConsole(const WebConsoleMessage&) = 0; + + // Calls window.gc() if it is defined. + virtual void collectGarbage() = 0; + + // Check if the scripting URL represents a mixed content condition relative + // to this frame. + virtual bool checkIfRunInsecureContent(const WebURL&) const = 0; + +#if WEBKIT_USING_V8 + // Executes script in the context of the current page and returns the value + // that the script evaluated to. + virtual v8::Handle<v8::Value> executeScriptAndReturnValue( + const WebScriptSource&) = 0; + + // Returns the V8 context for this frame, or an empty handle if there + // is none. + virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0; + + // Creates an instance of file system object. + virtual v8::Handle<v8::Value> createFileSystem(WebFileSystem::Type, + const WebString& name, + const WebString& rootURL) = 0; + // Creates an instance of file or directory entry object. + virtual v8::Handle<v8::Value> createFileEntry(WebFileSystem::Type, + const WebString& fileSystemName, + const WebString& fileSystemRootURL, + const WebString& filePath, + bool isDirectory) = 0; +#endif + + + // Navigation ---------------------------------------------------------- + + // Reload the current document. + // True |ignoreCache| explicitly bypasses caches. + // False |ignoreCache| revalidates any existing cache entries. + virtual void reload(bool ignoreCache = false) = 0; + + // Load the given URL. + virtual void loadRequest(const WebURLRequest&) = 0; + + // Load the given history state, corresponding to a back/forward + // navigation. + virtual void loadHistoryItem(const WebHistoryItem&) = 0; + + // Loads the given data with specific mime type and optional text + // encoding. For HTML data, baseURL indicates the security origin of + // the document and is used to resolve links. If specified, + // unreachableURL is reported via WebDataSource::unreachableURL. If + // replace is false, then this data will be loaded as a normal + // navigation. Otherwise, the current history item will be replaced. + virtual void loadData(const WebData& data, + const WebString& mimeType, + const WebString& textEncoding, + const WebURL& baseURL, + const WebURL& unreachableURL = WebURL(), + bool replace = false) = 0; + + // This method is short-hand for calling LoadData, where mime_type is + // "text/html" and text_encoding is "UTF-8". + virtual void loadHTMLString(const WebData& html, + const WebURL& baseURL, + const WebURL& unreachableURL = WebURL(), + bool replace = false) = 0; + + // Returns true if the current frame is busy loading content. + virtual bool isLoading() const = 0; + + // Stops any pending loads on the frame and its children. + virtual void stopLoading() = 0; + + // Returns the data source that is currently loading. May be null. + virtual WebDataSource* provisionalDataSource() const = 0; + + // Returns the data source that is currently loaded. + virtual WebDataSource* dataSource() const = 0; + + // Returns the previous history item. Check WebHistoryItem::isNull() + // before using. + virtual WebHistoryItem previousHistoryItem() const = 0; + + // Returns the current history item. Check WebHistoryItem::isNull() + // before using. + virtual WebHistoryItem currentHistoryItem() const = 0; + + // View-source rendering mode. Set this before loading an URL to cause + // it to be rendered in view-source mode. + virtual void enableViewSourceMode(bool) = 0; + virtual bool isViewSourceModeEnabled() const = 0; + + // Sets the referrer for the given request to be the specified URL or + // if that is null, then it sets the referrer to the referrer that the + // frame would use for subresources. NOTE: This method also filters + // out invalid referrers (e.g., it is invalid to send a HTTPS URL as + // the referrer for a HTTP request). + virtual void setReferrerForRequest(WebURLRequest&, const WebURL&) = 0; + + // Called to associate the WebURLRequest with this frame. The request + // will be modified to inherit parameters that allow it to be loaded. + // This method ends up triggering WebFrameClient::willSendRequest. + // DEPRECATED: Please use createAssociatedURLLoader instead. + virtual void dispatchWillSendRequest(WebURLRequest&) = 0; + + // Returns a WebURLLoader that is associated with this frame. The loader + // will, for example, be cancelled when WebFrame::stopLoading is called. + // FIXME: stopLoading does not yet cancel an associated loader!! + virtual WebURLLoader* createAssociatedURLLoader(const WebURLLoaderOptions& = WebURLLoaderOptions()) = 0; + + // Called from within WebFrameClient::didReceiveDocumentData to commit + // data for the frame that will be used to construct the frame's + // document. + virtual void commitDocumentData(const char* data, size_t length) = 0; + + // Returns the number of registered unload listeners. + virtual unsigned unloadListenerCount() const = 0; + + // Returns true if a user gesture is currently being processed. + virtual bool isProcessingUserGesture() const = 0; + + // Returns true if this frame is in the process of opening a new frame + // with a suppressed opener. + virtual bool willSuppressOpenerInNewFrame() const = 0; + + + // Editing ------------------------------------------------------------- + + // Replaces the selection with the given text. + virtual void replaceSelection(const WebString& text) = 0; + + virtual void insertText(const WebString& text) = 0; + + virtual void setMarkedText(const WebString& text, unsigned location, unsigned length) = 0; + virtual void unmarkText() = 0; + virtual bool hasMarkedText() const = 0; + + virtual WebRange markedRange() const = 0; + + virtual void setSelectionToRange(const WebRange&) = 0; + + // Returns the frame rectangle in window coordinate space of the given text + // range. + virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0; + + // Returns the index of a character in the Frame's text stream at the given + // point. The point is in the window coordinate space. Will return + // WTF::notFound if the point is invalid. + virtual size_t characterIndexForPoint(const WebPoint&) const = 0; + + // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll, + // Unselect, etc. See EditorCommand.cpp for the full list of supported + // commands. + virtual bool executeCommand(const WebString&, const WebNode& = WebNode()) = 0; + virtual bool executeCommand(const WebString&, const WebString& value) = 0; + virtual bool isCommandEnabled(const WebString&) const = 0; + + // Spell-checking support. + virtual void enableContinuousSpellChecking(bool) = 0; + virtual bool isContinuousSpellCheckingEnabled() const = 0; + + + // Selection ----------------------------------------------------------- + + virtual bool hasSelection() const = 0; + + virtual WebRange selectionRange() const = 0; + + virtual WebString selectionAsText() const = 0; + virtual WebString selectionAsMarkup() const = 0; + + // Expands the selection to a word around the caret and returns + // true. Does nothing and returns false if there is no caret or + // there is ranged selection. + virtual bool selectWordAroundCaret() = 0; + + virtual void selectRange(const WebPoint& start, const WebPoint& end) = 0; + + + // Printing ------------------------------------------------------------ + + // Reformats the WebFrame for printing. pageSize is the page size in + // points (a point in 1/72 of an inch). If |constrainToNode| node is + // specified, then only the given node is printed (for now only plugins are + // supported), instead of the entire frame. printerDPI is the user + // selected, DPI for the printer. Returns the number of pages that can be + // printed at the given page size. The out param useBrowserOverlays + // specifies whether the browser process should use its overlays (header, + // footer, margins etc) or whether the renderer controls this. + virtual int printBegin(const WebSize& pageSize, + const WebNode& constrainToNode = WebNode(), + int printerDPI = 72, + bool* useBrowserOverlays = 0) = 0; + + // Returns the page shrinking factor calculated by webkit (usually + // between 1/1.25 and 1/2). Returns 0 if the page number is invalid or + // not in printing mode. + virtual float getPrintPageShrink(int page) = 0; + + // Prints one page, and returns the calculated page shrinking factor + // (usually between 1/1.25 and 1/2). Returns 0 if the page number is + // invalid or not in printing mode. + virtual float printPage(int pageToPrint, WebCanvas*) = 0; + + // Reformats the WebFrame for screen display. + virtual void printEnd() = 0; + + // If the frame contains a full-frame plugin or the given node refers to a + // plugin whose content indicates that printed output should not be scaled, + // return true, otherwise return false. + virtual bool isPrintScalingDisabledForPlugin(const WebNode& = WebNode()) = 0; + + // CSS3 Paged Media ---------------------------------------------------- + + // Returns true if page box (margin boxes and page borders) is visible. + virtual bool isPageBoxVisible(int pageIndex) = 0; + + // Returns true if the page style has custom size information. + virtual bool hasCustomPageSizeStyle(int pageIndex) = 0; + + // Returns the preferred page size and margins in pixels, assuming 96 + // pixels per inch. pageSize, marginTop, marginRight, marginBottom, + // marginLeft must be initialized to the default values that are used if + // auto is specified. + virtual void pageSizeAndMarginsInPixels(int pageIndex, + WebSize& pageSize, + int& marginTop, + int& marginRight, + int& marginBottom, + int& marginLeft) = 0; + + // Returns the value for a page property that is only defined when printing. + // printBegin must have been called before this method. + virtual WebString pageProperty(const WebString& propertyName, int pageIndex) = 0; + + // Find-in-page -------------------------------------------------------- + + // Searches a frame for a given string. + // + // If a match is found, this function will select it (scrolling down to + // make it visible if needed) and fill in selectionRect with the + // location of where the match was found (in window coordinates). + // + // If no match is found, this function clears all tickmarks and + // highlighting. + // + // Returns true if the search string was found, false otherwise. + virtual bool find(int identifier, + const WebString& searchText, + const WebFindOptions& options, + bool wrapWithinFrame, + WebRect* selectionRect) = 0; + + // Notifies the frame that we are no longer interested in searching. + // This will abort any asynchronous scoping effort already under way + // (see the function scopeStringMatches for details) and erase all + // tick-marks and highlighting from the previous search. If + // clearSelection is true, it will also make sure the end state for the + // find operation does not leave a selection. This can occur when the + // user clears the search string but does not close the find box. + virtual void stopFinding(bool clearSelection) = 0; + + // Counts how many times a particular string occurs within the frame. + // It also retrieves the location of the string and updates a vector in + // the frame so that tick-marks and highlighting can be drawn. This + // function does its work asynchronously, by running for a certain + // time-slice and then scheduling itself (co-operative multitasking) to + // be invoked later (repeating the process until all matches have been + // found). This allows multiple frames to be searched at the same time + // and provides a way to cancel at any time (see + // cancelPendingScopingEffort). The parameter searchText specifies + // what to look for and |reset| signals whether this is a brand new + // request or a continuation of the last scoping effort. + virtual void scopeStringMatches(int identifier, + const WebString& searchText, + const WebFindOptions& options, + bool reset) = 0; + + // Cancels any outstanding requests for scoping string matches on a frame. + virtual void cancelPendingScopingEffort() = 0; + + // This function is called on the main frame during the scoping effort + // to keep a running tally of the accumulated total match-count for all + // frames. After updating the count it will notify the WebViewClient + // about the new count. + virtual void increaseMatchCount(int count, int identifier) = 0; + + // This function is called on the main frame to reset the total number + // of matches found during the scoping effort. + virtual void resetMatchCount() = 0; + + + // Events -------------------------------------------------------------- + + // These functions all work on the WebFrame's DOMWindow. Keep in mind + // that these events might be generated by web content and not genuine + // DOM events. + + virtual void addEventListener(const WebString& eventType, + WebDOMEventListener*, bool useCapture) = 0; + virtual void removeEventListener(const WebString& eventType, + WebDOMEventListener*, bool useCapture) = 0; + virtual bool dispatchEvent(const WebDOMEvent&) = 0; + + + // Web Intents --------------------------------------------------------- + + // Forwards a web intents reply from the invoked activity back to the + // appropriate registered Javascript callback. The |intentIdentifier| is + // the WebIntent parameter received from the dispatchIntent method. + virtual void handleIntentResult(int intentIdentifier, const WebString&) = 0; + + // Forwards a web intents failure notification from the invoked activity + // or intervening browser logic back to the appropriate registered + // Javascript callback. The |intentIdentifier| is the WebIntent parameter + // received from the dispatchIntent method. + virtual void handleIntentFailure(int intentIdentifier, const WebString&) = 0; + + + // Utility ------------------------------------------------------------- + + // Returns the contents of this frame as a string. If the text is + // longer than maxChars, it will be clipped to that length. WARNING: + // This function may be slow depending on the number of characters + // retrieved and page complexity. For a typically sized page, expect + // it to take on the order of milliseconds. + // + // If there is room, subframe text will be recursively appended. Each + // frame will be separated by an empty line. + virtual WebString contentAsText(size_t maxChars) const = 0; + + // Returns HTML text for the contents of this frame. This is generated + // from the DOM. + virtual WebString contentAsMarkup() const = 0; + + // Returns a text representation of the render tree. This method is used + // to support layout tests. + virtual WebString renderTreeAsText(RenderAsTextControls toShow = RenderAsTextNormal) const = 0; + + // Returns the counter value for the specified element. This method is + // used to support layout tests. + virtual WebString counterValueForElementById(const WebString& id) const = 0; + + // Calls markerTextForListItem() defined in WebCore/rendering/RenderTreeAsText.h. + virtual WebString markerTextForListItem(const WebElement&) const = 0; + + // Returns the number of page where the specified element will be put. + // This method is used to support layout tests. + virtual int pageNumberForElementById(const WebString& id, + float pageWidthInPixels, + float pageHeightInPixels) const = 0; + + // Prints all of the pages into the canvas, with page boundaries drawn as + // one pixel wide blue lines. This method exists to support layout tests. + virtual void printPagesWithBoundaries(WebCanvas*, const WebSize&) = 0; + + // Returns the bounds rect for current selection. If selection is performed + // on transformed text, the rect will still bound the selection but will + // not be transformed itself. If no selection is present, the rect will be + // empty ((0,0), (0,0)). + virtual WebRect selectionBoundsRect() const = 0; + + // Only for testing purpose: + // Returns true if selection.anchorNode has a marker on range from |from| with |length|. + virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const = 0; + + // Pauses and samples an SVG animation. Returns false if there's no svg + // animation to pause. This is only for testing. + virtual bool pauseSVGAnimation(const WebString& animationId, + double time, + const WebString& elementId) = 0; + + // Dumps the layer tree, used by the accelerated compositor, in + // text form. This is used only by layout tests. + virtual WebString layerTreeAsText(bool showDebugInfo = false) const = 0; + +protected: + ~WebFrame() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebFrameClient.h b/Source/WebKit/chromium/public/WebFrameClient.h new file mode 100644 index 000000000..94abe83fb --- /dev/null +++ b/Source/WebKit/chromium/public/WebFrameClient.h @@ -0,0 +1,406 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFrameClient_h +#define WebFrameClient_h + +#include "WebDOMMessageEvent.h" +#include "WebIconURL.h" +#include "WebNavigationPolicy.h" +#include "WebNavigationType.h" +#include "WebSecurityOrigin.h" +#include "WebStorageQuotaType.h" +#include "WebTextDirection.h" +#include "platform/WebCommon.h" +#include "platform/WebFileSystem.h" +#include "platform/WebURLError.h" + +#if WEBKIT_USING_V8 +#include <v8.h> +#endif + +namespace WebKit { + +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebCookieJar; +class WebDataSource; +class WebDOMEvent; +class WebFormElement; +class WebFrame; +class WebIntentServiceInfo; +class WebIntent; +class WebMediaPlayer; +class WebMediaPlayerClient; +class WebNode; +class WebPlugin; +class WebSharedWorker; +class WebStorageQuotaCallbacks; +class WebString; +class WebURL; +class WebURLLoader; +class WebURLRequest; +class WebURLResponse; +class WebWorker; +class WebSharedWorkerClient; +struct WebPluginParams; +struct WebRect; +struct WebSize; +struct WebURLError; + +class WebFrameClient { +public: + // Factory methods ----------------------------------------------------- + + // May return null. + virtual WebPlugin* createPlugin(WebFrame*, const WebPluginParams&) { return 0; } + + // May return null. + virtual WebWorker* createWorker(WebFrame*, WebSharedWorkerClient*) { return 0; } + + // May return null. + virtual WebSharedWorker* createSharedWorker(WebFrame*, const WebURL&, const WebString&, unsigned long long) { return 0; } + + // May return null. + virtual WebMediaPlayer* createMediaPlayer(WebFrame*, WebMediaPlayerClient*) { return 0; } + + // May return null. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebFrame*, WebApplicationCacheHostClient*) { return 0; } + + + // Services ------------------------------------------------------------ + + // A frame specific cookie jar. May return null, in which case + // WebKitPlatformSupport::cookieJar() will be called to access cookies. + virtual WebCookieJar* cookieJar(WebFrame*) { return 0; } + + + // General notifications ----------------------------------------------- + + // This frame has been detached from the view. + // + // FIXME: Do not use this in new code. Currently this is used by code in + // Chromium that errantly caches WebKit objects. + virtual void frameDetached(WebFrame*) { } + + // This frame is about to be closed. + virtual void willClose(WebFrame*) { } + + // Load commands ------------------------------------------------------- + + // The client should handle the navigation externally. + virtual void loadURLExternally( + WebFrame*, const WebURLRequest&, WebNavigationPolicy) { } + virtual void loadURLExternally( + WebFrame*, const WebURLRequest&, WebNavigationPolicy, const WebString& downloadName) { } + + + // Navigational queries ------------------------------------------------ + + // The client may choose to alter the navigation policy. Otherwise, + // defaultPolicy should just be returned. + virtual WebNavigationPolicy decidePolicyForNavigation( + WebFrame*, const WebURLRequest&, WebNavigationType, + const WebNode& originatingNode, + WebNavigationPolicy defaultPolicy, bool isRedirect) { return defaultPolicy; } + + // Query if the specified request can be handled. + virtual bool canHandleRequest( + WebFrame*, const WebURLRequest& request) { return true; } + + // Returns an error corresponding to canHandledRequest() returning false. + virtual WebURLError cannotHandleRequestError( + WebFrame*, const WebURLRequest& request) { return WebURLError(); } + + // Returns an error corresponding to a user cancellation event. + virtual WebURLError cancelledError( + WebFrame*, const WebURLRequest& request) { return WebURLError(); } + + // Notify that a URL cannot be handled. + virtual void unableToImplementPolicyWithError( + WebFrame*, const WebURLError&) { } + + + // Navigational notifications ------------------------------------------ + + // A form submission has been requested, but the page's submit event handler + // hasn't yet had a chance to run (and possibly alter/interrupt the submit.) + virtual void willSendSubmitEvent(WebFrame*, const WebFormElement&) { } + + // A form submission is about to occur. + virtual void willSubmitForm(WebFrame*, const WebFormElement&) { } + + // A client-side redirect will occur. This may correspond to a <META + // refresh> or some script activity. + virtual void willPerformClientRedirect( + WebFrame*, const WebURL& from, const WebURL& to, + double interval, double fireTime) { } + + // A client-side redirect was cancelled. + virtual void didCancelClientRedirect(WebFrame*) { } + + // A client-side redirect completed. + virtual void didCompleteClientRedirect(WebFrame*, const WebURL& fromURL) { } + + // A datasource has been created for a new navigation. The given + // datasource will become the provisional datasource for the frame. + virtual void didCreateDataSource(WebFrame*, WebDataSource*) { } + + // A new provisional load has been started. + virtual void didStartProvisionalLoad(WebFrame*) { } + + // The provisional load was redirected via a HTTP 3xx response. + virtual void didReceiveServerRedirectForProvisionalLoad(WebFrame*) { } + + // The provisional load failed. + virtual void didFailProvisionalLoad(WebFrame*, const WebURLError&) { } + + // Notifies the client to commit data for the given frame. The client + // may optionally prevent default processing by setting preventDefault + // to true before returning. If default processing is prevented, then + // it is up to the client to manually call commitDocumentData on the + // WebFrame. It is only valid to call commitDocumentData within a call + // to didReceiveDocumentData. If commitDocumentData is not called, + // then an empty document will be loaded. + virtual void didReceiveDocumentData( + WebFrame*, const char* data, size_t length, bool& preventDefault) { } + + // The provisional datasource is now committed. The first part of the + // response body has been received, and the encoding of the response + // body is known. + virtual void didCommitProvisionalLoad(WebFrame*, bool isNewNavigation) { } + + // The window object for the frame has been cleared of any extra + // properties that may have been set by script from the previously + // loaded document. + virtual void didClearWindowObject(WebFrame*) { } + + // The document element has been created. + virtual void didCreateDocumentElement(WebFrame*) { } + + // The page title is available. + virtual void didReceiveTitle(WebFrame* frame, const WebString& title, WebTextDirection direction) { } + + // The icon for the page have changed. + virtual void didChangeIcon(WebFrame*, WebIconURL::Type) { } + + // The frame's document finished loading. + virtual void didFinishDocumentLoad(WebFrame*) { } + + // The 'load' event was dispatched. + virtual void didHandleOnloadEvents(WebFrame*) { } + + // The frame's document or one of its subresources failed to load. + virtual void didFailLoad(WebFrame*, const WebURLError&) { } + + // The frame's document and all of its subresources succeeded to load. + virtual void didFinishLoad(WebFrame*) { } + + // The navigation resulted in no change to the documents within the page. + // For example, the navigation may have just resulted in scrolling to a + // named anchor or a PopState event may have been dispatched. + virtual void didNavigateWithinPage(WebFrame*, bool isNewNavigation) { } + + // The navigation resulted in scrolling the page to a named anchor instead + // of downloading a new document. + virtual void didChangeLocationWithinPage(WebFrame*) { } + + // Called upon update to scroll position, document state, and other + // non-navigational events related to the data held by WebHistoryItem. + // WARNING: This method may be called very frequently. + virtual void didUpdateCurrentHistoryItem(WebFrame*) { } + + + // Low-level resource notifications ------------------------------------ + + // An identifier was assigned to the specified request. The client + // should remember this association if interested in subsequent events. + virtual void assignIdentifierToRequest( + WebFrame*, unsigned identifier, const WebURLRequest&) { } + + // Remove the association between an identifier assigned to a request if + // the client keeps such an association. + virtual void removeIdentifierForRequest(unsigned identifier) { } + + // A request is about to be sent out, and the client may modify it. Request + // is writable, and changes to the URL, for example, will change the request + // made. If this request is the result of a redirect, then redirectResponse + // will be non-null and contain the response that triggered the redirect. + virtual void willSendRequest( + WebFrame*, unsigned identifier, WebURLRequest&, + const WebURLResponse& redirectResponse) { } + + // Response headers have been received for the resource request given + // by identifier. + virtual void didReceiveResponse( + WebFrame*, unsigned identifier, const WebURLResponse&) { } + + // The resource request given by identifier succeeded. + virtual void didFinishResourceLoad( + WebFrame*, unsigned identifier) { } + + // The resource request given by identifier failed. + virtual void didFailResourceLoad( + WebFrame*, unsigned identifier, const WebURLError&) { } + + // The specified request was satified from WebCore's memory cache. + virtual void didLoadResourceFromMemoryCache( + WebFrame*, const WebURLRequest&, const WebURLResponse&) { } + + // This frame has displayed inactive content (such as an image) from an + // insecure source. Inactive content cannot spread to other frames. + virtual void didDisplayInsecureContent(WebFrame*) { } + + // The indicated security origin has run active content (such as a + // script) from an insecure source. Note that the insecure content can + // spread to other frames in the same origin. + virtual void didRunInsecureContent(WebFrame*, const WebSecurityOrigin&, const WebURL& insecureURL) { } + + // A reflected XSS was encountered in the page and suppressed. + virtual void didDetectXSS(WebFrame*, const WebURL&, bool didBlockEntirePage) { } + + // This frame adopted the resource that is being loaded. This happens when + // an iframe, that is loading a subresource, is transferred between windows. + virtual void didAdoptURLLoader(WebURLLoader*) { } + + // Script notifications ------------------------------------------------ + + // Script in the page tried to allocate too much memory. + virtual void didExhaustMemoryAvailableForScript(WebFrame*) { } + +#if WEBKIT_USING_V8 + // Notifies that a new script context has been created for this frame. + // This is similar to didClearWindowObject but only called once per + // frame context. + virtual void didCreateScriptContext(WebFrame*, v8::Handle<v8::Context>, int worldId) { } + + // WebKit is about to release its reference to a v8 context for a frame. + virtual void willReleaseScriptContext(WebFrame*, v8::Handle<v8::Context>, int worldId) { } +#endif + + // Geometry notifications ---------------------------------------------- + + // The frame's document finished the initial layout of a page. + virtual void didFirstLayout(WebFrame*) { } + + // The frame's document finished the initial non-empty layout of a page. + virtual void didFirstVisuallyNonEmptyLayout(WebFrame*) { } + + // The size of the content area changed. + virtual void didChangeContentsSize(WebFrame*, const WebSize&) { } + + // The main frame scrolled. + virtual void didChangeScrollOffset(WebFrame*) { } + + + // Find-in-page notifications ------------------------------------------ + + // Notifies how many matches have been found so far, for a given + // identifier. |finalUpdate| specifies whether this is the last update + // (all frames have completed scoping). + virtual void reportFindInPageMatchCount( + int identifier, int count, bool finalUpdate) { } + + // Notifies what tick-mark rect is currently selected. The given + // identifier lets the client know which request this message belongs + // to, so that it can choose to ignore the message if it has moved on + // to other things. The selection rect is expected to have coordinates + // relative to the top left corner of the web page area and represent + // where on the screen the selection rect is currently located. + virtual void reportFindInPageSelection( + int identifier, int activeMatchOrdinal, const WebRect& selection) { } + + // FileSystem ---------------------------------------------------- + + // Requests to open a FileSystem. + // |size| indicates how much storage space (in bytes) the caller expects + // to need. + // WebFileSystemCallbacks::didOpenFileSystem() must be called with + // a name and root path for the requested FileSystem when the operation + // is completed successfully. WebFileSystemCallbacks::didFail() must be + // called otherwise. The create bool is for indicating whether or not to + // create root path for file systems if it do not exist. + virtual void openFileSystem( + WebFrame*, WebFileSystem::Type, long long size, + bool create, WebFileSystemCallbacks*) { } + + // Quota --------------------------------------------------------- + + // Queries the origin's storage usage and quota information. + // WebStorageQuotaCallbacks::didQueryStorageUsageAndQuota will be called + // with the current usage and quota information for the origin. When + // an error occurs WebStorageQuotaCallbacks::didFail is called with an + // error code. + // The callbacks object is deleted when the callback method is called + // and does not need to be (and should not be) deleted manually. + virtual void queryStorageUsageAndQuota( + WebFrame*, WebStorageQuotaType, WebStorageQuotaCallbacks*) { } + + // Requests a new quota size for the origin's storage. + // |newQuotaInBytes| indicates how much storage space (in bytes) the + // caller expects to need. + // WebStorageQuotaCallbacks::didGrantStorageQuota will be called when + // a new quota is granted. WebStorageQuotaCallbacks::didFail + // is called with an error code otherwise. + // Note that the requesting quota size may not always be granted and + // a smaller amount of quota than requested might be returned. + // The callbacks object is deleted when the callback method is called + // and does not need to be (and should not be) deleted manually. + virtual void requestStorageQuota( + WebFrame*, WebStorageQuotaType, + unsigned long long newQuotaInBytes, + WebStorageQuotaCallbacks*) { } + + // Web Intents --------------------------------------------------- + + // Register a service to handle Web Intents. + virtual void registerIntentService(WebFrame*, const WebIntentServiceInfo&) { } + + // Start a Web Intents activity. Replies to this request should be sent to + // the WebFrame starting the activity. + virtual void dispatchIntent(WebFrame*, const WebIntent&) { } + + // Messages ------------------------------------------------------ + + // Notifies the embedder that a postMessage was issued on this frame, and + // gives the embedder a chance to handle it instead of WebKit. Returns true + // if the embedder handled it. + virtual bool willCheckAndDispatchMessageEvent( + WebFrame* source, + WebSecurityOrigin target, + WebDOMMessageEvent) { return false; } + +protected: + ~WebFrameClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebGeolocationClient.h b/Source/WebKit/chromium/public/WebGeolocationClient.h new file mode 100644 index 000000000..1dfb0cd86 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationClient.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationClient_h +#define WebGeolocationClient_h + +namespace WebKit { +class WebGeolocationController; +class WebGeolocationPermissionRequest; +class WebGeolocationPosition; + +class WebGeolocationClient { +public: + virtual ~WebGeolocationClient() {} + + virtual void startUpdating() = 0; + virtual void stopUpdating() = 0; + virtual void setEnableHighAccuracy(bool) = 0; + virtual void geolocationDestroyed() = 0; + virtual bool lastPosition(WebGeolocationPosition&) = 0; + + virtual void requestPermission(const WebGeolocationPermissionRequest&) = 0; + virtual void cancelPermissionRequest(const WebGeolocationPermissionRequest&) = 0; + + // The controller is valid until geolocationDestroyed() is invoked. + // Ownership of the WebGeolocationController is transferred to the client. + virtual void setController(WebGeolocationController*) = 0; +}; + +} // namespace WebKit + +#endif // WebGeolocationClient_h diff --git a/Source/WebKit/chromium/public/WebGeolocationClientMock.h b/Source/WebKit/chromium/public/WebGeolocationClientMock.h new file mode 100644 index 000000000..052a546ad --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationClientMock.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2010, Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebGeolocationClientMock_h +#define WebGeolocationClientMock_h + +#include "WebGeolocationClient.h" +#include "platform/WebCommon.h" +#include "platform/WebPrivateOwnPtr.h" + +namespace WebCore { +class GeolocationClientMock; +} + +namespace WebKit { +class WebGeolocationPosition; +class WebString; + +class WebGeolocationClientMock : public WebGeolocationClient { +public: + WEBKIT_EXPORT static WebGeolocationClientMock* create(); + ~WebGeolocationClientMock() { reset(); } + + WEBKIT_EXPORT void setPosition(double latitude, double longitude, double accuracy); + WEBKIT_EXPORT void setError(int errorCode, const WebString& message); + WEBKIT_EXPORT void setPermission(bool); + WEBKIT_EXPORT int numberOfPendingPermissionRequests() const; + WEBKIT_EXPORT void resetMock(); + + virtual void startUpdating(); + virtual void stopUpdating(); + virtual void setEnableHighAccuracy(bool); + + virtual void geolocationDestroyed(); + virtual void setController(WebGeolocationController*); + + virtual void requestPermission(const WebGeolocationPermissionRequest&); + virtual void cancelPermissionRequest(const WebGeolocationPermissionRequest&); + + virtual bool lastPosition(WebGeolocationPosition& webPosition); + +private: + WebGeolocationClientMock(); + WEBKIT_EXPORT void reset(); + + WebPrivateOwnPtr<WebCore::GeolocationClientMock> m_clientMock; +}; +} + +#endif // WebGeolocationClientMock_h diff --git a/Source/WebKit/chromium/public/WebGeolocationController.h b/Source/WebKit/chromium/public/WebGeolocationController.h new file mode 100644 index 000000000..1e2bf88e9 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationController.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationController_h +#define WebGeolocationController_h + +#include "platform/WebCommon.h" +#include "platform/WebNonCopyable.h" + +namespace WebCore { class GeolocationController; } + +namespace WebKit { + +class WebGeolocationPosition; +class WebGeolocationError; + +// Note that the WebGeolocationController is invalid after the +// WebGeolocationClient::geolocationDestroyed() has been received. +class WebGeolocationController : public WebNonCopyable { +public: + WEBKIT_EXPORT void positionChanged(const WebGeolocationPosition&); + WEBKIT_EXPORT void errorOccurred(const WebGeolocationError&); + +#if WEBKIT_IMPLEMENTATION + WebGeolocationController(WebCore::GeolocationController* c) + : m_private(c) + { + } + + WebCore::GeolocationController* controller() const { return m_private; } +#endif + +private: + // No implementation for the default constructor. Declared private to ensure that no instances + // can be created by the consumers of Chromium WebKit. + WebGeolocationController(); + + WebCore::GeolocationController* m_private; +}; + +} // namespace WebKit + +#endif // WebGeolocationController_h diff --git a/Source/WebKit/chromium/public/WebGeolocationError.h b/Source/WebKit/chromium/public/WebGeolocationError.h new file mode 100644 index 000000000..4f941b973 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationError.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationError_h +#define WebGeolocationError_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +namespace WebCore { class GeolocationError; } + +namespace WebKit { + +class WebString; + +class WebGeolocationError { +public: + enum Error { + ErrorPermissionDenied, + ErrorPositionUnavailable + }; + + WebGeolocationError(Error code, const WebString& message) { assign(code, message); } + WebGeolocationError(const WebGeolocationError& other) { assign(other); } + ~WebGeolocationError() { reset(); } + + WEBKIT_EXPORT void assign(Error code, const WebString& message); + WEBKIT_EXPORT void assign(const WebGeolocationError&); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebGeolocationError(WTF::PassRefPtr<WebCore::GeolocationError>); + WebGeolocationError& operator=(WTF::PassRefPtr<WebCore::GeolocationError>); + operator WTF::PassRefPtr<WebCore::GeolocationError>() const; +#endif + +private: + WebPrivatePtr<WebCore::GeolocationError> m_private; +}; + +} // namespace WebKit + +#endif // WebGeolocationError_h diff --git a/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h b/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h new file mode 100644 index 000000000..7e5f9b3a3 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationPermissionRequest.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationPermissionRequest_h +#define WebGeolocationPermissionRequest_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { +class Geolocation; +} + +namespace WebKit { +class WebSecurityOrigin; + +// WebGeolocationPermissionRequest encapsulates a WebCore Geolocation object and represents +// a request from WebCore for permission to be determined for that Geolocation object. +// The underlying Geolocation object is guaranteed to be valid until the invocation of +// either WebGeolocationPermissionRequest::setIsAllowed (request complete) or +// WebGeolocationClient::cancelPermissionRequest (request cancelled). +class WebGeolocationPermissionRequest { +public: + WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + WEBKIT_EXPORT void setIsAllowed(bool); + +#if WEBKIT_IMPLEMENTATION + WebGeolocationPermissionRequest(WebCore::Geolocation* geolocation) + : m_private(geolocation) + { + } + + WebCore::Geolocation* geolocation() const { return m_private; } +#endif + +private: + WebCore::Geolocation* m_private; +}; +} + +#endif // WebGeolocationPermissionRequest_h diff --git a/Source/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h b/Source/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h new file mode 100644 index 000000000..86515239a --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationPermissionRequestManager.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationPermissionRequestManager_h +#define WebGeolocationPermissionRequestManager_h + +#include "platform/WebNonCopyable.h" +#include "platform/WebPrivateOwnPtr.h" + +namespace WebKit { + +class WebGeolocationPermissionRequest; +class WebGeolocationPermissionRequestManagerPrivate; + +// This class is used to map between integer identifiers and WebGeolocationPermissionRequest +// instances. The intended usage is that on WebGeolocationClient::requestPermission(), +// the implementer can call add() to associate an id with the WebGeolocationPermissionRequest object. +// Once the permission request has been decided, the second remove() method can be used to +// find the request. On WebGeolocationClient::cancelPermissionRequest, the first remove() method will +// remove the association with the id. +class WebGeolocationPermissionRequestManager : public WebNonCopyable { +public: + WebGeolocationPermissionRequestManager() { init(); } + ~WebGeolocationPermissionRequestManager() { reset(); } + + WEBKIT_EXPORT int add(const WebKit::WebGeolocationPermissionRequest&); + WEBKIT_EXPORT bool remove(const WebKit::WebGeolocationPermissionRequest&, int&); + WEBKIT_EXPORT bool remove(int, WebKit::WebGeolocationPermissionRequest&); + +private: + WEBKIT_EXPORT void init(); + WEBKIT_EXPORT void reset(); + + WebPrivateOwnPtr<WebGeolocationPermissionRequestManagerPrivate> m_private; + int m_lastId; +}; + +} + +#endif // WebGeolocationPermissionRequestManager_h + diff --git a/Source/WebKit/chromium/public/WebGeolocationPosition.h b/Source/WebKit/chromium/public/WebGeolocationPosition.h new file mode 100644 index 000000000..9a1c96136 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGeolocationPosition.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebGeolocationPosition_h +#define WebGeolocationPosition_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +namespace WebCore { class GeolocationPosition; } + +namespace WebKit { + +class WebGeolocationPosition { +public: + WebGeolocationPosition() {} + WebGeolocationPosition(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed) + { + assign(timestamp, latitude, longitude, accuracy, providesAltitude, altitude, providesAltitudeAccuracy, altitudeAccuracy, providesHeading, heading, providesSpeed, speed); + } + WebGeolocationPosition(const WebGeolocationPosition& other) { assign(other); } + ~WebGeolocationPosition() { reset(); } + + WEBKIT_EXPORT void assign(double timestamp, double latitude, double longitude, double accuracy, bool providesAltitude, double altitude, bool providesAltitudeAccuracy, double altitudeAccuracy, bool providesHeading, double heading, bool providesSpeed, double speed); + WEBKIT_EXPORT void assign(const WebGeolocationPosition&); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebGeolocationPosition(WTF::PassRefPtr<WebCore::GeolocationPosition>); + WebGeolocationPosition& operator=(WTF::PassRefPtr<WebCore::GeolocationPosition>); + operator WTF::PassRefPtr<WebCore::GeolocationPosition>() const; +#endif + +private: + WebPrivatePtr<WebCore::GeolocationPosition> m_private; +}; + +} // namespace WebKit + +#endif // WebGeolocationPosition_h diff --git a/Source/WebKit/chromium/public/WebGlyphCache.h b/Source/WebKit/chromium/public/WebGlyphCache.h new file mode 100644 index 000000000..d2b1e1770 --- /dev/null +++ b/Source/WebKit/chromium/public/WebGlyphCache.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebGlyphCache_h +#define WebGlyphCache_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// An interface to query WebKit's glyph cache (which maps unicode characters to +// glyphs in particular fonts). +class WebGlyphCache { +public: + // Returns the number of pages in the glyph cache. + WEBKIT_EXPORT static size_t pageCount(); + +private: + WebGlyphCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebHistoryItem.h b/Source/WebKit/chromium/public/WebHistoryItem.h new file mode 100644 index 000000000..015a79beb --- /dev/null +++ b/Source/WebKit/chromium/public/WebHistoryItem.h @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebHistoryItem_h +#define WebHistoryItem_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class HistoryItem; } + +namespace WebKit { +class WebHTTPBody; +class WebString; +class WebSerializedScriptValue; +struct WebPoint; +template <typename T> class WebVector; + +// Represents a frame-level navigation entry in session history. A +// WebHistoryItem is a node in a tree. +// +// Copying a WebHistoryItem is cheap. +// +class WebHistoryItem { +public: + ~WebHistoryItem() { reset(); } + + WebHistoryItem() { } + WebHistoryItem(const WebHistoryItem& h) { assign(h); } + WebHistoryItem& operator=(const WebHistoryItem& h) + { + assign(h); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebHistoryItem&); + + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebString urlString() const; + WEBKIT_EXPORT void setURLString(const WebString&); + + WEBKIT_EXPORT WebString originalURLString() const; + WEBKIT_EXPORT void setOriginalURLString(const WebString&); + + WEBKIT_EXPORT WebString referrer() const; + WEBKIT_EXPORT void setReferrer(const WebString&); + + WEBKIT_EXPORT WebString target() const; + WEBKIT_EXPORT void setTarget(const WebString&); + + WEBKIT_EXPORT WebString parent() const; + WEBKIT_EXPORT void setParent(const WebString&); + + WEBKIT_EXPORT WebString title() const; + WEBKIT_EXPORT void setTitle(const WebString&); + + WEBKIT_EXPORT WebString alternateTitle() const; + WEBKIT_EXPORT void setAlternateTitle(const WebString&); + + WEBKIT_EXPORT double lastVisitedTime() const; + WEBKIT_EXPORT void setLastVisitedTime(double); + + WEBKIT_EXPORT WebPoint scrollOffset() const; + WEBKIT_EXPORT void setScrollOffset(const WebPoint&); + + WEBKIT_EXPORT float pageScaleFactor() const; + WEBKIT_EXPORT void setPageScaleFactor(float); + + WEBKIT_EXPORT bool isTargetItem() const; + WEBKIT_EXPORT void setIsTargetItem(bool); + + WEBKIT_EXPORT int visitCount() const; + WEBKIT_EXPORT void setVisitCount(int); + + WEBKIT_EXPORT WebVector<WebString> documentState() const; + WEBKIT_EXPORT void setDocumentState(const WebVector<WebString>&); + + WEBKIT_EXPORT long long itemSequenceNumber() const; + WEBKIT_EXPORT void setItemSequenceNumber(long long); + + WEBKIT_EXPORT long long documentSequenceNumber() const; + WEBKIT_EXPORT void setDocumentSequenceNumber(long long); + + WEBKIT_EXPORT WebSerializedScriptValue stateObject() const; + WEBKIT_EXPORT void setStateObject(const WebSerializedScriptValue&); + + WEBKIT_EXPORT WebString httpContentType() const; + WEBKIT_EXPORT void setHTTPContentType(const WebString&); + + WEBKIT_EXPORT WebHTTPBody httpBody() const; + WEBKIT_EXPORT void setHTTPBody(const WebHTTPBody&); + + WEBKIT_EXPORT WebVector<WebHistoryItem> children() const; + WEBKIT_EXPORT void setChildren(const WebVector<WebHistoryItem>&); + WEBKIT_EXPORT void appendToChildren(const WebHistoryItem&); + +#if WEBKIT_IMPLEMENTATION + WebHistoryItem(const WTF::PassRefPtr<WebCore::HistoryItem>&); + WebHistoryItem& operator=(const WTF::PassRefPtr<WebCore::HistoryItem>&); + operator WTF::PassRefPtr<WebCore::HistoryItem>() const; +#endif + +private: + void ensureMutable(); + WebPrivatePtr<WebCore::HistoryItem> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebIDBCallbacks.h b/Source/WebKit/chromium/public/WebIDBCallbacks.h new file mode 100644 index 000000000..31d665b4b --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBCallbacks.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBCallbacks_h +#define WebIDBCallbacks_h + +#include "platform/WebCommon.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebDOMStringList; +class WebIDBCursor; +class WebIDBDatabase; +class WebIDBDatabaseError; +class WebIDBKey; +class WebIDBIndex; +class WebIDBObjectStore; +class WebIDBTransaction; +class WebSerializedScriptValue; + +class WebIDBCallbacks { +public: + virtual ~WebIDBCallbacks() { } + + // For classes that follow the PImpl pattern, pass a const reference. + // For the rest, pass ownership to the callee via a pointer. + virtual void onError(const WebIDBDatabaseError&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebDOMStringList&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBCursor*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBDatabase*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebIDBKey&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(WebIDBTransaction*) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccess(const WebSerializedScriptValue&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccessWithContinuation() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onBlocked() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onSuccessWithPrefetch(const WebVector<WebIDBKey>& keys, const WebVector<WebIDBKey>& primaryKeys, const WebVector<WebSerializedScriptValue>& values) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBCallbacks_h diff --git a/Source/WebKit/chromium/public/WebIDBCursor.h b/Source/WebKit/chromium/public/WebIDBCursor.h new file mode 100644 index 000000000..96b1765d8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBCursor.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBCursor_h +#define WebIDBCursor_h + +#include "WebExceptionCode.h" +#include "WebIDBCallbacks.h" +#include "WebIDBKey.h" +#include "platform/WebCommon.h" +#include "platform/WebSerializedScriptValue.h" +#include "platform/WebString.h" + +namespace WebKit { + +// See comment in WebIDBFactory for a high level overview these classes. +class WebIDBCursor { +public: + virtual ~WebIDBCursor() { } + + virtual unsigned short direction() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual WebIDBKey key() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebIDBKey::createInvalid(); + } + virtual WebIDBKey primaryKey() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebIDBKey::createInvalid(); + } + virtual WebSerializedScriptValue value() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebSerializedScriptValue(); + } + + virtual void update(const WebSerializedScriptValue&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void continueFunction(const WebIDBKey&, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void deleteFunction(WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void prefetchContinue(int numberToFetch, WebIDBCallbacks*, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void prefetchReset(int usedPrefetches, int unusedPrefetches) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void postSuccessHandlerCallback() { } // Only used in frontend. + +protected: + WebIDBCursor() { } +}; + +} // namespace WebKit + +#endif // WebIDBCursor_h diff --git a/Source/WebKit/chromium/public/WebIDBDatabase.h b/Source/WebKit/chromium/public/WebIDBDatabase.h new file mode 100644 index 000000000..ff8e1ca4a --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBDatabase.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBDatabase_h +#define WebIDBDatabase_h + +#include "WebDOMStringList.h" +#include "WebExceptionCode.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebFrame; +class WebIDBCallbacks; +class WebIDBDatabaseCallbacks; +class WebIDBObjectStore; +class WebIDBTransaction; + +// See comment in WebIDBFactory for a high level overview of these classes. +class WebIDBDatabase { +public: + virtual ~WebIDBDatabase() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString version() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList objectStoreNames() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebString& keyPath, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction& transaction, WebExceptionCode& ec) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void setVersion(const WebString& version, WebIDBCallbacks* callbacks, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + // Transfers ownership of the WebIDBTransaction to the caller. + virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode& ec) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void close() { WEBKIT_ASSERT_NOT_REACHED(); } + + virtual void open(WebIDBDatabaseCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + WebIDBDatabase() { } +}; + +} // namespace WebKit + +#endif // WebIDBDatabase_h diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h new file mode 100644 index 000000000..838a71ff9 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBDatabaseCallbacks.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebIDBDatabaseCallbacks_h +#define WebIDBDatabaseCallbacks_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebIDBDatabaseCallbacks { +public: + virtual ~WebIDBDatabaseCallbacks() { } + + virtual void onVersionChange(const WebString& requestedVersion) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseCallbacks_h diff --git a/Source/WebKit/chromium/public/WebIDBDatabaseError.h b/Source/WebKit/chromium/public/WebIDBDatabaseError.h new file mode 100644 index 000000000..2aae4850b --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBDatabaseError.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#ifndef WebIDBDatabaseError_h +#define WebIDBDatabaseError_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" + +namespace WebCore { class IDBDatabaseError; } + +namespace WebKit { + +// See comment in WebIDBFactory for a high level overview these classes. +class WebIDBDatabaseError { +public: + ~WebIDBDatabaseError() { reset(); } + + WebIDBDatabaseError(unsigned short code, const WebString& message) { assign(code, message); } + WebIDBDatabaseError(const WebIDBDatabaseError& error) { assign(error); } + WebIDBDatabaseError& operator=(const WebIDBDatabaseError& error) + { + assign(error); + return *this; + } + + WEBKIT_EXPORT void assign(const WebIDBDatabaseError&); + WEBKIT_EXPORT void reset(); + + WEBKIT_EXPORT unsigned short code() const; + WEBKIT_EXPORT WebString message() const; + +#if WEBKIT_IMPLEMENTATION + WebIDBDatabaseError(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + WebIDBDatabaseError& operator=(const WTF::PassRefPtr<WebCore::IDBDatabaseError>&); + operator WTF::PassRefPtr<WebCore::IDBDatabaseError>() const; +#endif + +private: + WEBKIT_EXPORT void assign(unsigned short code, const WebString& message); + + WebPrivatePtr<WebCore::IDBDatabaseError> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBDatabaseError_h diff --git a/Source/WebKit/chromium/public/WebIDBFactory.h b/Source/WebKit/chromium/public/WebIDBFactory.h new file mode 100644 index 000000000..e956ebded --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBFactory.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2011 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#ifndef WebIDBFactory_h +#define WebIDBFactory_h + +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebSecurityOrigin.h" +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebFrame; +class WebIDBDatabase; +class WebSecurityOrigin; + +// The entry point into the IndexedDatabase API. These classes match their Foo and +// FooSync counterparts in the spec, but operate only in an async manner. +// http://dev.w3.org/2006/webapi/WebSimpleDB/ +class WebIDBFactory { +public: + WEBKIT_EXPORT static WebIDBFactory* create(); + + virtual ~WebIDBFactory() { } + + virtual void getDatabaseNames(WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + + // The WebKit implementation of open ignores the WebFrame* parameter. + virtual void open(const WebString& name, WebIDBCallbacks* callbacks, const WebSecurityOrigin& origin, WebFrame* frame, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } + + virtual void deleteDatabase(const WebString& name, WebIDBCallbacks*, const WebSecurityOrigin&, WebFrame*, const WebString& dataDir) { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBFactory_h diff --git a/Source/WebKit/chromium/public/WebIDBIndex.h b/Source/WebKit/chromium/public/WebIDBIndex.h new file mode 100644 index 000000000..b7f526d76 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBIndex.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBIndex_h +#define WebIDBIndex_h + +#include "WebExceptionCode.h" +#include "WebIDBTransaction.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebIDBCallbacks; +class WebIDBKey; +class WebIDBKeyRange; + +// See comment in WebIDBFactory for a high level overview of these classes. +class WebIDBIndex { +public: + virtual ~WebIDBIndex() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString storeName() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual bool unique() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } + virtual bool multiEntry() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } + + virtual void openObjectCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void openKeyCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void getObject(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void getKey(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + WebIDBIndex() {} +}; + +} // namespace WebKit + +#endif // WebIDBIndex_h diff --git a/Source/WebKit/chromium/public/WebIDBKey.h b/Source/WebKit/chromium/public/WebIDBKey.h new file mode 100644 index 000000000..e47971755 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBKey.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebIDBKey_h +#define WebIDBKey_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebCore { class IDBKey; } + +namespace WebKit { + +class WebIDBKeyPath; +class WebSerializedScriptValue; + +class WebIDBKey { +public: + // Please use one of the factory methods. This is public only to allow WebVector. + WebIDBKey() { } + ~WebIDBKey() { reset(); } + + WEBKIT_EXPORT static WebIDBKey createArray(const WebVector<WebIDBKey>&); + WEBKIT_EXPORT static WebIDBKey createString(const WebString&); + WEBKIT_EXPORT static WebIDBKey createDate(double); + WEBKIT_EXPORT static WebIDBKey createNumber(double); + WEBKIT_EXPORT static WebIDBKey createInvalid(); + WEBKIT_EXPORT static WebIDBKey createFromValueAndKeyPath(const WebSerializedScriptValue&, const WebIDBKeyPath&); + WEBKIT_EXPORT static WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey&, const WebSerializedScriptValue&, const WebIDBKeyPath&); + + WebIDBKey(const WebIDBKey& e) { assign(e); } + WebIDBKey& operator=(const WebIDBKey& e) + { + assign(e); + return *this; + } + + WEBKIT_EXPORT void assign(const WebIDBKey&); + WEBKIT_EXPORT void assignArray(const WebVector<WebIDBKey>&); + WEBKIT_EXPORT void assignString(const WebString&); + WEBKIT_EXPORT void assignDate(double); + WEBKIT_EXPORT void assignNumber(double); + WEBKIT_EXPORT void assignInvalid(); + WEBKIT_EXPORT void reset(); + + enum Type { + InvalidType = 0, + ArrayType, + StringType, + DateType, + NumberType + }; + + WEBKIT_EXPORT Type type() const; + WEBKIT_EXPORT WebVector<WebIDBKey> array() const; // Only valid for ArrayType. + WEBKIT_EXPORT WebString string() const; // Only valid for StringType. + WEBKIT_EXPORT double date() const; // Only valid for DateType. + WEBKIT_EXPORT double number() const; // Only valid for NumberType. + +#if WEBKIT_IMPLEMENTATION + WebIDBKey(const WTF::PassRefPtr<WebCore::IDBKey>&); + WebIDBKey& operator=(const WTF::PassRefPtr<WebCore::IDBKey>&); + operator WTF::PassRefPtr<WebCore::IDBKey>() const; +#endif + +private: + WebPrivatePtr<WebCore::IDBKey> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBKey_h diff --git a/Source/WebKit/chromium/public/WebIDBKeyPath.h b/Source/WebKit/chromium/public/WebIDBKeyPath.h new file mode 100644 index 000000000..4c7259f03 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBKeyPath.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBKeyPath_h +#define WebIDBKeyPath_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivateOwnPtr.h" +#include "platform/WebVector.h" + +namespace WTF { +template<typename T, size_t inlineCapacity> class Vector; +class String; +} + +namespace WebKit { + +class WebString; + +class WebIDBKeyPath { +public: + WEBKIT_EXPORT static WebIDBKeyPath create(const WebString&); + WebIDBKeyPath(const WebIDBKeyPath& keyPath) { assign(keyPath); } + ~WebIDBKeyPath() { reset(); } + + WEBKIT_EXPORT int parseError() const; + WEBKIT_EXPORT void assign(const WebIDBKeyPath&); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + operator const WTF::Vector<WTF::String, 0>& () const; +#endif + +private: + WebIDBKeyPath(); + +#if WEBKIT_IMPLEMENTATION + WebIDBKeyPath(const WTF::Vector<WTF::String, 0>&, int parseError); +#endif + + WebPrivateOwnPtr<WTF::Vector<WTF::String, 0> > m_private; + int m_parseError; +}; + +} // namespace WebKit + +#endif // WebIDBKeyPath_h diff --git a/Source/WebKit/chromium/public/WebIDBKeyRange.h b/Source/WebKit/chromium/public/WebIDBKeyRange.h new file mode 100644 index 000000000..8655adf77 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBKeyRange.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBKeyRange_h +#define WebIDBKeyRange_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class IDBKeyRange; } + +namespace WebKit { + +class WebIDBKey; +class WebString; + +class WebIDBKeyRange { +public: + ~WebIDBKeyRange() { reset(); } + + WebIDBKeyRange(const WebIDBKeyRange& keyRange) { assign(keyRange); } + WebIDBKeyRange(const WebIDBKey& lower, const WebIDBKey& upper, bool lowerOpen, bool upperOpen) { assign(lower, upper, lowerOpen, upperOpen); } + + WEBKIT_EXPORT WebIDBKey lower() const; + WEBKIT_EXPORT WebIDBKey upper() const; + WEBKIT_EXPORT bool lowerOpen() const; + WEBKIT_EXPORT bool upperOpen() const; + + WEBKIT_EXPORT void assign(const WebIDBKeyRange&); + WEBKIT_EXPORT void assign(const WebIDBKey& lower, const WebIDBKey& upper, bool lowerOpen, bool upperOpen); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebIDBKeyRange(const WTF::PassRefPtr<WebCore::IDBKeyRange>&); + WebIDBKeyRange& operator=(const WTF::PassRefPtr<WebCore::IDBKeyRange>&); + operator WTF::PassRefPtr<WebCore::IDBKeyRange>() const; +#endif + +private: + WebPrivatePtr<WebCore::IDBKeyRange> m_private; +}; + +} // namespace WebKit + +#endif // WebIDBKeyRange_h diff --git a/Source/WebKit/chromium/public/WebIDBObjectStore.h b/Source/WebKit/chromium/public/WebIDBObjectStore.h new file mode 100644 index 000000000..6bd51f419 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBObjectStore.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBObjectStore_h +#define WebIDBObjectStore_h + +#include "WebExceptionCode.h" +#include "WebDOMStringList.h" +#include "WebIDBCallbacks.h" +#include "WebIDBTransaction.h" +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebIDBKeyRange; +class WebIDBTransaction; + +// See comment in WebIDBFactory for a high level overview these classes. +class WebIDBObjectStore { +public: + virtual ~WebIDBObjectStore() { } + + virtual WebString name() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebString keyPath() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebString(); + } + virtual WebDOMStringList indexNames() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return WebDOMStringList(); + } + + virtual void get(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + + enum PutMode { + AddOrUpdate, + AddOnly, + CursorUpdate + }; + + virtual void put(const WebSerializedScriptValue&, const WebIDBKey&, PutMode, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void deleteFunction(const WebIDBKey&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual WebIDBIndex* createIndex(const WebString& name, const WebString& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + // Transfers ownership of the WebIDBIndex to the caller. + virtual WebIDBIndex* index(const WebString& name, WebExceptionCode&) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void openCursor(const WebIDBKeyRange&, unsigned short direction, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void count(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + WebIDBObjectStore() {} +}; + +} // namespace WebKit + +#endif // WebIDBObjectStore_h diff --git a/Source/WebKit/chromium/public/WebIDBTransaction.h b/Source/WebKit/chromium/public/WebIDBTransaction.h new file mode 100644 index 000000000..4d4800113 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBTransaction.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBTransaction_h +#define WebIDBTransaction_h + +#include "WebExceptionCode.h" +#include "platform/WebString.h" + +namespace WebCore { class IDBTransactionBackendInterface; } + +namespace WebKit { + +class WebIDBObjectStore; +class WebIDBTransactionCallbacks; + +// See comment in WebIDBFactory for a high level overview of these classes. +class WebIDBTransaction { +public: + virtual ~WebIDBTransaction() { } + + virtual int mode() const + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual WebIDBObjectStore* objectStore(const WebString& name, WebExceptionCode&) + { + WEBKIT_ASSERT_NOT_REACHED(); + return 0; + } + virtual void abort() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void didCompleteTaskEvents() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void setCallbacks(WebIDBTransactionCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // FIXME: this is never called from WebCore. Find a cleaner solution. + virtual WebCore::IDBTransactionBackendInterface* getIDBTransactionBackendInterface() const + { + return 0; + } + + virtual void addPendingEvents(int) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + WebIDBTransaction() {} +}; + +} // namespace WebKit + +#endif // WebIDBTransaction_h diff --git a/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h b/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h new file mode 100644 index 000000000..5ea6cf45a --- /dev/null +++ b/Source/WebKit/chromium/public/WebIDBTransactionCallbacks.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebIDBTransactionCallbacks_h +#define WebIDBTransactionCallbacks_h + +#include "platform/WebCommon.h" + +namespace WebKit { +class WebIDBTransactionCallbacks { +public: + virtual ~WebIDBTransactionCallbacks() { } + + virtual void onAbort() { WEBKIT_ASSERT_NOT_REACHED(); } + virtual void onComplete() { WEBKIT_ASSERT_NOT_REACHED(); } +}; + +} // namespace WebKit + +#endif // WebIDBTransactionCallbacks_h diff --git a/Source/WebKit/chromium/public/WebIconLoadingCompletion.h b/Source/WebKit/chromium/public/WebIconLoadingCompletion.h new file mode 100644 index 000000000..b6229aaf2 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIconLoadingCompletion.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebIconLoadingCompletion_h +#define WebIconLoadingCompletion_h + +namespace WebKit { + +class WebData; +class WebString; + +// Gets called back when WebViewClient finished loading an icon. +class WebIconLoadingCompletion { +public: + // Called with the loaded icon data, which is an image data stream + // WebCore can decode, such as PNG. A null WebData means a failure of + // loading. The callback instance is destroyed when this method is called. + virtual void didLoadIcon(const WebData&) = 0; + +protected: + virtual ~WebIconLoadingCompletion() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebIconURL.h b/Source/WebKit/chromium/public/WebIconURL.h new file mode 100644 index 000000000..aaed866c7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIconURL.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebIconURL_h +#define WebIconURL_h + +#if WEBKIT_IMPLEMENTATION +#include "IconURL.h" +#endif +#include "platform/WebURL.h" + +namespace WebKit { + +class WebIconURL { +public: + enum Type { + TypeInvalid = 0, + TypeFavicon = 1 << 0, + TypeTouch = 1 << 1, + TypeTouchPrecomposed = 1 << 2 + }; + + WebIconURL() + : m_iconType(TypeInvalid) + { + } + + WebIconURL(const WebURL& url, Type type) + : m_iconType(type) + , m_iconURL(url) + { + } + + Type iconType() const + { + return m_iconType; + } + + const WebURL& iconURL() const + { + return m_iconURL; + } + +#if WEBKIT_IMPLEMENTATION + WebIconURL(const WebCore::IconURL& iconURL) + : m_iconType(static_cast<Type>(iconURL.m_iconType)) + , m_iconURL(iconURL.m_iconURL) + { + } +#endif + +private: + Type m_iconType; + WebURL m_iconURL; +}; + +} + +#endif // WebIconURL_h diff --git a/Source/WebKit/chromium/public/WebImageDecoder.h b/Source/WebKit/chromium/public/WebImageDecoder.h new file mode 100644 index 000000000..5840c672b --- /dev/null +++ b/Source/WebKit/chromium/public/WebImageDecoder.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebImageDecoder_h +#define WebImageDecoder_h + +#include "platform/WebCommon.h" +#include "platform/WebImage.h" +#include "platform/WebNonCopyable.h" + +namespace WebCore { class ImageDecoder; } + +namespace WebKit { + +typedef WebCore::ImageDecoder WebImageDecoderPrivate; +class WebData; + +class WebImageDecoder : public WebNonCopyable { +public: + enum Type { + TypeBMP, + TypeICO + }; + + ~WebImageDecoder() { reset(); } + + explicit WebImageDecoder(Type type) { init(type); } + + // Sets data contents for underlying decoder. All the API methods + // require that setData() is called prior to their use. + WEBKIT_EXPORT void setData(const WebData& data, bool allDataReceived); + + // Deletes owned decoder. + WEBKIT_EXPORT void reset(); + + // Returns true if image decoding failed. + WEBKIT_EXPORT bool isFailed() const; + + // Returns true if size information is available for the decoder. + WEBKIT_EXPORT bool isSizeAvailable() const; + + // Returns the size of the image. + WEBKIT_EXPORT WebSize size() const; + + // Gives frame count for the image. For multiple frames, decoder scans the image data for the count. + WEBKIT_EXPORT size_t frameCount() const; + + // Returns if the frame at given index is completely decoded. + WEBKIT_EXPORT bool isFrameCompleteAtIndex(int index) const; + + // Creates and returns WebImage from buffer at the index. + WEBKIT_EXPORT WebImage getFrameAtIndex(int index) const; + +private: + // Creates type-specific decoder. + WEBKIT_EXPORT void init(Type type); + + WebImageDecoderPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebInputElement.h b/Source/WebKit/chromium/public/WebInputElement.h new file mode 100644 index 000000000..3d1ffb6e0 --- /dev/null +++ b/Source/WebKit/chromium/public/WebInputElement.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputElement_h +#define WebInputElement_h + +#include "WebFormControlElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLInputElement; } +#endif + +namespace WebKit { + + // Provides readonly access to some properties of a DOM input element node. + class WebInputElement : public WebFormControlElement { + public: + enum SpeechInputState { + Idle, + Recording, + Recognizing, + }; + + WebInputElement() : WebFormControlElement() { } + WebInputElement(const WebInputElement& element) : WebFormControlElement(element) { } + + WebInputElement& operator=(const WebInputElement& element) + { + WebFormControlElement::assign(element); + return *this; + } + void assign(const WebInputElement& element) { WebFormControlElement::assign(element); } + + // This returns true for all of textfield-looking types such as text, + // password, search, email, url, and number. + WEBKIT_EXPORT bool isTextField() const; + // This returns true only for type=text. + WEBKIT_EXPORT bool isText() const; + WEBKIT_EXPORT bool isPasswordField() const; + WEBKIT_EXPORT bool isImageButton() const; + WEBKIT_EXPORT bool autoComplete() const; + WEBKIT_EXPORT int maxLength() const; + WEBKIT_EXPORT bool isActivatedSubmit() const; + WEBKIT_EXPORT void setActivatedSubmit(bool); + WEBKIT_EXPORT int size() const; + WEBKIT_EXPORT void setValue(const WebString&, bool sendChangeEvent = false); + WEBKIT_EXPORT WebString value() const; + WEBKIT_EXPORT void setSuggestedValue(const WebString&); + WEBKIT_EXPORT WebString suggestedValue() const; + WEBKIT_EXPORT void setPlaceholder(const WebString&); + WEBKIT_EXPORT WebString placeholder() const; + WEBKIT_EXPORT bool isAutofilled() const; + WEBKIT_EXPORT void setAutofilled(bool); + WEBKIT_EXPORT void setSelectionRange(int, int); + WEBKIT_EXPORT int selectionStart() const; + WEBKIT_EXPORT int selectionEnd() const; + WEBKIT_EXPORT bool isValidValue(const WebString&) const; + WEBKIT_EXPORT bool isChecked() const; + + WEBKIT_EXPORT bool isSpeechInputEnabled() const; + WEBKIT_EXPORT SpeechInputState getSpeechInputState() const; + WEBKIT_EXPORT void startSpeechInput(); + WEBKIT_EXPORT void stopSpeechInput(); + + // Exposes the default value of the maxLength attribute. + WEBKIT_EXPORT static int defaultMaxLength(); + +#if WEBKIT_IMPLEMENTATION + WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; +#endif + }; + + WEBKIT_EXPORT WebInputElement* toWebInputElement(WebElement*); + + inline const WebInputElement* toWebInputElement(const WebElement* element) + { + return toWebInputElement(const_cast<WebElement*>(element)); + } + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebInputEvent.h b/Source/WebKit/chromium/public/WebInputEvent.h new file mode 100644 index 000000000..65bc87232 --- /dev/null +++ b/Source/WebKit/chromium/public/WebInputEvent.h @@ -0,0 +1,395 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputEvent_h +#define WebInputEvent_h + +#include "WebTouchPoint.h" +#include "platform/WebCommon.h" + +#include <string.h> + +namespace WebKit { + +// The classes defined in this file are intended to be used with +// WebWidget's handleInputEvent method. These event types are cross- +// platform and correspond closely to WebCore's Platform*Event classes. +// +// WARNING! These classes must remain PODs (plain old data). They are +// intended to be "serializable" by copying their raw bytes, so they must +// not contain any non-bit-copyable member variables! + +// WebInputEvent -------------------------------------------------------------- + +class WebInputEvent { +public: + WebInputEvent(unsigned sizeParam = sizeof(WebInputEvent)) + : size(sizeParam) + , type(Undefined) + , modifiers(0) + , timeStampSeconds(0.0) { } + + // When we use an input method (or an input method editor), we receive + // two events for a keypress. The former event is a keydown, which + // provides a keycode, and the latter is a textinput, which provides + // a character processed by an input method. (The mapping from a + // keycode to a character code is not trivial for non-English + // keyboards.) + // To support input methods, Safari sends keydown events to WebKit for + // filtering. WebKit sends filtered keydown events back to Safari, + // which sends them to input methods. + // Unfortunately, it is hard to apply this design to Chrome because of + // our multiprocess architecture. An input method is running in a + // browser process. On the other hand, WebKit is running in a renderer + // process. So, this design results in increasing IPC messages. + // To support input methods without increasing IPC messages, Chrome + // handles keyboard events in a browser process and send asynchronous + // input events (to be translated to DOM events) to a renderer + // process. + // This design is mostly the same as the one of Windows and Mac Carbon. + // So, for what it's worth, our Linux and Mac front-ends emulate our + // Windows front-end. To emulate our Windows front-end, we can share + // our back-end code among Windows, Linux, and Mac. + // TODO(hbono): Issue 18064: remove the KeyDown type since it isn't + // used in Chrome any longer. + + enum Type { + Undefined = -1, + + // WebMouseEvent + MouseDown, + MouseUp, + MouseMove, + MouseEnter, + MouseLeave, + ContextMenu, + + // WebMouseWheelEvent + MouseWheel, + + // WebKeyboardEvent + RawKeyDown, + KeyDown, + KeyUp, + Char, + + // WebGestureEvent + GestureScrollBegin, + GestureScrollEnd, + GestureScrollUpdate, + GestureFlingStart, + GestureFlingCancel, + GestureTap, + + // WebTouchEvent + TouchStart, + TouchMove, + TouchEnd, + TouchCancel, + }; + + enum Modifiers { + // modifiers for all events: + ShiftKey = 1 << 0, + ControlKey = 1 << 1, + AltKey = 1 << 2, + MetaKey = 1 << 3, + + // modifiers for keyboard events: + IsKeyPad = 1 << 4, + IsAutoRepeat = 1 << 5, + + // modifiers for mouse events: + LeftButtonDown = 1 << 6, + MiddleButtonDown = 1 << 7, + RightButtonDown = 1 << 8, + + // Toggle modifiers for all events. Danger: these are not reflected + // into WebCore, so round-tripping from WebInputEvent to a WebCore + // event and back will not preserve these flags. + CapsLockOn = 1 << 9, + NumLockOn = 1 << 10, + }; + + static const int InputModifiers = ShiftKey | ControlKey | AltKey | MetaKey; + + unsigned size; // The size of this structure, for serialization. + Type type; + int modifiers; + double timeStampSeconds; // Seconds since epoch. + + // Returns true if the WebInputEvent |type| is a mouse event. + static bool isMouseEventType(int type) + { + return type == MouseDown + || type == MouseUp + || type == MouseMove + || type == MouseEnter + || type == MouseLeave + || type == ContextMenu; + } + + // Returns true if the WebInputEvent |type| is a keyboard event. + static bool isKeyboardEventType(int type) + { + return type == RawKeyDown + || type == KeyDown + || type == KeyUp + || type == Char; + } + + // Returns true if the WebInputEvent |type| is a touch event. + static bool isTouchEventType(int type) + { + return type == TouchStart + || type == TouchMove + || type == TouchEnd + || type == TouchCancel; + } + + // Returns true if the WebInputEvent |type| should be handled as user gesture. + static bool isUserGestureEventType(int type) + { + return isKeyboardEventType(type) + || type == MouseDown + || type == MouseUp + || type == TouchStart + || type == TouchEnd; + } + + // Returns true if the WebInputEvent |type| should be handled as scroll gesture. + static bool isScrollGestureEventType(int type) + { + return type == GestureScrollBegin + || type == GestureScrollEnd + || type == GestureScrollUpdate + || type == GestureFlingStart + || type == GestureFlingCancel + || type == GestureTap; // FIXME: Why is GestureTap on this list? + } +}; + +// WebKeyboardEvent ----------------------------------------------------------- + +class WebKeyboardEvent : public WebInputEvent { +public: + // Caps on string lengths so we can make them static arrays and keep + // them PODs. + static const size_t textLengthCap = 4; + + // http://www.w3.org/TR/DOM-Level-3-Events/keyset.html lists the + // identifiers. The longest is 18 characters, so we round up to the + // next multiple of 4. + static const size_t keyIdentifierLengthCap = 20; + + // |windowsKeyCode| is the Windows key code associated with this key + // event. Sometimes it's direct from the event (i.e. on Windows), + // sometimes it's via a mapping function. If you want a list, see + // WebCore/platform/chromium/KeyboardCodes* . + int windowsKeyCode; + + // The actual key code genenerated by the platform. The DOM spec runs + // on Windows-equivalent codes (thus |windowsKeyCode| above) but it + // doesn't hurt to have this one around. + int nativeKeyCode; + + // |text| is the text generated by this keystroke. |unmodifiedText| is + // |text|, but unmodified by an concurrently-held modifiers (except + // shift). This is useful for working out shortcut keys. Linux and + // Windows guarantee one character per event. The Mac does not, but in + // reality that's all it ever gives. We're generous, and cap it a bit + // longer. + WebUChar text[textLengthCap]; + WebUChar unmodifiedText[textLengthCap]; + + // This is a string identifying the key pressed. + char keyIdentifier[keyIdentifierLengthCap]; + + // This identifies whether this event was tagged by the system as being + // a "system key" event (see + // http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for + // details). Other platforms don't have this concept, but it's just + // easier to leave it always false than ifdef. + // int is used instead of bool to ensure the size of this structure is + // strictly aligned to a factor of 4 bytes, otherwise memory check tools + // like valgrind may complain about uninitialized memory usage when + // transfering it over the wire. + int isSystemKey; + + WebKeyboardEvent(unsigned sizeParam = sizeof(WebKeyboardEvent)) + : WebInputEvent(sizeParam) + , windowsKeyCode(0) + , nativeKeyCode(0) + , isSystemKey(false) + { + memset(&text, 0, sizeof(text)); + memset(&unmodifiedText, 0, sizeof(unmodifiedText)); + memset(&keyIdentifier, 0, sizeof(keyIdentifier)); + } + + // Sets keyIdentifier based on the value of windowsKeyCode. This is + // handy for generating synthetic keyboard events. + WEBKIT_EXPORT void setKeyIdentifierFromWindowsKeyCode(); +}; + +// WebMouseEvent -------------------------------------------------------------- + +class WebMouseEvent : public WebInputEvent { +public: + // These values defined for WebCore::MouseButton + enum Button { + ButtonNone = -1, + ButtonLeft, + ButtonMiddle, + ButtonRight + }; + + Button button; + int x; + int y; + int windowX; + int windowY; + int globalX; + int globalY; + int movementX; + int movementY; + int clickCount; + + WebMouseEvent(unsigned sizeParam = sizeof(WebMouseEvent)) + : WebInputEvent(sizeParam) + , button(ButtonNone) + , x(0) + , y(0) + , windowX(0) + , windowY(0) + , globalX(0) + , globalY(0) + , movementX(0) + , movementY(0) + , clickCount(0) + { + } +}; + +// WebMouseWheelEvent --------------------------------------------------------- + +class WebMouseWheelEvent : public WebMouseEvent { +public: + enum Phase { + PhaseNone = 0, + PhaseBegan = 1 << 1, + PhaseStationary = 1 << 2, + PhaseChanged = 1 << 3, + PhaseEnded = 1 << 4, + PhaseCancelled = 1 << 5, + }; + + float deltaX; + float deltaY; + float wheelTicksX; + float wheelTicksY; + + // int is used instead of bool to ensure the size of this structure is + // strictly aligned to a factor of 4 bytes, otherwise memory check tools + // like valgrind may complain about uninitialized memory usage when + // transfering it over the wire. + int scrollByPage; + + bool hasPreciseScrollingDeltas; + Phase phase; + Phase momentumPhase; + + WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent)) + : WebMouseEvent(sizeParam) + , deltaX(0.0f) + , deltaY(0.0f) + , wheelTicksX(0.0f) + , wheelTicksY(0.0f) + , scrollByPage(false) + , hasPreciseScrollingDeltas(false) + , phase(PhaseNone) + , momentumPhase(PhaseNone) + { + } +}; + +// WebGestureEvent -------------------------------------------------------------- + +class WebGestureEvent : public WebInputEvent { +public: + int x; + int y; + int globalX; + int globalY; + float deltaX; + float deltaY; + + WebGestureEvent(unsigned sizeParam = sizeof(WebGestureEvent)) + : WebInputEvent(sizeParam) + , x(0) + , y(0) + , globalX(0) + , globalY(0) + , deltaX(0.0f) + , deltaY(0.0f) + { + } +}; + +// WebTouchEvent -------------------------------------------------------------- + +class WebTouchEvent : public WebInputEvent { +public: + enum { touchesLengthCap = 8 }; + + unsigned touchesLength; + // List of all touches which are currently down. + WebTouchPoint touches[touchesLengthCap]; + + unsigned changedTouchesLength; + // List of all touches whose state has changed since the last WebTouchEvent + WebTouchPoint changedTouches[touchesLengthCap]; + + unsigned targetTouchesLength; + // List of all touches which are currently down and are targeting the event recipient. + WebTouchPoint targetTouches[touchesLengthCap]; + + WebTouchEvent(unsigned sizeParam = sizeof(WebTouchEvent)) + : WebInputEvent(sizeParam) + , touchesLength(0) + , changedTouchesLength(0) + , targetTouchesLength(0) + { + } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebIntent.h b/Source/WebKit/chromium/public/WebIntent.h new file mode 100644 index 000000000..4ce0342b7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebIntent.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebIntent_h +#define WebIntent_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebKit { + +// Holds data passed through a Web Intents invocation call from the Javascript +// Intent object. +// See spec at http://www.chromium.org/developers/design-documents/webintentsapi +class WebIntent { +public: + ~WebIntent() { } + + WEBKIT_EXPORT WebString action() const; + WEBKIT_EXPORT void setAction(const WebString&); + + WEBKIT_EXPORT WebString type() const; + WEBKIT_EXPORT void setType(const WebString&); + + WEBKIT_EXPORT WebString data() const; + WEBKIT_EXPORT void setData(const WebString&); + + WEBKIT_EXPORT int identifier() const; + WEBKIT_EXPORT void setIdentifier(int); + +#if WEBKIT_IMPLEMENTATION + WebIntent(); +#endif + +private: + WebString m_action; + WebString m_type; + WebString m_data; + int m_identifier; +}; + +} // namespace WebKit + +#endif // WebIntent_h diff --git a/Source/WebKit/chromium/public/WebIntentServiceInfo.h b/Source/WebKit/chromium/public/WebIntentServiceInfo.h new file mode 100644 index 000000000..5879be8aa --- /dev/null +++ b/Source/WebKit/chromium/public/WebIntentServiceInfo.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebIntentServiceInfo_h +#define WebIntentServiceInfo_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" + +namespace WebKit { + +// Holds data used to initialize a Web Intents service (handler). +// See spec at http://www.chromium.org/developers/design-documents/webintentsapi +class WebIntentServiceInfo { +public: + WebIntentServiceInfo() { } + ~WebIntentServiceInfo() { } + + // The location of the handler page registered by the service. + WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + // The short name the service will be known by when the user + // initiates an intent. + WEBKIT_EXPORT WebString title() const; + WEBKIT_EXPORT void setTitle(const WebString&); + + // The kind of intent the service will handle. + WEBKIT_EXPORT WebString action() const; + WEBKIT_EXPORT void setAction(const WebString&); + + // The type of payload data which the service will handle. + WEBKIT_EXPORT WebString type() const; + WEBKIT_EXPORT void setType(const WebString&); + + // A hint to the client about whether the service can be run within + // an "inline" context within the calling page, or in a new tab + // context (the default). + WEBKIT_EXPORT WebString disposition() const; + WEBKIT_EXPORT void setDisposition(const WebString&); + +private: + WebString m_action; + WebString m_type; + WebURL m_href; + WebString m_title; + WebString m_disposition; +}; + +} // namespace WebKit + +#endif // WebIntentServiceInfo_h diff --git a/Source/WebKit/chromium/public/WebKit.h b/Source/WebKit/chromium/public/WebKit.h new file mode 100644 index 000000000..a89d4785f --- /dev/null +++ b/Source/WebKit/chromium/public/WebKit.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebKit_h +#define WebKit_h + +#include "platform/WebCommon.h" + +#define HAVE_WEBCOMPOSITOR + +namespace WebKit { + +class WebKitPlatformSupport; + +// Must be called on the thread that will be the main WebKit thread before +// using any other WebKit APIs. The provided WebKitPlatformSupport; must be +// non-null and must remain valid until the current thread calls shutdown. +WEBKIT_EXPORT void initialize(WebKitPlatformSupport*); + +// Must be called on the thread that will be the main WebKit thread before +// using any other WebKit APIs. The provided WebKitPlatformSupport; must be +// non-null and must remain valid until the current thread calls shutdown. +// +// This is a special variant of initialize that does not intitialize V8. +WEBKIT_EXPORT void initializeWithoutV8(WebKitPlatformSupport*); + +// Once shutdown, the WebKitPlatformSupport passed to initialize will no longer +// be accessed. No other WebKit objects should be in use when this function is +// called. Any background threads created by WebKit are promised to be +// terminated by the time this function returns. +WEBKIT_EXPORT void shutdown(); + +// Returns the WebKitPlatformSupport instance passed to initialize. +WEBKIT_EXPORT WebKitPlatformSupport* webKitPlatformSupport(); + +// Alters the rendering of content to conform to a fixed set of rules. +WEBKIT_EXPORT void setLayoutTestMode(bool); +WEBKIT_EXPORT bool layoutTestMode(); + +// Enables the named log channel. See WebCore/platform/Logging.h for details. +WEBKIT_EXPORT void enableLogChannel(const char*); + +// Purge the plugin list cache. If |reloadPages| is true, any pages +// containing plugins will be reloaded after refreshing the plugin list. +WEBKIT_EXPORT void resetPluginCache(bool reloadPages); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebLabelElement.h b/Source/WebKit/chromium/public/WebLabelElement.h new file mode 100644 index 000000000..4a20bac73 --- /dev/null +++ b/Source/WebKit/chromium/public/WebLabelElement.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebLabelElement_h +#define WebLabelElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLLabelElement; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM label element node. +class WebLabelElement : public WebElement { +public: + WebLabelElement() : WebElement() { } + WebLabelElement(const WebLabelElement& element) : WebElement(element) { } + + WebLabelElement& operator=(const WebLabelElement& element) + { + WebElement::assign(element); + return *this; + } + + void assign(const WebLabelElement& element) { WebElement::assign(element); } + + WEBKIT_EXPORT WebElement correspondingControl(); + +#if WEBKIT_IMPLEMENTATION + WebLabelElement(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + WebLabelElement& operator=(const WTF::PassRefPtr<WebCore::HTMLLabelElement>&); + operator WTF::PassRefPtr<WebCore::HTMLLabelElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMediaElement.h b/Source/WebKit/chromium/public/WebMediaElement.h new file mode 100644 index 000000000..f828ea1f6 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMediaElement.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaElement_h +#define WebMediaElement_h + +#include "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLMediaElement; } +#endif + +namespace WebKit { + +class WebMediaPlayer; + +class WebMediaElement : public WebElement { +public: + WEBKIT_EXPORT WebMediaPlayer* player() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaElement(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + WebMediaElement& operator=(const WTF::PassRefPtr<WebCore::HTMLMediaElement>&); + operator WTF::PassRefPtr<WebCore::HTMLMediaElement>() const; +#endif +}; +} // namespace WebKit + +#endif // WebMediaElement_h diff --git a/Source/WebKit/chromium/public/WebMediaPlayer.h b/Source/WebKit/chromium/public/WebMediaPlayer.h new file mode 100644 index 000000000..9aaf1a3d0 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMediaPlayer.h @@ -0,0 +1,173 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaPlayer_h +#define WebMediaPlayer_h + +#include "WebVideoFrame.h" +#include "platform/WebCanvas.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebAudioSourceProvider; +class WebAudioSourceProviderClient; +class WebMediaPlayerClient; +class WebURL; +struct WebRect; +struct WebSize; + +struct WebTimeRange { + WebTimeRange() : start(0), end(0) {} + WebTimeRange(float s, float e) : start(s), end(e) {} + + float start; + float end; +}; + +typedef WebVector<WebTimeRange> WebTimeRanges; + +class WebMediaPlayer { +public: + enum NetworkState { + Empty, + Idle, + Loading, + Loaded, + FormatError, + NetworkError, + DecodeError, + }; + + enum ReadyState { + HaveNothing, + HaveMetadata, + HaveCurrentData, + HaveFutureData, + HaveEnoughData, + }; + + enum MovieLoadType { + Unknown, + Download, + StoredStream, + LiveStream, + }; + + enum Preload { + None, + MetaData, + Auto, + }; + + enum EndOfStreamStatus { + EosNoError, + EosNetworkError, + EosDecodeError, + }; + + virtual ~WebMediaPlayer() {} + + virtual void load(const WebURL&) = 0; + virtual void cancelLoad() = 0; + + // Playback controls. + virtual void play() = 0; + virtual void pause() = 0; + virtual bool supportsFullscreen() const = 0; + virtual bool supportsSave() const = 0; + virtual void seek(float seconds) = 0; + virtual void setEndTime(float seconds) = 0; + virtual void setRate(float) = 0; + virtual void setVolume(float) = 0; + virtual void setVisible(bool) = 0; + virtual void setPreload(Preload) { }; + virtual bool totalBytesKnown() = 0; + virtual const WebTimeRanges& buffered() = 0; + virtual float maxTimeSeekable() const = 0; + + virtual void setSize(const WebSize&) = 0; + + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // True if the loaded media has a playable video/audio track. + virtual bool hasVideo() const = 0; + virtual bool hasAudio() const = 0; + + // Dimension of the video. + virtual WebSize naturalSize() const = 0; + + // Getters of playback state. + virtual bool paused() const = 0; + virtual bool seeking() const = 0; + virtual float duration() const = 0; + virtual float currentTime() const = 0; + + // Get rate of loading the resource. + virtual int dataRate() const = 0; + + // Internal states of loading and network. + virtual NetworkState networkState() const = 0; + virtual ReadyState readyState() const = 0; + + virtual unsigned long long bytesLoaded() const = 0; + virtual unsigned long long totalBytes() const = 0; + + virtual bool hasSingleSecurityOrigin() const = 0; + virtual MovieLoadType movieLoadType() const = 0; + + virtual float mediaTimeForTimeValue(float timeValue) const = 0; + + virtual unsigned decodedFrameCount() const = 0; + virtual unsigned droppedFrameCount() const = 0; + virtual unsigned audioDecodedByteCount() const = 0; + virtual unsigned videoDecodedByteCount() const = 0; + + // This function returns a pointer to a WebVideoFrame, which is + // a WebKit wrapper for a video frame in chromium. This places a lock + // on the frame in chromium, and calls to this method should always be + // followed with a call to putCurrentFrame(). The ownership of this object + // is not transferred to the caller, and the caller should not free the + // returned object. + virtual WebVideoFrame* getCurrentFrame() { return 0; } + // This function releases the lock on the current video frame in Chromium. + // It should always be called after getCurrentFrame(). Frame passed to this + // method should no longer be referenced after the call is made. + virtual void putCurrentFrame(WebVideoFrame*) { } + + virtual WebAudioSourceProvider* audioSourceProvider() { return 0; } + + virtual bool sourceAppend(const unsigned char* data, unsigned length) { return false; } + virtual void sourceEndOfStream(EndOfStreamStatus) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMediaPlayerAction.h b/Source/WebKit/chromium/public/WebMediaPlayerAction.h new file mode 100644 index 000000000..192704f65 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMediaPlayerAction.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaPlayerAction_h +#define WebMediaPlayerAction_h + +namespace WebKit { + +struct WebMediaPlayerAction { + enum Type { + Unknown, + Play, + Mute, + Loop, + Controls + }; + + Type type; + bool enable; + + WebMediaPlayerAction() + : type(Unknown), enable(false) { } + WebMediaPlayerAction(Type type, bool enable) + : type(type), enable(enable) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMediaPlayerClient.h b/Source/WebKit/chromium/public/WebMediaPlayerClient.h new file mode 100644 index 000000000..19ea242ec --- /dev/null +++ b/Source/WebKit/chromium/public/WebMediaPlayerClient.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaPlayerClient_h +#define WebMediaPlayerClient_h + +#include "WebMediaPlayer.h" + +namespace WebKit { + +class WebRequest; +class WebURL; + +class WebMediaPlayerClient { +public: + virtual void networkStateChanged() = 0; + virtual void readyStateChanged() = 0; + virtual void volumeChanged(float) = 0; + virtual void muteChanged(bool) = 0; + virtual void timeChanged() = 0; + virtual void repaint() = 0; + virtual void durationChanged() = 0; + virtual void rateChanged() = 0; + virtual void sizeChanged() = 0; + virtual void setOpaque(bool) = 0; + virtual void sawUnsupportedTracks() = 0; + virtual float volume() const = 0; + virtual void playbackStateChanged() = 0; + virtual WebMediaPlayer::Preload preload() const = 0; + virtual void sourceOpened() = 0; + virtual WebKit::WebURL sourceURL() const = 0; + virtual void disableAcceleratedCompositing() = 0; +protected: + ~WebMediaPlayerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMediaStreamRegistry.h b/Source/WebKit/chromium/public/WebMediaStreamRegistry.h new file mode 100644 index 000000000..48a257674 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMediaStreamRegistry.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaStreamRegistry_h +#define WebMediaStreamRegistry_h + +#include "platform/WebString.h" + +namespace WebKit { + +class WebMediaStreamDescriptor; +class WebURL; + +class WebMediaStreamRegistry { +public: + WEBKIT_EXPORT static WebMediaStreamDescriptor lookupMediaStreamDescriptor(const WebURL&); +}; + +} // namespace WebKit + +#endif // WebMediaStreamRegistry_h diff --git a/Source/WebKit/chromium/public/WebMenuItemInfo.h b/Source/WebKit/chromium/public/WebMenuItemInfo.h new file mode 100644 index 000000000..ae284e7b3 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMenuItemInfo.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMenuItemInfo_h +#define WebMenuItemInfo_h + +#include "WebTextDirection.h" +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { + +struct WebMenuItemInfo { + enum Type { + Option, + CheckableOption, + Group, + Separator, + }; + + WebMenuItemInfo() + : type(Option) + , action(0) + , textDirection(WebTextDirectionDefault) + , hasTextDirectionOverride(false) + , enabled(false) + , checked(false) + { + } + + WebString label; + WebString toolTip; + Type type; + unsigned action; + WebTextDirection textDirection; + bool hasTextDirectionOverride; + bool enabled; + bool checked; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMessagePortChannel.h b/Source/WebKit/chromium/public/WebMessagePortChannel.h new file mode 100644 index 000000000..cd7cfd438 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMessagePortChannel.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMessagePortChannel_h +#define WebMessagePortChannel_h + +#include "platform/WebCommon.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebMessagePortChannelClient; +class WebString; + +typedef WebVector<class WebMessagePortChannel*> WebMessagePortChannelArray; + +// Provides an interface to a Message Port Channel implementation. The object owns itself and +// is signalled that its not needed anymore with the destroy() call. +class WebMessagePortChannel { +public: + virtual void setClient(WebMessagePortChannelClient*) = 0; + virtual void destroy() = 0; + // WebKit versions of WebCore::MessagePortChannel. + virtual void entangle(WebMessagePortChannel*) = 0; + // Callee receives ownership of the passed vector. + virtual void postMessage(const WebString&, WebMessagePortChannelArray*) = 0; + virtual bool tryGetMessage(WebString*, WebMessagePortChannelArray&) = 0; + +protected: + ~WebMessagePortChannel() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebMessagePortChannelClient.h b/Source/WebKit/chromium/public/WebMessagePortChannelClient.h new file mode 100644 index 000000000..0b85bb344 --- /dev/null +++ b/Source/WebKit/chromium/public/WebMessagePortChannelClient.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMessagePortChannelClient_h +#define WebMessagePortChannelClient_h + +namespace WebKit { + +// Provides an interface for users of WebMessagePortChannel to be notified +// when messages are available. +class WebMessagePortChannelClient { +public: + // Alerts that new messages have arrived, which are retrieved by calling + // WebMessagePortChannel::tryGetMessage. Note that this may be called + // on any thread. + virtual void messageAvailable() = 0; + +protected: + ~WebMessagePortChannelClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNamedNodeMap.h b/Source/WebKit/chromium/public/WebNamedNodeMap.h new file mode 100644 index 000000000..796c8d164 --- /dev/null +++ b/Source/WebKit/chromium/public/WebNamedNodeMap.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNamedNodeMap_h +#define WebNamedNodeMap_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class NamedNodeMap; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebAttribute; + +// Provides readonly access to some properties of a DOM attribute map. +class WebNamedNodeMap { +public: + ~WebNamedNodeMap() { reset(); } + + WebNamedNodeMap() { } + WebNamedNodeMap(const WebNamedNodeMap& n) { assign(n); } + WebNamedNodeMap& operator=(const WebNamedNodeMap& n) + { + assign(n); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebNamedNodeMap&); + + WEBKIT_EXPORT unsigned length() const; + WEBKIT_EXPORT WebAttribute attributeItem(unsigned) const; + +#if WEBKIT_IMPLEMENTATION + WebNamedNodeMap(const WTF::PassRefPtr<WebCore::NamedNodeMap>&); +#endif + +private: + WebPrivatePtr<WebCore::NamedNodeMap> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNavigationPolicy.h b/Source/WebKit/chromium/public/WebNavigationPolicy.h new file mode 100644 index 000000000..54bee9dc5 --- /dev/null +++ b/Source/WebKit/chromium/public/WebNavigationPolicy.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNavigationPolicy_h +#define WebNavigationPolicy_h + +namespace WebKit { + +enum WebNavigationPolicy { + WebNavigationPolicyIgnore, + WebNavigationPolicyDownload, + WebNavigationPolicyCurrentTab, + WebNavigationPolicyNewBackgroundTab, + WebNavigationPolicyNewForegroundTab, + WebNavigationPolicyNewWindow, + WebNavigationPolicyNewPopup, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNavigationType.h b/Source/WebKit/chromium/public/WebNavigationType.h new file mode 100644 index 000000000..8ca8dc6b4 --- /dev/null +++ b/Source/WebKit/chromium/public/WebNavigationType.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNavigationType_h +#define WebNavigationType_h + +namespace WebKit { + +enum WebNavigationType { + WebNavigationTypeLinkClicked, + WebNavigationTypeFormSubmitted, + WebNavigationTypeBackForward, + WebNavigationTypeReload, + WebNavigationTypeFormResubmitted, + WebNavigationTypeOther +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNetworkStateNotifier.h b/Source/WebKit/chromium/public/WebNetworkStateNotifier.h new file mode 100644 index 000000000..94fff1c2a --- /dev/null +++ b/Source/WebKit/chromium/public/WebNetworkStateNotifier.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNetworkStateNotifier_h +#define WebNetworkStateNotifier_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebNetworkStateNotifier { +public: + WEBKIT_EXPORT static void setOnLine(bool); + +private: + WebNetworkStateNotifier(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNode.h b/Source/WebKit/chromium/public/WebNode.h new file mode 100644 index 000000000..38be3b66f --- /dev/null +++ b/Source/WebKit/chromium/public/WebNode.h @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNode_h +#define WebNode_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" + +namespace WebCore { class Node; } + +namespace WebKit { +class WebDOMEvent; +class WebDOMEventListener; +class WebDOMEventListenerPrivate; +class WebDocument; +class WebFrame; +class WebNodeList; + +// Provides access to some properties of a DOM node. +class WebNode { +public: + virtual ~WebNode() { reset(); } + + WebNode() { } + WebNode(const WebNode& n) { assign(n); } + WebNode& operator=(const WebNode& n) + { + assign(n); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebNode&); + + WEBKIT_EXPORT bool equals(const WebNode&) const; + // Required for using WebNodes in std maps. Note the order used is + // arbitrary and should not be expected to have any specific meaning. + WEBKIT_EXPORT bool lessThan(const WebNode&) const; + + bool isNull() const { return m_private.isNull(); } + + enum NodeType { + ElementNode = 1, + AttributeNode, + TextNode, + CDataSectionNode, + EntityReferenceNode, + EntityNode, + ProcessingInstructionsNode, + CommentNode, + DocumentNode, + DocumentTypeNode, + DocumentFragmentNode, + NotationNode, + XPathNamespaceNode, + ShadowRootNode + }; + + WEBKIT_EXPORT NodeType nodeType() const; + WEBKIT_EXPORT WebNode parentNode() const; + WEBKIT_EXPORT WebString nodeName() const; + WEBKIT_EXPORT WebString nodeValue() const; + WEBKIT_EXPORT bool setNodeValue(const WebString&); + WEBKIT_EXPORT WebDocument document() const; + WEBKIT_EXPORT WebNode firstChild() const; + WEBKIT_EXPORT WebNode lastChild() const; + WEBKIT_EXPORT WebNode previousSibling() const; + WEBKIT_EXPORT WebNode nextSibling() const; + WEBKIT_EXPORT bool hasChildNodes() const; + WEBKIT_EXPORT WebNodeList childNodes(); + WEBKIT_EXPORT WebString createMarkup() const; + WEBKIT_EXPORT bool isLink() const; + WEBKIT_EXPORT bool isTextNode() const; + WEBKIT_EXPORT bool isFocusable() const; + WEBKIT_EXPORT bool isContentEditable() const; + WEBKIT_EXPORT bool isElementNode() const; + WEBKIT_EXPORT bool hasEventListeners(const WebString& eventType) const; + WEBKIT_EXPORT void addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture); + WEBKIT_EXPORT void removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture); + WEBKIT_EXPORT bool dispatchEvent(const WebDOMEvent&); + WEBKIT_EXPORT void simulateClick(); + WEBKIT_EXPORT WebNodeList getElementsByTagName(const WebString&) const; + + // Returns true if the node has a non-empty bounding box in layout. + // This does not 100% guarantee the user can see it, but is pretty close. + // Note: This method only works properly after layout has occurred. + WEBKIT_EXPORT bool hasNonEmptyBoundingBox() const; + + template<typename T> T to() + { + T res; + res.WebNode::assign(*this); + return res; + } + + template<typename T> const T toConst() const + { + T res; + res.WebNode::assign(*this); + return res; + } + +#if WEBKIT_IMPLEMENTATION + WebNode(const WTF::PassRefPtr<WebCore::Node>&); + WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); + operator WTF::PassRefPtr<WebCore::Node>() const; +#endif + +#if WEBKIT_IMPLEMENTATION + template<typename T> T* unwrap() + { + return static_cast<T*>(m_private.get()); + } + + template<typename T> const T* constUnwrap() const + { + return static_cast<const T*>(m_private.get()); + } +#endif + +protected: + WebPrivatePtr<WebCore::Node> m_private; +}; + +inline bool operator==(const WebNode& a, const WebNode& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebNode& a, const WebNode& b) +{ + return !(a == b); +} + +inline bool operator<(const WebNode& a, const WebNode& b) +{ + return a.lessThan(b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNodeCollection.h b/Source/WebKit/chromium/public/WebNodeCollection.h new file mode 100644 index 000000000..9707e17fb --- /dev/null +++ b/Source/WebKit/chromium/public/WebNodeCollection.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNodeCollection_h +#define WebNodeCollection_h + +#include "platform/WebCommon.h" + +namespace WebCore { class HTMLCollection; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebNode; + +// Provides readonly access to some properties of a DOM node. +class WebNodeCollection { +public: + ~WebNodeCollection() { reset(); } + + WebNodeCollection() : m_private(0) { } + WebNodeCollection(const WebNodeCollection& n) : m_private(0) { assign(n); } + WebNodeCollection& operator=(const WebNodeCollection& n) + { + assign(n); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebNodeCollection&); + + WEBKIT_EXPORT unsigned length() const; + WEBKIT_EXPORT WebNode nextItem() const; + WEBKIT_EXPORT WebNode firstItem() const; + +#if WEBKIT_IMPLEMENTATION + WebNodeCollection(const WTF::PassRefPtr<WebCore::HTMLCollection>&); +#endif + +private: + void assign(WebCore::HTMLCollection*); + WebCore::HTMLCollection* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNodeList.h b/Source/WebKit/chromium/public/WebNodeList.h new file mode 100644 index 000000000..ec84aebd8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebNodeList.h @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNodeList_h +#define WebNodeList_h + +#include "platform/WebCommon.h" + +namespace WebCore { class NodeList; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebNode; + +// Provides readonly access to some properties of a DOM node. +class WebNodeList { +public: + ~WebNodeList() { reset(); } + + WebNodeList() : m_private(0) { } + WebNodeList(const WebNodeList& n) : m_private(0) { assign(n); } + WebNodeList& operator=(const WebNodeList& n) + { + assign(n); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebNodeList&); + + WEBKIT_EXPORT unsigned length() const; + WEBKIT_EXPORT WebNode item(size_t) const; + +#if WEBKIT_IMPLEMENTATION + WebNodeList(const WTF::PassRefPtr<WebCore::NodeList>&); +#endif + +private: + void assign(WebCore::NodeList*); + WebCore::NodeList* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNotification.h b/Source/WebKit/chromium/public/WebNotification.h new file mode 100644 index 000000000..1309efcac --- /dev/null +++ b/Source/WebKit/chromium/public/WebNotification.h @@ -0,0 +1,132 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNotification_h +#define WebNotification_h + +#include "WebTextDirection.h" +#include "platform/WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Notification; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WTF { +class AtomicString; +} + +namespace WebKit { + +class WebNotificationPrivate; +class WebURL; +class WebString; + +// Represents access to a desktop notification. +class WebNotification { +public: + WebNotification() : m_private(0) { } + WebNotification(const WebNotification& other) : m_private(0) { assign(other); } + + ~WebNotification() { reset(); } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebNotification&); + + WebNotification& operator=(const WebNotification& other) + { + assign(other); + return *this; + } + + // Operators required to put WebNotification in an ordered map. + bool equals(const WebNotification& other) const { return m_private == other.m_private; } + WEBKIT_EXPORT bool lessThan(const WebNotification& other) const; + + // Is the notification HTML vs. icon-title-text? + WEBKIT_EXPORT bool isHTML() const; + + // If HTML, the URL which contains the contents of the notification. + WEBKIT_EXPORT WebURL url() const; + + WEBKIT_EXPORT WebURL iconURL() const; + WEBKIT_EXPORT WebString title() const; + WEBKIT_EXPORT WebString body() const; + WEBKIT_EXPORT WebTextDirection direction() const; + + WEBKIT_EXPORT WebString replaceId() const; + + // Called if the presenter goes out of scope before the notification does. + WEBKIT_EXPORT void detachPresenter(); + + // Called to indicate the notification has been displayed. + WEBKIT_EXPORT void dispatchDisplayEvent(); + + // Called to indicate an error has occurred with this notification. + WEBKIT_EXPORT void dispatchErrorEvent(const WebString& errorMessage); + + // Called to indicate the notification has been closed. If it was + // closed by the user (as opposed to automatically by the system), + // the byUser parameter will be true. + WEBKIT_EXPORT void dispatchCloseEvent(bool byUser); + + // Called to indicate the notification was clicked on. + WEBKIT_EXPORT void dispatchClickEvent(); + +#if WEBKIT_IMPLEMENTATION + WebNotification(const WTF::PassRefPtr<WebCore::Notification>&); + WebNotification& operator=(const WTF::PassRefPtr<WebCore::Notification>&); + operator WTF::PassRefPtr<WebCore::Notification>() const; +#endif + +private: + void assign(WebNotificationPrivate*); + void dispatchEvent(const WTF::AtomicString& type); + WebNotificationPrivate* m_private; +}; + +inline bool operator==(const WebNotification& a, const WebNotification& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebNotification& a, const WebNotification& b) +{ + return !a.equals(b); +} + +inline bool operator<(const WebNotification& a, const WebNotification& b) +{ + return a.lessThan(b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNotificationPermissionCallback.h b/Source/WebKit/chromium/public/WebNotificationPermissionCallback.h new file mode 100644 index 000000000..07e85eede --- /dev/null +++ b/Source/WebKit/chromium/public/WebNotificationPermissionCallback.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNotificationPermissionCallback_h +#define WebNotificationPermissionCallback_h + +namespace WebKit { + +// Callback object used with WebNotificationPresenter. +class WebNotificationPermissionCallback { +public: + // Method to be invoked when the async permission request involving + // this object has been completed. + virtual void permissionRequestComplete() = 0; + +protected: + // This object is to be destroyed after the callback is invoked; + // it should not be directly destroyed. + ~WebNotificationPermissionCallback() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebNotificationPresenter.h b/Source/WebKit/chromium/public/WebNotificationPresenter.h new file mode 100644 index 000000000..ff2649fac --- /dev/null +++ b/Source/WebKit/chromium/public/WebNotificationPresenter.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNotificationPresenter_h +#define WebNotificationPresenter_h + +#include "WebNotificationPermissionCallback.h" +#include "WebSecurityOrigin.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebDocument; +class WebNotification; + +// Provides the services to show desktop notifications to the user. +class WebNotificationPresenter { +public: + enum Permission { + PermissionAllowed, // User has allowed permission to the origin. + PermissionNotAllowed, // User has not taken an action on the origin (defaults to not allowed). + PermissionDenied // User has explicitly denied permission from the origin. + }; + + // Shows a notification. + virtual bool show(const WebNotification&) = 0; + + // Cancels a notification previously shown, and removes it if being shown. + virtual void cancel(const WebNotification&) = 0; + + // Indiciates that the notification object subscribed to events for a previously shown notification is + // being destroyed. Does _not_ remove the notification if being shown, but detaches it from receiving events. + virtual void objectDestroyed(const WebNotification&) = 0; + + // Checks the permission level for the given origin. + virtual Permission checkPermission(const WebSecurityOrigin&) = 0; + + // Requests permission for a given origin. This operation is asynchronous and the callback provided + // will be invoked when the permission decision is made. Callback pointer must remain + // valid until called. + virtual void requestPermission(const WebSecurityOrigin&, WebNotificationPermissionCallback*) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebOptionElement.h b/Source/WebKit/chromium/public/WebOptionElement.h new file mode 100644 index 000000000..3d9390b71 --- /dev/null +++ b/Source/WebKit/chromium/public/WebOptionElement.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebOptionElement_h +#define WebOptionElement_h + +#include "WebFormControlElement.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLOptionElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM option element node. +class WebOptionElement : public WebFormControlElement { +public: + WebOptionElement() : WebFormControlElement() { } + WebOptionElement(const WebOptionElement& element) : WebFormControlElement(element) { } + + WebOptionElement& operator=(const WebOptionElement& element) + { + WebFormControlElement::assign(element); + return *this; + } + void assign(const WebOptionElement& element) { WebFormControlElement::assign(element); } + + WEBKIT_EXPORT void setValue(const WebString&); + WEBKIT_EXPORT WebString value() const; + + WEBKIT_EXPORT int index() const; + WEBKIT_EXPORT WebString text() const; + WEBKIT_EXPORT bool defaultSelected() const; + WEBKIT_EXPORT void setDefaultSelected(bool); + WEBKIT_EXPORT WebString label() const; + WEBKIT_EXPORT bool isEnabled() const; + +#if WEBKIT_IMPLEMENTATION + WebOptionElement(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + WebOptionElement& operator=(const WTF::PassRefPtr<WebCore::HTMLOptionElement>&); + operator WTF::PassRefPtr<WebCore::HTMLOptionElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPageOverlay.h b/Source/WebKit/chromium/public/WebPageOverlay.h new file mode 100644 index 000000000..6d2c8e37a --- /dev/null +++ b/Source/WebKit/chromium/public/WebPageOverlay.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google 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 GOOGLE 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 GOOGLE 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. + */ + +#ifndef WebPageOverlay_h +#define WebPageOverlay_h + +#include "platform/WebCanvas.h" +#include "platform/WebRect.h" + +namespace WebKit { + +class WebPageOverlay { +public: + // Paints page overlay contents. + virtual void paintPageOverlay(WebCanvas*) = 0; + +protected: + virtual ~WebPageOverlay() { } +}; + +} // namespace WebKit + +#endif // WebPageOverlay_h diff --git a/Source/WebKit/chromium/public/WebPageSerializer.h b/Source/WebKit/chromium/public/WebPageSerializer.h new file mode 100644 index 000000000..89726aad5 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPageSerializer.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPageSerializer_h +#define WebPageSerializer_h + +#include "platform/WebCString.h" +#include "platform/WebCommon.h" +#include "platform/WebURL.h" + +namespace WebKit { +class WebFrame; +class WebPageSerializerClient; +class WebString; +class WebView; +template <typename T> class WebVector; + +// Get html data by serializing all frames of current page with lists +// which contain all resource links that have local copy. +class WebPageSerializer { +public: + struct Resource { + WebURL url; + WebCString mimeType; + WebCString data; + }; + + // Serializes all the frames from the WebView, retrieves the page's + // resources (such as images and CSS) and adds them to the passed vector. + // The first resource in that vector is the top frame contents. + // Note that this also strips-out any script tag or link to JavaScript. + WEBKIT_EXPORT static void serialize(WebView*, WebVector<Resource>*); + + // Serializes the WebView contents to a MHTML representation. + WEBKIT_EXPORT static WebCString serializeToMHTML(WebView*); + + // Similar to serializeToMHTML but uses binary encoding for the MHTML parts. + // This results in a smaller MHTML file but it might not be supported by other browsers. + WEBKIT_EXPORT static WebCString serializeToMHTMLUsingBinaryEncoding(WebView*); + + // IMPORTANT: + // The API below is an older implementation of a pageserialization that + // will be removed soon. + + + // This function will find out all frames and serialize them to HTML data. + // We have a data buffer to temporary saving generated html data. We will + // sequentially call WebPageSeriazlierClient once the data buffer is full. + // + // Return false means no available frame has been serialized, otherwise + // return true. + // + // The parameter frame specifies which frame need to be serialized. + // The parameter recursive specifies whether we need to + // serialize all sub frames of the specified frame or not. + // The parameter client specifies the pointer of interface + // WebPageSerializerClient providing a sink interface to receive the + // individual chunks of data to be saved. + // The parameter links contain original URLs of all saved links. + // The parameter localPaths contain corresponding local file paths of all + // saved links, which matched with vector:links one by one. + // The parameter localDirectoryName is relative path of directory which + // contain all saved auxiliary files included all sub frames and resources. + WEBKIT_EXPORT static bool serialize(WebFrame*, + bool recursive, + WebPageSerializerClient*, + const WebVector<WebURL>& links, + const WebVector<WebString>& localPaths, + const WebString& localDirectoryName); + + // Retrieve all the resource for the passed view, including the main frame + // and sub-frames. Returns true if all resources were retrieved + // successfully. + WEBKIT_EXPORT static bool retrieveAllResources(WebView*, + const WebVector<WebCString>& supportedSchemes, + WebVector<WebURL>* resources, + WebVector<WebURL>* frames); + + // FIXME: The following are here for unit testing purposes. Consider + // changing the unit tests instead. + + // Generate the META for charset declaration. + WEBKIT_EXPORT static WebString generateMetaCharsetDeclaration(const WebString& charset); + // Generate the MOTW declaration. + WEBKIT_EXPORT static WebString generateMarkOfTheWebDeclaration(const WebURL&); + // Generate the default base tag declaration. + WEBKIT_EXPORT static WebString generateBaseTagDeclaration(const WebString& baseTarget); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPageSerializerClient.h b/Source/WebKit/chromium/public/WebPageSerializerClient.h new file mode 100644 index 000000000..c30ddbcbd --- /dev/null +++ b/Source/WebKit/chromium/public/WebPageSerializerClient.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPageSerializerClient_h +#define WebPageSerializerClient_h + +namespace WebKit { +class WebCString; +class WebURL; + +// This class is used for providing sink interface that can be used to receive +// the individual chunks of data to be saved. +class WebPageSerializerClient { +public: + // This enum indicates This sink interface can receive the individual chunks + // of serialized data to be saved, so we use values of following enum + // definition to indicate the serialization status of serializing all html + // content. If current frame is not complete serialized, call + // didSerializeDataForFrame with URL of current frame, data, data length and + // flag CurrentFrameIsNotFinished. + // If current frame is complete serialized, call didSerializeDataForFrame + // with URL of current frame, data, data length and flag + // CurrentFrameIsFinished. + // If all frames of page are complete serialized, call + // didSerializeDataForFrame with empty URL, empty data, 0 and flag + // AllFramesAreFinished. + enum PageSerializationStatus { + CurrentFrameIsNotFinished, + CurrentFrameIsFinished, + AllFramesAreFinished, + }; + + // Receive the individual chunks of serialized and encoded data to be saved. + // The parameter frameURL specifies what frame the data belongs. The + // parameter data contains the available data for saving. The parameter + // status indicates the status of data serialization. + virtual void didSerializeDataForFrame(const WebURL& frameURL, + const WebCString& data, + PageSerializationStatus status) = 0; + WebPageSerializerClient() { } + +protected: + virtual ~WebPageSerializerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPageVisibilityState.h b/Source/WebKit/chromium/public/WebPageVisibilityState.h new file mode 100644 index 000000000..be7705c0d --- /dev/null +++ b/Source/WebKit/chromium/public/WebPageVisibilityState.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPageVisibilityState_h +#define WebPageVisibilityState_h + +namespace WebKit { + +// The following enum should be consistent with the PageVisibilityState enum +// defined in WebCore. +enum WebPageVisibilityState { + WebPageVisibilityStateVisible, + WebPageVisibilityStateHidden, + WebPageVisibilityStatePrerender +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPasswordFormData.h b/Source/WebKit/chromium/public/WebPasswordFormData.h new file mode 100644 index 000000000..c1a106509 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPasswordFormData.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPasswordFormData_h +#define WebPasswordFormData_h + +#include "WebFormElement.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" + +namespace WebKit { + +struct WebPasswordFormData { + // If the provided form is suitable for password completion, isValid() will + // return true; + WEBKIT_EXPORT WebPasswordFormData(const WebFormElement&); + + // If creation failed, return false. + bool isValid() const { return action.isValid(); } + + // The action target of the form. This is the primary data used by the + // PasswordManager for form autofill; that is, the action of the saved + // credentials must match the action of the form on the page to be autofilled. + // If this is empty / not available, it will result in a "restricted" + // IE-like autofill policy, where we wait for the user to type in his + // username before autofilling the password. In these cases, after successful + // login the action URL will automatically be assigned by the + // PasswordManager. + // + // When parsing an HTML form, this must always be set. + WebURL action; + + // The "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, and + // contains the HTTP realm for dialog-based forms). + // The signon_realm is effectively the primary key used for retrieving + // data from the database, so it must not be empty. + WebString signonRealm; + + // The URL (minus query parameters) containing the form. This is the primary + // data used by the PasswordManager to decide (in longest matching prefix + // fashion) whether or not a given PasswordForm result from the database is a + // good fit for a particular form on a page, so it must not be empty. + WebURL origin; + + // The name of the submit button used. Optional; only used in scoring + // of PasswordForm results from the database to make matches as tight as + // possible. + // + // When parsing an HTML form, this must always be set. + WebString submitElement; + + // The name of the username input element. Optional (improves scoring). + // + // When parsing an HTML form, this must always be set. + WebString userNameElement; + + // The username. Optional. + // + // When parsing an HTML form, this is typically empty unless the site + // has implemented some form of autofill. + WebString userNameValue; + + // The name of the password input element, Optional (improves scoring). + // + // When parsing an HTML form, this must always be set. + WebString passwordElement; + + // The password. Required. + // + // When parsing an HTML form, this is typically empty. + WebString passwordValue; + + // If the form was a change password form, the name of the + // 'old password' input element. Optional. + WebString oldPasswordElement; + + // The old password. Optional. + WebString oldPasswordValue; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPerformance.h b/Source/WebKit/chromium/public/WebPerformance.h new file mode 100644 index 000000000..4b2cc1c59 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPerformance.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPerformance_h +#define WebPerformance_h + +#include "WebNavigationType.h" +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class Performance; } + +namespace WebKit { + +class WebPerformance { +public: + ~WebPerformance() { reset(); } + + WebPerformance() { } + + WebPerformance(const WebPerformance& p) { assign(p); } + + WebPerformance& operator=(const WebPerformance& p) + { + assign(p); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebPerformance&); + + // This only returns one of {Other|Reload|BackForward}. + // Form submits and link clicks all fall under other. + WEBKIT_EXPORT WebNavigationType navigationType() const; + + WEBKIT_EXPORT double navigationStart() const; + WEBKIT_EXPORT double unloadEventEnd() const; + WEBKIT_EXPORT double redirectStart() const; + WEBKIT_EXPORT double redirectEnd() const; + WEBKIT_EXPORT unsigned short redirectCount() const; + WEBKIT_EXPORT double fetchStart() const; + WEBKIT_EXPORT double domainLookupStart() const; + WEBKIT_EXPORT double domainLookupEnd() const; + WEBKIT_EXPORT double connectStart() const; + WEBKIT_EXPORT double connectEnd() const; + WEBKIT_EXPORT double requestStart() const; + WEBKIT_EXPORT double responseStart() const; + WEBKIT_EXPORT double responseEnd() const; + WEBKIT_EXPORT double domLoading() const; + WEBKIT_EXPORT double domInteractive() const; + WEBKIT_EXPORT double domContentLoadedEventStart() const; + WEBKIT_EXPORT double domContentLoadedEventEnd() const; + WEBKIT_EXPORT double domComplete() const; + WEBKIT_EXPORT double loadEventStart() const; + WEBKIT_EXPORT double loadEventEnd() const; + +#if WEBKIT_IMPLEMENTATION + WebPerformance(const WTF::PassRefPtr<WebCore::Performance>&); + WebPerformance& operator=(const WTF::PassRefPtr<WebCore::Performance>&); + operator WTF::PassRefPtr<WebCore::Performance>() const; +#endif + +private: + WebPrivatePtr<WebCore::Performance> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPermissionClient.h b/Source/WebKit/chromium/public/WebPermissionClient.h new file mode 100644 index 000000000..bc251825c --- /dev/null +++ b/Source/WebKit/chromium/public/WebPermissionClient.h @@ -0,0 +1,104 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPermissionClient_h +#define WebPermissionClient_h + +namespace WebKit { + +class WebFrame; +class WebSecurityOrigin; +class WebString; +class WebURL; + +class WebPermissionClient { +public: + // Controls whether access to Web Databases is allowed for this frame. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) { return true; } + + // Controls whether access to File System is allowed for this frame. + virtual bool allowFileSystem(WebFrame*) { return true; } + + // Controls whether images are allowed for this frame. + virtual bool allowImage(WebFrame* frame, bool enabledPerSettings, const WebURL& imageURL) { return enabledPerSettings; } + + // Controls whether access to Indexed DB are allowed for this frame. + virtual bool allowIndexedDB(WebFrame*, const WebString& name, const WebSecurityOrigin&) { return true; } + + // Controls whether plugins are allowed for this frame. + virtual bool allowPlugins(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + + // Controls whether scripts are allowed to execute for this frame. + virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + + // Controls whether scripts loaded from the given URL are allowed to execute for this frame. + virtual bool allowScriptFromSource(WebFrame*, bool enabledPerSettings, const WebURL& scriptURL) { return enabledPerSettings; } + + // Controls whether insecrure content is allowed to display for this frame. + virtual bool allowDisplayingInsecureContent(WebFrame*, bool enabledPerSettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } + + // Controls whether insecrure scripts are allowed to execute for this frame. + virtual bool allowRunningInsecureContent(WebFrame*, bool enabledPerSettings, const WebSecurityOrigin&, const WebURL&) { return enabledPerSettings; } + + // Controls whether the given script extension should run in a new script + // context in this frame. If extensionGroup is 0, the script context is the + // frame's main context. Otherwise, it is a context created by + // WebFrame::executeScriptInIsolatedWorld with that same extensionGroup + // value. + virtual bool allowScriptExtension(WebFrame*, const WebString& extensionName, int extensionGroup) { return true; } + + virtual bool allowScriptExtension(WebFrame* webFrame, const WebString& extensionName, int extensionGroup, int worldId) + { + return allowScriptExtension(webFrame, extensionName, extensionGroup); + } + + // Controls whether HTML5 Web Storage is allowed for this frame. + // If local is true, then this is for local storage, otherwise it's for session storage. + virtual bool allowStorage(WebFrame*, bool local) { return true; } + + // Controls whether access to read the clipboard is allowed for this frame. + virtual bool allowReadFromClipboard(WebFrame*, bool defaultValue) { return defaultValue; } + + // Controls whether access to write the clipboard is allowed for this frame. + virtual bool allowWriteToClipboard(WebFrame*, bool defaultValue) { return defaultValue; } + + // Notifies the client that the frame would have instantiated a plug-in if plug-ins were enabled. + virtual void didNotAllowPlugins(WebFrame*) { } + + // Notifies the client that the frame would have executed script if script were enabled. + virtual void didNotAllowScript(WebFrame*) { } + +protected: + ~WebPermissionClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPlugin.h b/Source/WebKit/chromium/public/WebPlugin.h new file mode 100644 index 000000000..f0eeade42 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPlugin.h @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPlugin_h +#define WebPlugin_h + +#include "platform/WebCanvas.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" + +struct NPObject; + +namespace WebKit { + +class WebDataSource; +class WebFrame; +class WebInputEvent; +class WebPluginContainer; +class WebURLResponse; +struct WebCursorInfo; +struct WebPluginParams; +struct WebPoint; +struct WebRect; +struct WebURLError; +template <typename T> class WebVector; + +class WebPlugin { +public: + virtual bool initialize(WebPluginContainer*) = 0; + virtual void destroy() = 0; + + virtual NPObject* scriptableObject() = 0; + + // Returns true if the form submission value is successfully obtained + // from the plugin. The value would be associated with the name attribute + // of the corresponding object element. + virtual bool getFormValue(WebString&) { return false; } + + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // Coordinates are relative to the containing window. + virtual void updateGeometry( + const WebRect& frameRect, const WebRect& clipRect, + const WebVector<WebRect>& cutOutsRects, bool isVisible) = 0; + + virtual void updateFocus(bool) = 0; + virtual void updateVisibility(bool) = 0; + + virtual bool acceptsInputEvents() = 0; + virtual bool handleInputEvent(const WebInputEvent&, WebCursorInfo&) = 0; + + virtual void didReceiveResponse(const WebURLResponse&) = 0; + virtual void didReceiveData(const char* data, int dataLength) = 0; + virtual void didFinishLoading() = 0; + virtual void didFailLoading(const WebURLError&) = 0; + + // Called in response to WebPluginContainer::loadFrameRequest + virtual void didFinishLoadingFrameRequest( + const WebURL&, void* notifyData) = 0; + virtual void didFailLoadingFrameRequest( + const WebURL&, void* notifyData, const WebURLError&) = 0; + + // Printing interface. + // Whether the plugin supports its own paginated print. The other print + // interface methods are called only if this method returns true. + virtual bool supportsPaginatedPrint() { return false; } + // Returns true if the printed content should not be scaled to + // the printer's printable area. + virtual bool isPrintScalingDisabled() { return false; } + // Sets up printing at the given print rect and printer DPI. printableArea + // is in points (a point is 1/72 of an inch).Returns the number of pages to + // be printed at these settings. + virtual int printBegin(const WebRect& printableArea, int printerDPI) { return 0; } + // Prints the page specified by pageNumber (0-based index) into the supplied canvas. + virtual bool printPage(int pageNumber, WebCanvas* canvas) { return false; } + // Ends the print operation. + virtual void printEnd() { } + + virtual bool hasSelection() const { return false; } + virtual WebString selectionAsText() const { return WebString(); } + virtual WebString selectionAsMarkup() const { return WebString(); } + + // If the given position is over a link, returns the absolute url. + // Otherwise an empty url is returned. + virtual WebURL linkAtPosition(const WebPoint& position) const { return WebURL(); } + + // Used for zooming of full page plugins. + virtual void setZoomLevel(double level, bool textOnly) { } + + // Find interface. + // Start a new search. The plugin should search for a little bit at a time so that it + // doesn't block the thread in case of a large document. The results, along with the + // find's identifier, should be sent asynchronously to WebFrameClient's reportFindInPage* methods. + // Returns true if the search started, or false if the plugin doesn't support search. + virtual bool startFind(const WebString& searchText, bool caseSensitive, int identifier) { return false; } + // Tells the plugin to jump forward or backward in the list of find results. + virtual void selectFindResult(bool forward) { } + // Tells the plugin that the user has stopped the find operation. + virtual void stopFind() { } + +protected: + ~WebPlugin() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPluginContainer.h b/Source/WebKit/chromium/public/WebPluginContainer.h new file mode 100644 index 000000000..122c4c8df --- /dev/null +++ b/Source/WebKit/chromium/public/WebPluginContainer.h @@ -0,0 +1,112 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPluginContainer_h +#define WebPluginContainer_h + +struct NPObject; + +namespace WebKit { + +class WebElement; +class WebPlugin; +class WebString; +class WebURL; +class WebURLRequest; +struct WebRect; + +class WebPluginContainer { +public: + // Returns the element containing this plugin. + virtual WebElement element() = 0; + + virtual void invalidate() = 0; + virtual void invalidateRect(const WebRect&) = 0; + virtual void scrollRect(int dx, int dy, const WebRect&) = 0; + + // Causes the container to report its current geometry via + // WebPlugin::updateGeometry. + virtual void reportGeometry() = 0; + + // Sets the id of the texture used for hw-accel compositing. + // The default value for id is zero which indicates software rendering. + // A non-zero value will trigger hw-accelerated compositing. + virtual void setBackingTextureId(unsigned) = 0; + // Notifies the container that the plugin allocated a new IOSurface for + // its rendering, and that the compositor should bind to this texture + // and use it for subsequent rendering. A non-zero ioSurfaceId triggers + // hardware-accelerated compositing; a zero value switches back to the + // software rendered path. (This entry point is used only on Mac OS, + // but is defined on all platforms for simplicity.) + virtual void setBackingIOSurfaceId(int width, + int height, + uint32_t ioSurfaceId) = 0; + // Called when the backing texture is ready to be composited. + // FIXME: consider renaming to something more general, now that + // there are multiple providers. One idea: commitBackingStore. + virtual void commitBackingTexture() {} + + // Drop any references to script objects allocated by the plugin. + // These are objects derived from WebPlugin::scriptableObject. This is + // called when the plugin is being destroyed or if it needs to be + // re-initialized. + virtual void clearScriptObjects() = 0; + + // Returns the scriptable object associated with the DOM element + // containing the plugin. + virtual NPObject* scriptableObjectForElement() = 0; + + // Executes a "javascript:" URL on behalf of the plugin in the context + // of the frame containing the plugin. Returns the result of script + // execution, if any. + virtual WebString executeScriptURL(const WebURL&, bool popupsAllowed) = 0; + + // Loads an URL in the specified frame (or the frame containing this + // plugin if target is empty). If notifyNeeded is true, then upon + // completion, WebPlugin::didFinishLoadingFrameRequest is called if the + // load was successful or WebPlugin::didFailLoadingFrameRequest is + // called if the load failed. The given notifyData is passed along to + // the callback. + virtual void loadFrameRequest( + const WebURLRequest&, const WebString& target, bool notifyNeeded, void* notifyData) = 0; + + // Notifies that the zoom level has changed. + virtual void zoomLevelChanged(double zoomLevel) = 0; + + virtual WebPlugin* plugin() = 0; + virtual void setPlugin(WebPlugin*) = 0; + +protected: + ~WebPluginContainer() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPluginDocument.h b/Source/WebKit/chromium/public/WebPluginDocument.h new file mode 100644 index 000000000..d7aa0d23f --- /dev/null +++ b/Source/WebKit/chromium/public/WebPluginDocument.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPluginDocument_h +#define WebPluginDocument_h + +#include "WebDocument.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class PluginDocument; } +#endif + +namespace WebKit { +class WebPlugin; + +// Wraps a WebDocument for full page plugins. +class WebPluginDocument : public WebDocument { +public: + WebPluginDocument() { } + WebPluginDocument(const WebPluginDocument& e) : WebDocument(e) { } + + WebPluginDocument& operator=(const WebPluginDocument& e) + { + WebNode::assign(e); + return *this; + } + void assign(const WebPluginDocument& d) { WebNode::assign(d); } + + WEBKIT_EXPORT WebPlugin* plugin(); + +#if WEBKIT_IMPLEMENTATION + WebPluginDocument(const WTF::PassRefPtr<WebCore::PluginDocument>&); + WebPluginDocument& operator=(const WTF::PassRefPtr<WebCore::PluginDocument>&); + operator WTF::PassRefPtr<WebCore::PluginDocument>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPluginListBuilder.h b/Source/WebKit/chromium/public/WebPluginListBuilder.h new file mode 100644 index 000000000..4bd427d6a --- /dev/null +++ b/Source/WebKit/chromium/public/WebPluginListBuilder.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPluginListBuilder_h +#define WebPluginListBuilder_h + +namespace WebKit { + +class WebString; + +// An interface for building a list of known plugins. +class WebPluginListBuilder { +public: + virtual void addPlugin( + const WebString& name, const WebString& description, + const WebString& fileName) = 0; + + virtual void addMediaTypeToLastPlugin( + const WebString& name, const WebString& description) = 0; + + virtual void addFileExtensionToLastMediaType( + const WebString& fileExtension) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPluginParams.h b/Source/WebKit/chromium/public/WebPluginParams.h new file mode 100644 index 000000000..cd9b7d8f9 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPluginParams.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPluginParams_h +#define WebPluginParams_h + +#include "platform/WebString.h" +#include "platform/WebURL.h" +#include "platform/WebVector.h" + +namespace WebKit { + +struct WebPluginParams { + WebURL url; + WebString mimeType; + WebVector<WebString> attributeNames; + WebVector<WebString> attributeValues; + bool loadManually; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPopupMenu.h b/Source/WebKit/chromium/public/WebPopupMenu.h new file mode 100644 index 000000000..d776c171e --- /dev/null +++ b/Source/WebKit/chromium/public/WebPopupMenu.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPopupMenu_h +#define WebPopupMenu_h + +#include "WebWidget.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebWidgetClient; + +class WebPopupMenu : public WebWidget { +public: + WEBKIT_EXPORT static WebPopupMenu* create(WebWidgetClient*); + + // Sets the minimum height of a popup listbox row. + WEBKIT_EXPORT static void setMinimumRowHeight(int); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebPopupMenuInfo.h b/Source/WebKit/chromium/public/WebPopupMenuInfo.h new file mode 100644 index 000000000..d0deaea6e --- /dev/null +++ b/Source/WebKit/chromium/public/WebPopupMenuInfo.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPopupMenuInfo_h +#define WebPopupMenuInfo_h + +#include "WebMenuItemInfo.h" +#include "platform/WebVector.h" + +namespace WebKit { + +// Describes the contents of a popup menu. +struct WebPopupMenuInfo { + int itemHeight; + int itemFontSize; + int selectedIndex; + WebVector<WebMenuItemInfo> items; + bool rightAligned; + bool allowMultipleSelection; +}; + +} + +#endif diff --git a/Source/WebKit/chromium/public/WebPopupType.h b/Source/WebKit/chromium/public/WebPopupType.h new file mode 100644 index 000000000..8a546bae4 --- /dev/null +++ b/Source/WebKit/chromium/public/WebPopupType.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPopupType_h +#define WebPopupType_h + +namespace WebKit { + +enum WebPopupType { + WebPopupTypeNone, // Not a popup. + WebPopupTypeSelect, // A HTML select (combo-box) popup. + WebPopupTypeSuggestion, // An autofill/autocomplete popup. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebRange.h b/Source/WebKit/chromium/public/WebRange.h new file mode 100644 index 000000000..907dfd563 --- /dev/null +++ b/Source/WebKit/chromium/public/WebRange.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebRange_h +#define WebRange_h + +#include "platform/WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Range; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebFrame; +class WebNode; +class WebRangePrivate; +class WebString; + +// Provides readonly access to some properties of a DOM range. +class WebRange { +public: + ~WebRange() { reset(); } + + WebRange() : m_private(0) { } + WebRange(const WebRange& r) : m_private(0) { assign(r); } + WebRange& operator=(const WebRange& r) + { + assign(r); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebRange&); + + bool isNull() const { return !m_private; } + + WEBKIT_EXPORT int startOffset() const; + WEBKIT_EXPORT int endOffset() const; + WEBKIT_EXPORT WebNode startContainer(int& exceptionCode) const; + WEBKIT_EXPORT WebNode endContainer(int& exceptionCode) const; + + WEBKIT_EXPORT WebString toHTMLText() const; + WEBKIT_EXPORT WebString toPlainText() const; + + WEBKIT_EXPORT static WebRange fromDocumentRange(WebFrame*, int start, int length); + +#if WEBKIT_IMPLEMENTATION + WebRange(const WTF::PassRefPtr<WebCore::Range>&); + WebRange& operator=(const WTF::PassRefPtr<WebCore::Range>&); + operator WTF::PassRefPtr<WebCore::Range>() const; +#endif + +private: + void assign(WebRangePrivate*); + WebRangePrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebReferrerPolicy.h b/Source/WebKit/chromium/public/WebReferrerPolicy.h new file mode 100644 index 000000000..82710fb22 --- /dev/null +++ b/Source/WebKit/chromium/public/WebReferrerPolicy.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebReferrerPolicy_h +#define WebReferrerPolicy_h + +namespace WebKit { + +enum WebReferrerPolicy { + WebReferrerPolicyAlways, + WebReferrerPolicyDefault, + WebReferrerPolicyNever, + WebReferrerPolicyOrigin, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebRegularExpression.h b/Source/WebKit/chromium/public/WebRegularExpression.h new file mode 100644 index 000000000..9f6cc9ace --- /dev/null +++ b/Source/WebKit/chromium/public/WebRegularExpression.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebRegularExpression_h +#define WebRegularExpression_h + +#include "WebTextCaseSensitivity.h" +#include "platform/WebCommon.h" +#include "platform/WebNonCopyable.h" + +namespace WebKit { + +class WebRegularExpressionPrivate; +class WebString; + +class WebRegularExpression : public WebNonCopyable { +public: + WEBKIT_EXPORT WebRegularExpression(const WebString& pattern, WebTextCaseSensitivity); + WEBKIT_EXPORT ~WebRegularExpression(); + + WEBKIT_EXPORT int match(const WebString&, int startFrom = 0, int* matchLength = 0) const; + +private: + WebRegularExpressionPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebRuntimeFeatures.h b/Source/WebKit/chromium/public/WebRuntimeFeatures.h new file mode 100644 index 000000000..5fff989e5 --- /dev/null +++ b/Source/WebKit/chromium/public/WebRuntimeFeatures.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebRuntimeFeatures_h +#define WebRuntimeFeatures_h + +#define HAS_WEBAUDIO_RUNTIMEFEATURES 1 + +#include "platform/WebCommon.h" + +namespace WebKit { + +// This class is used to enable runtime features of WebKit. It is unspecified +// whether a feature is enabled by default. In the future, a feature may be +// promoted from disabled by default to enabled by default once it reaches a +// certain level of maturity. +class WebRuntimeFeatures { +public: + WEBKIT_EXPORT static void enableDatabase(bool); + WEBKIT_EXPORT static bool isDatabaseEnabled(); + + WEBKIT_EXPORT static void enableLocalStorage(bool); + WEBKIT_EXPORT static bool isLocalStorageEnabled(); + + WEBKIT_EXPORT static void enableSessionStorage(bool); + WEBKIT_EXPORT static bool isSessionStorageEnabled(); + + WEBKIT_EXPORT static void enableMediaPlayer(bool); + WEBKIT_EXPORT static bool isMediaPlayerEnabled(); + + WEBKIT_EXPORT static void enableSockets(bool); + WEBKIT_EXPORT static bool isSocketsEnabled(); + + WEBKIT_EXPORT static void enableNotifications(bool); + WEBKIT_EXPORT static bool isNotificationsEnabled(); + + WEBKIT_EXPORT static void enableApplicationCache(bool); + WEBKIT_EXPORT static bool isApplicationCacheEnabled(); + + WEBKIT_EXPORT static void enableDataTransferItems(bool); + WEBKIT_EXPORT static bool isDataTransferItemsEnabled(); + + WEBKIT_EXPORT static void enableGeolocation(bool); + WEBKIT_EXPORT static bool isGeolocationEnabled(); + + WEBKIT_EXPORT static void enableIndexedDatabase(bool); + WEBKIT_EXPORT static bool isIndexedDatabaseEnabled(); + + WEBKIT_EXPORT static void enableWebAudio(bool); + WEBKIT_EXPORT static bool isWebAudioEnabled(); + + WEBKIT_EXPORT static void enablePushState(bool); + WEBKIT_EXPORT static bool isPushStateEnabled(bool); + + WEBKIT_EXPORT static void enableTouch(bool); + WEBKIT_EXPORT static bool isTouchEnabled(); + + WEBKIT_EXPORT static void enableDeviceMotion(bool); + WEBKIT_EXPORT static bool isDeviceMotionEnabled(); + + WEBKIT_EXPORT static void enableDeviceOrientation(bool); + WEBKIT_EXPORT static bool isDeviceOrientationEnabled(); + + WEBKIT_EXPORT static void enableSpeechInput(bool); + WEBKIT_EXPORT static bool isSpeechInputEnabled(); + + WEBKIT_EXPORT static void enableXHRResponseBlob(bool); + WEBKIT_EXPORT static bool isXHRResponseBlobEnabled(); + + WEBKIT_EXPORT static void enableFileSystem(bool); + WEBKIT_EXPORT static bool isFileSystemEnabled(); + + WEBKIT_EXPORT static void enableJavaScriptI18NAPI(bool); + WEBKIT_EXPORT static bool isJavaScriptI18NAPIEnabled(); + + WEBKIT_EXPORT static void enableQuota(bool); + WEBKIT_EXPORT static bool isQuotaEnabled(); + + WEBKIT_EXPORT static void enableMediaStream(bool); + WEBKIT_EXPORT static bool isMediaStreamEnabled(); + + WEBKIT_EXPORT static void enableFullScreenAPI(bool); + WEBKIT_EXPORT static bool isFullScreenAPIEnabled(); + + WEBKIT_EXPORT static void enablePointerLock(bool); + WEBKIT_EXPORT static bool isPointerLockEnabled(); + + WEBKIT_EXPORT static void enableMediaSource(bool); + WEBKIT_EXPORT static bool isMediaSourceEnabled(); + + WEBKIT_EXPORT static void enableVideoTrack(bool); + WEBKIT_EXPORT static bool isVideoTrackEnabled(); + + WEBKIT_EXPORT static void enableGamepad(bool); + WEBKIT_EXPORT static bool isGamepadEnabled(); + +private: + WebRuntimeFeatures(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebScreenInfo.h b/Source/WebKit/chromium/public/WebScreenInfo.h new file mode 100644 index 000000000..ac92e1667 --- /dev/null +++ b/Source/WebKit/chromium/public/WebScreenInfo.h @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScreenInfo_h +#define WebScreenInfo_h + +#include "platform/WebRect.h" + +namespace WebKit { + +struct WebScreenInfo { + // The horizontal screen dpi. + int horizontalDPI; + + // The vertical screen dpi. + int verticalDPI; + + // The screen depth in bits per pixel + int depth; + + // The bits per colour component. This assumes that the colours are balanced + // equally. + int depthPerComponent; + + // This can be true for black and white printers + bool isMonochrome; + + // This is set from the rcMonitor member of MONITORINFOEX, to whit: + // "A RECT structure that specifies the display monitor rectangle, + // expressed in virtual-screen coordinates. Note that if the monitor + // is not the primary display monitor, some of the rectangle's + // coordinates may be negative values." + WebRect rect; + + // This is set from the rcWork member of MONITORINFOEX, to whit: + // "A RECT structure that specifies the work area rectangle of the + // display monitor that can be used by applications, expressed in + // virtual-screen coordinates. Windows uses this rectangle to + // maximize an application on the monitor. The rest of the area in + // rcMonitor contains system windows such as the task bar and side + // bars. Note that if the monitor is not the primary display monitor, + // some of the rectangle's coordinates may be negative values". + WebRect availableRect; + + // Measured in frames per second. 0 if the rate is unknown or not applicable. + double refreshRate; + + WebScreenInfo() + : horizontalDPI(0) + , verticalDPI(0) + , depth(0) + , depthPerComponent(0) + , isMonochrome(false) + , refreshRate(0) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebScriptController.h b/Source/WebKit/chromium/public/WebScriptController.h new file mode 100644 index 000000000..da3ac1cdd --- /dev/null +++ b/Source/WebKit/chromium/public/WebScriptController.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScriptController_h +#define WebScriptController_h + +#include "platform/WebCommon.h" + +namespace v8 { +class Extension; +} + +namespace WebKit { + +class WebString; + +class WebScriptController { +public: + // Registers a v8 extension to be available on webpages. The three forms + // offer various restrictions on what types of contexts the extension is + // loaded into. If a scheme is provided, only pages whose URL has the given + // scheme will match. If extensionGroup is provided, the extension will only + // be loaded into scripts run via WebFrame::ExecuteInNewWorld with the + // matching group. + // Will only affect v8 contexts initialized after this call. Takes ownership + // of the v8::Extension object passed. + WEBKIT_EXPORT static void registerExtension(v8::Extension*); + + // Enables special settings which are only applicable if V8 is executed + // in the single thread which must be the main thread. + // FIXME: make a try to dynamically detect when this condition is broken + // and automatically switch off single thread mode. + WEBKIT_EXPORT static void enableV8SingleThreadMode(); + + // Process any pending JavaScript console messages. + WEBKIT_EXPORT static void flushConsoleMessages(); + +private: + WebScriptController(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebScriptSource.h b/Source/WebKit/chromium/public/WebScriptSource.h new file mode 100644 index 000000000..db0e341c8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebScriptSource.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScriptSource_h +#define WebScriptSource_h + +#include "platform/WebString.h" +#include "platform/WebURL.h" + +namespace WebKit { + +struct WebScriptSource { + WebString code; + WebURL url; + int startLine; + + WebScriptSource(const WebString& code) + : code(code), startLine(1) { } + WebScriptSource(const WebString& code, const WebURL& url) + : code(code), url(url), startLine(1) { } + WebScriptSource(const WebString& code, const WebURL& url, int startLine) + : code(code), url(url), startLine(startLine) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebScrollbar.h b/Source/WebKit/chromium/public/WebScrollbar.h new file mode 100644 index 000000000..ecac86a01 --- /dev/null +++ b/Source/WebKit/chromium/public/WebScrollbar.h @@ -0,0 +1,105 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScrollbar_h +#define WebScrollbar_h + +#include "platform/WebCanvas.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebInputEvent; +class WebPluginContainer; +class WebScrollbarClient; +struct WebRect; + +class WebScrollbar { +public: + enum Orientation { + Horizontal, + Vertical + }; + + enum ScrollDirection { + ScrollBackward, + ScrollForward + }; + + enum ScrollGranularity { + ScrollByLine, + ScrollByPage, + ScrollByDocument, + ScrollByPixel + }; + + // Creates a WebScrollbar for use by a plugin. The plugin container and + // client are guaranteed to outlive this object. + WEBKIT_EXPORT static WebScrollbar* createForPlugin(Orientation, + WebPluginContainer*, + WebScrollbarClient*); + + virtual ~WebScrollbar() {} + + // Gets the thickness of the scrollbar in pixels. + WEBKIT_EXPORT static int defaultThickness(); + + // Return true if this is an overlay scrollbar. + virtual bool isOverlay() const = 0; + + // Sets the rectangle of the scrollbar. + virtual void setLocation(const WebRect&) = 0; + + // Gets the current value (i.e. position inside the region). + virtual int value() const = 0; + + // Sets the current value. + virtual void setValue(int position) = 0; + + // Sets the size of the scrollable region in pixels. i.e. if a document is + // 800x10000 pixels and the viewport is 1000x1000 pixels, then setLocation + // for the vertical scrollbar would have passed in a rectangle like: + // (800 - defaultThickness(), 0) (defaultThickness() x 10000) + // and setDocumentSize(10000) + virtual void setDocumentSize(int size) = 0; + + // Scroll back or forward with the given granularity. + virtual void scroll(ScrollDirection, ScrollGranularity, float multiplier) = 0; + + // Paint the given rectangle. + virtual void paint(WebCanvas*, const WebRect&) = 0; + + // Returns true iff the given event was used. + virtual bool handleInputEvent(const WebInputEvent&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebScrollbarClient.h b/Source/WebKit/chromium/public/WebScrollbarClient.h new file mode 100644 index 000000000..d19b29b47 --- /dev/null +++ b/Source/WebKit/chromium/public/WebScrollbarClient.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScrollbarClient_h +#define WebScrollbarClient_h + +namespace WebKit { + +class WebScrollbar; +struct WebRect; +template <typename T> class WebVector; + +class WebScrollbarClient { +public: + virtual void valueChanged(WebScrollbar*) = 0; + virtual void overlayChanged(WebScrollbar*) = 0; + virtual void invalidateScrollbarRect(WebScrollbar*, const WebRect&) = 0; + virtual void getTickmarks(WebScrollbar*, WebVector<WebRect>*) const = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSearchableFormData.h b/Source/WebKit/chromium/public/WebSearchableFormData.h new file mode 100644 index 000000000..ede87568a --- /dev/null +++ b/Source/WebKit/chromium/public/WebSearchableFormData.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSearchableFormData_h +#define WebSearchableFormData_h + +#include "WebInputElement.h" +#include "platform/WebString.h" +#include "platform/WebURL.h" + +namespace WebKit { +class WebFormElement; + +// SearchableFormData encapsulates a URL and encoding of an INPUT field that +// corresponds to a searchable form request. +class WebSearchableFormData { +public: + // If the provided form is suitable for automated searching, isValid() + // will return false. + WEBKIT_EXPORT WebSearchableFormData(const WebFormElement&, const WebInputElement& selectedInputElement = WebInputElement()); + + bool isValid() { return m_url.isValid(); } + + // URL for the searchable form request. + const WebURL& url() const + { + return m_url; + } + + // Encoding used to encode the form parameters; never empty. + const WebString& encoding() const + { + return m_encoding; + } + +private: + WebURL m_url; + WebString m_encoding; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSecurityOrigin.h b/Source/WebKit/chromium/public/WebSecurityOrigin.h new file mode 100644 index 000000000..ffddf093a --- /dev/null +++ b/Source/WebKit/chromium/public/WebSecurityOrigin.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSecurityOrigin_h +#define WebSecurityOrigin_h + +#include "platform/WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class SecurityOrigin; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebSecurityOriginPrivate; +class WebString; +class WebURL; + +class WebSecurityOrigin { +public: + ~WebSecurityOrigin() { reset(); } + + WebSecurityOrigin() : m_private(0) { } + WebSecurityOrigin(const WebSecurityOrigin& s) : m_private(0) { assign(s); } + WebSecurityOrigin& operator=(const WebSecurityOrigin& s) + { + assign(s); + return *this; + } + + WEBKIT_EXPORT static WebSecurityOrigin createFromDatabaseIdentifier(const WebString& databaseIdentifier); + WEBKIT_EXPORT static WebSecurityOrigin createFromString(const WebString&); + WEBKIT_EXPORT static WebSecurityOrigin create(const WebURL&); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebSecurityOrigin&); + + bool isNull() const { return !m_private; } + + WEBKIT_EXPORT WebString protocol() const; + WEBKIT_EXPORT WebString host() const; + WEBKIT_EXPORT unsigned short port() const; + + // A unique WebSecurityOrigin is the least privileged WebSecurityOrigin. + WEBKIT_EXPORT bool isUnique() const; + + // Returns true if this WebSecurityOrigin can script objects in the given + // SecurityOrigin. For example, call this function before allowing + // script from one security origin to read or write objects from + // another SecurityOrigin. + WEBKIT_EXPORT bool canAccess(const WebSecurityOrigin&) const; + + // Returns true if this WebSecurityOrigin can read content retrieved from + // the given URL. For example, call this function before allowing script + // from a given security origin to receive contents from a given URL. + WEBKIT_EXPORT bool canRequest(const WebURL&) const; + + // Returns a string representation of the WebSecurityOrigin. The empty + // WebSecurityOrigin is represented by "null". The representation of a + // non-empty WebSecurityOrigin resembles a standard URL. + WEBKIT_EXPORT WebString toString() const; + + // Returns a string representation of this WebSecurityOrigin that can + // be used as a file. Should be used in storage APIs only. + WEBKIT_EXPORT WebString databaseIdentifier() const; + + // Returns true if this WebSecurityOrigin can access usernames and + // passwords stored in password manager. + WEBKIT_EXPORT bool canAccessPasswordManager() const; + +#if WEBKIT_IMPLEMENTATION + WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); + WebSecurityOrigin& operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); + operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const; + WebCore::SecurityOrigin* get() const; +#endif + +private: + void assign(WebSecurityOriginPrivate*); + WebSecurityOriginPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSecurityPolicy.h b/Source/WebKit/chromium/public/WebSecurityPolicy.h new file mode 100644 index 000000000..4063f91cc --- /dev/null +++ b/Source/WebKit/chromium/public/WebSecurityPolicy.h @@ -0,0 +1,93 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSecurityPolicy_h +#define WebSecurityPolicy_h + +#include "WebReferrerPolicy.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebString; +class WebURL; + +class WebSecurityPolicy { +public: + // Registers a URL scheme to be treated as a local scheme (i.e., with the + // same security rules as those applied to "file" URLs). This means that + // normal pages cannot link to or access URLs of this scheme. + WEBKIT_EXPORT static void registerURLSchemeAsLocal(const WebString&); + + // Registers a URL scheme to be treated as a noAccess scheme. This means + // that pages loaded with this URL scheme cannot access pages loaded with + // any other URL scheme. + WEBKIT_EXPORT static void registerURLSchemeAsNoAccess(const WebString&); + + // Registers a URL scheme to be treated as display-isolated. This means + // that pages cannot display these URLs unless they are from the same + // scheme. For example, pages in other origin cannot create iframes or + // hyperlinks to URLs with the scheme. + WEBKIT_EXPORT static void registerURLSchemeAsDisplayIsolated(const WebString&); + + // Registers a URL scheme to not generate mixed content warnings when + // included by an HTTPS page. + WEBKIT_EXPORT static void registerURLSchemeAsSecure(const WebString&); + + // Support for whitelisting access to origins beyond the same-origin policy. + WEBKIT_EXPORT static void addOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, + const WebString& destinationHost, bool allowDestinationSubdomains); + WEBKIT_EXPORT static void removeOriginAccessWhitelistEntry( + const WebURL& sourceOrigin, const WebString& destinationProtocol, + const WebString& destinationHost, bool allowDestinationSubdomains); + WEBKIT_EXPORT static void resetOriginAccessWhitelists(); + + // Returns whether the url should be allowed to see the referrer + // based on their respective protocols. + // FIXME: remove this function once the chromium side has landed. + WEBKIT_EXPORT static bool shouldHideReferrer(const WebURL&, const WebString& referrer); + + // Returns the referrer modified according to the referrer policy for a + // navigation to a given URL. If the referrer returned is empty, the + // referrer header should be omitted. + WEBKIT_EXPORT static WebString generateReferrerHeader(WebReferrerPolicy, const WebURL&, const WebString& referrer); + + // Registers an URL scheme to not allow manipulation of the loaded page + // by bookmarklets or javascript: URLs typed in the omnibox. + WEBKIT_EXPORT static void registerURLSchemeAsNotAllowingJavascriptURLs(const WebString&); + +private: + WebSecurityPolicy(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSelectElement.h b/Source/WebKit/chromium/public/WebSelectElement.h new file mode 100644 index 000000000..f537e93a7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSelectElement.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSelectElement_h +#define WebSelectElement_h + +#include "WebFormControlElement.h" +#include "WebOptionElement.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLSelectElement; } +#endif + +namespace WebKit { + +// Provides readonly access to some properties of a DOM select element node. +class WebSelectElement : public WebFormControlElement { +public: + WebSelectElement() : WebFormControlElement() { } + WebSelectElement(const WebSelectElement& element) : WebFormControlElement(element) { } + + WebSelectElement& operator=(const WebSelectElement& element) + { + WebFormControlElement::assign(element); + return *this; + } + void assign(const WebSelectElement& element) { WebFormControlElement::assign(element); } + + WEBKIT_EXPORT void setValue(const WebString&); + WEBKIT_EXPORT WebString value() const; + WEBKIT_EXPORT WebVector<WebElement> listItems() const; + +#if WEBKIT_IMPLEMENTATION + WebSelectElement(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + WebSelectElement& operator=(const WTF::PassRefPtr<WebCore::HTMLSelectElement>&); + operator WTF::PassRefPtr<WebCore::HTMLSelectElement>() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h new file mode 100644 index 000000000..0e9495cd7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSettings_h +#define WebSettings_h + +#include "platform/WebCommon.h" +#include <unicode/uscript.h> + +#define HAS_WEBAUDIO_FEATURE_ENABLE 1 + +namespace WebKit { + +class WebString; +class WebURL; + +// WebSettings is owned by the WebView and allows code to modify the settings for +// the WebView's page without any knowledge of WebCore itself. For the most part, +// these functions have a 1:1 mapping with the methods in WebCore/page/Settings.h. +class WebSettings { +public: + enum EditingBehavior { + EditingBehaviorMac, + EditingBehaviorWin, + EditingBehaviorUnix + }; + + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setDefaultFontSize(int) = 0; + virtual void setDefaultFixedFontSize(int) = 0; + virtual void setMinimumFontSize(int) = 0; + virtual void setMinimumLogicalFontSize(int) = 0; + virtual void setDefaultTextEncodingName(const WebString&) = 0; + virtual void setJavaScriptEnabled(bool) = 0; + virtual void setWebSecurityEnabled(bool) = 0; + virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; + virtual void setLoadsImagesAutomatically(bool) = 0; + virtual void setImagesEnabled(bool) = 0; + virtual void setPluginsEnabled(bool) = 0; + virtual void setDOMPasteAllowed(bool) = 0; + virtual void setDeveloperExtrasEnabled(bool) = 0; + virtual void setNeedsSiteSpecificQuirks(bool) = 0; + virtual void setShrinksStandaloneImagesToFit(bool) = 0; + virtual void setUsesEncodingDetector(bool) = 0; + virtual void setTextAreasAreResizable(bool) = 0; + virtual void setJavaEnabled(bool) = 0; + virtual void setAllowScriptsToCloseWindows(bool) = 0; + virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; + virtual void setUsesPageCache(bool) = 0; + virtual void setPageCacheSupportsPlugins(bool) = 0; + virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setJavaScriptCanAccessClipboard(bool) = 0; + virtual void setXSSAuditorEnabled(bool) = 0; + virtual void setDNSPrefetchingEnabled(bool) = 0; + virtual void setLocalStorageEnabled(bool) = 0; + virtual void setEditableLinkBehaviorNeverLive() = 0; + virtual void setFrameFlatteningEnabled(bool) = 0; + virtual void setFontRenderingModeNormal() = 0; + virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; + virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; + virtual void setWebAudioEnabled(bool) = 0; + virtual void setExperimentalWebGLEnabled(bool) = 0; + virtual void setOpenGLMultisamplingEnabled(bool) = 0; + virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0; + virtual void setShowDebugBorders(bool) = 0; + virtual void setShowFPSCounter(bool) = 0; + virtual bool showFPSCounter() const = 0; + virtual void setShowPlatformLayerTree(bool) = 0; + virtual bool showPlatformLayerTree() const = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setForceCompositingMode(bool) = 0; + virtual void setMockScrollbarsEnabled(bool) = 0; + virtual void setCompositeToTextureEnabled(bool) = 0; + virtual bool compositeToTextureEnabled() const = 0; + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; + virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; + virtual void setLegacyAccelerated2dCanvasEnabled(bool) = 0; + virtual void setMinimumAccelerated2dCanvasSize(int) = 0; + virtual void setAcceleratedFiltersEnabled(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; + virtual void setHyperlinkAuditingEnabled(bool) = 0; + virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setUnifiedTextCheckerEnabled(bool) = 0; + virtual void setCaretBrowsingEnabled(bool) = 0; + virtual void setInteractiveFormValidationEnabled(bool) = 0; + virtual void setValidationMessageTimerMagnification(int) = 0; + virtual void setMinimumTimerInterval(double) = 0; + virtual void setFullScreenEnabled(bool) = 0; + virtual void setAllowDisplayOfInsecureContent(bool) = 0; + virtual void setAllowRunningOfInsecureContent(bool) = 0; + virtual void setShouldPrintBackgrounds(bool) = 0; + virtual void setEnableScrollAnimator(bool) = 0; + virtual void setHixie76WebSocketProtocolEnabled(bool) = 0; + virtual void setVisualWordMovementEnabled(bool) = 0; + virtual void setAcceleratedPaintingEnabled(bool) = 0; + virtual void setPerTilePaintingEnabled(bool) = 0; + virtual void setPartialSwapEnabled(bool) = 0; + +protected: + ~WebSettings() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSharedWorker.h b/Source/WebKit/chromium/public/WebSharedWorker.h new file mode 100644 index 000000000..447f7f486 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSharedWorker.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSharedWorker_h +#define WebSharedWorker_h + +#include "platform/WebCommon.h" + +namespace WebCore { +class ScriptExecutionContext; +} + +namespace WebKit { + +class WebString; +class WebMessagePortChannel; +class WebSharedWorkerClient; +class WebURL; + +// This is the interface to a SharedWorker thread. +// Since SharedWorkers communicate entirely through MessagePorts this interface only contains APIs for starting up a SharedWorker. +class WebSharedWorker { +public: + // Invoked from the worker thread to instantiate a WebSharedWorker that interacts with the WebKit worker components. + WEBKIT_EXPORT static WebSharedWorker* create(WebSharedWorkerClient*); + + virtual ~WebSharedWorker() {}; + + // Returns false if the thread hasn't been started yet (script loading has not taken place). + // FIXME(atwilson): Remove this when we move the initial script loading into the worker process. + virtual bool isStarted() = 0; + + virtual void startWorkerContext(const WebURL& scriptURL, + const WebString& name, + const WebString& userAgent, + const WebString& sourceCode, + long long scriptResourceAppCacheID) = 0; + + class ConnectListener { + public: + // Invoked once the connect event has been sent so the caller can free this object. + virtual void connected() = 0; + }; + + // Sends a connect event to the SharedWorker context. The listener is invoked when this async operation completes. + virtual void connect(WebMessagePortChannel*, ConnectListener*) = 0; + + // Invoked to shutdown the worker when there are no more associated documents. + virtual void terminateWorkerContext() = 0; + + // Notification when the WebCommonWorkerClient is destroyed. + virtual void clientDestroyed() = 0; + + virtual void pauseWorkerContextOnStart() { } + virtual void resumeWorkerContext() { } + virtual void attachDevTools() { } + virtual void reattachDevTools(const WebString& savedState) { } + virtual void detachDevTools() { } + virtual void dispatchDevToolsMessage(const WebString&) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSharedWorkerClient.h b/Source/WebKit/chromium/public/WebSharedWorkerClient.h new file mode 100644 index 000000000..01700c6c1 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSharedWorkerClient.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSharedWorkerClient_h +#define WebSharedWorkerClient_h + +#include "WebCommonWorkerClient.h" +#include "WebMessagePortChannel.h" + +namespace WebKit { + +class WebNotificationPresenter; +class WebString; +class WebWorker; + +// Provides an interface back to the in-page script object for a worker. +// All functions are expected to be called back on the thread that created +// the Worker object, unless noted. +class WebSharedWorkerClient : public WebCommonWorkerClient { +public: + virtual void postMessageToWorkerObject( + const WebString&, + const WebMessagePortChannelArray&) = 0; + + virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; + virtual void reportPendingActivity(bool hasPendingActivity) = 0; + + virtual void postExceptionToWorkerObject( + const WebString& errorString, int lineNumber, + const WebString& sourceURL) = 0; + + // FIXME: the below is for compatibility only and should be + // removed once Chromium is updated to remove message + // destination parameter <http://webkit.org/b/37155>. + virtual void postConsoleMessageToWorkerObject(int, int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject(int sourceIdentifier, int messageType, int messageLevel, + const WebString& message, int lineNumber, const WebString& sourceURL) + { + postConsoleMessageToWorkerObject(0, sourceIdentifier, messageType, messageLevel, + message, lineNumber, sourceURL); + } + + virtual void workerContextClosed() = 0; + virtual void workerContextDestroyed() = 0; + + // Returns the notification presenter for this worker context. Pointer + // is owned by the object implementing WebCommonWorkerClient. + virtual WebNotificationPresenter* notificationPresenter() = 0; + + // This can be called on any thread to create a nested WebWorker. + // WebSharedWorkers are not instantiated via this API - instead + // they are created via the WebSharedWorkerRepository. + virtual WebWorker* createWorker(WebSharedWorkerClient*) = 0; + + // Called on the main webkit thread in the worker process during initialization. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) = 0; + + // Called on the main webkit thread before opening a web database. + virtual bool allowDatabase(WebFrame*, const WebString& name, const WebString& displayName, unsigned long estimatedSize) = 0; + + // Called on the main webkit thread before opening a file system. + virtual bool allowFileSystem() + { + return true; + } + + // Called on the main webkit thread before opening a file system. + virtual void openFileSystem(WebFileSystem::Type, long long size, bool create, WebFileSystemCallbacks*) + { + WEBKIT_ASSERT_NOT_REACHED(); + } + + virtual void dispatchDevToolsMessage(const WebString&) { } + virtual void saveDevToolsAgentState(const WebString&) { } + +protected: + ~WebSharedWorkerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSharedWorkerRepository.h b/Source/WebKit/chromium/public/WebSharedWorkerRepository.h new file mode 100644 index 000000000..0611b0773 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSharedWorkerRepository.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSharedWorkerRepository_h +#define WebSharedWorkerRepository_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebString; +class WebSharedWorker; +class WebURL; + +class WebSharedWorkerRepository { +public: + // Unique identifier for the parent document of a worker (unique within a given process). + typedef unsigned long long DocumentID; + + // Tracks a newly-created SharedWorker via the repository. + virtual void addSharedWorker(WebSharedWorker*, DocumentID) = 0; + + // Invoked when a document has been detached. DocumentID can be re-used after documentDetached() is invoked. + virtual void documentDetached(DocumentID) = 0; + + // Returns true if the passed document is associated with any SharedWorkers. + virtual bool hasSharedWorkers(DocumentID) = 0; +}; + +} // namespace WebKit + +#endif // WebSharedWorkerRepository_h diff --git a/Source/WebKit/chromium/public/WebSocket.h b/Source/WebKit/chromium/public/WebSocket.h new file mode 100644 index 000000000..f00b7957a --- /dev/null +++ b/Source/WebKit/chromium/public/WebSocket.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSocket_h +#define WebSocket_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { class WebSocketChannel; } + +namespace WebKit { + +class WebData; +class WebDocument; +class WebString; +class WebURL; +class WebSocketClient; + +class WebSocket { +public: + enum CloseEventCode { + CloseEventCodeNotSpecified = -1, + CloseEventCodeNormalClosure = 1000, + CloseEventCodeGoingAway = 1001, + CloseEventCodeProtocolError = 1002, + CloseEventCodeUnsupportedData = 1003, + CloseEventCodeFrameTooLarge = 1004, + CloseEventCodeNoStatusRcvd = 1005, + CloseEventCodeAbnormalClosure = 1006, + CloseEventCodeInvalidUTF8 = 1007, + CloseEventCodeMinimumUserDefined = 3000, + CloseEventCodeMaximumUserDefined = 4999 + }; + + WEBKIT_EXPORT static WebSocket* create(const WebDocument&, WebSocketClient*); + virtual ~WebSocket() { } + + virtual void connect(const WebURL&, const WebString& protocol) = 0; + virtual WebString subprotocol() = 0; + virtual bool sendText(const WebString& message) = 0; + virtual bool sendBinary(const WebData& binaryData) = 0; + virtual unsigned long bufferedAmount() const = 0; + virtual void close(int code, const WebString& reason) = 0; + virtual void fail(const WebString& reason) = 0; + virtual void disconnect() = 0; +}; + +} // namespace WebKit + +#endif // WebSocket_h diff --git a/Source/WebKit/chromium/public/WebSocketClient.h b/Source/WebKit/chromium/public/WebSocketClient.h new file mode 100644 index 000000000..b3a856bd2 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSocketClient.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSocketClient_h +#define WebSocketClient_h + +#include "platform/WebCommon.h" +#include "platform/WebData.h" + +namespace WebKit { + +class WebString; + +class WebSocketClient { +public: + enum ClosingHandshakeCompletionStatus { + ClosingHandshakeIncomplete, + ClosingHandshakeComplete + }; + + virtual ~WebSocketClient() { } + virtual void didConnect() { } + virtual void didReceiveMessage(const WebString& message) { } + virtual void didReceiveBinaryData(const WebData& binaryData) { } + virtual void didReceiveMessageError() { } + virtual void didUpdateBufferedAmount(unsigned long bufferedAmount) { } + virtual void didStartClosingHandshake() { } + virtual void didClose(unsigned long bufferedAmount, ClosingHandshakeCompletionStatus, unsigned short code, const WebString& reason) { } +}; + +} // namespace WebKit + +#endif // WebSocketClient_h diff --git a/Source/WebKit/chromium/public/WebSpeechInputController.h b/Source/WebKit/chromium/public/WebSpeechInputController.h new file mode 100644 index 000000000..ed930dc2b --- /dev/null +++ b/Source/WebKit/chromium/public/WebSpeechInputController.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSpeechInputController_h +#define WebSpeechInputController_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +struct WebRect; +class WebSecurityOrigin; +class WebString; + +// Provides an embedder API called by WebKit. +class WebSpeechInputController { +public: + // Starts speech recognition. Speech will get recorded until the endpointer detects silence, + // runs to the limit or stopRecording is called. Progress indications and the recognized + // text are returned via the listener interface. + virtual bool startRecognition(int requestId, const WebRect& elementRect, const WebString& language, const WebString& grammar, const WebSecurityOrigin& origin) + { + WEBKIT_ASSERT_NOT_REACHED(); + return false; + } + + // Cancels an ongoing recognition and discards any audio recorded so far. No partial + // recognition results are returned to the listener. + virtual void cancelRecognition(int) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Stops audio recording and performs recognition with the audio recorded until now + // (does not discard audio). This is an optional call and is typically invoked if the user + // wants to stop recording audio as soon as they finished speaking. Otherwise, the speech + // recording 'endpointer' should detect silence in the input and stop recording automatically. + // Call startRecognition() to record audio and recognize speech again. + virtual void stopRecording(int) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + virtual ~WebSpeechInputController() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputController_h diff --git a/Source/WebKit/chromium/public/WebSpeechInputControllerMock.h b/Source/WebKit/chromium/public/WebSpeechInputControllerMock.h new file mode 100644 index 000000000..d4e543f02 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSpeechInputControllerMock.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSpeechInputControllerMock_h +#define WebSpeechInputControllerMock_h + +#include "WebSpeechInputController.h" + +namespace WebKit { + +class WebString; +class WebSpeechInputListener; + +class WebSpeechInputControllerMock : public WebSpeechInputController { +public: + WEBKIT_EXPORT static WebSpeechInputControllerMock* create( + WebSpeechInputListener* listener); + virtual ~WebSpeechInputControllerMock() { } + + virtual void addMockRecognitionResult(const WebString& result, double confidence, const WebString& language) = 0; + + virtual void clearResults() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebSpeechInputListener.h b/Source/WebKit/chromium/public/WebSpeechInputListener.h new file mode 100644 index 000000000..091f984cf --- /dev/null +++ b/Source/WebKit/chromium/public/WebSpeechInputListener.h @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSpeechInputListener_h +#define WebSpeechInputListener_h + +#include "WebSpeechInputResult.h" + +namespace WebKit { + +class WebString; + +// Provides a WebKit API called by the embedder. +// A typical sequence of calls to the listener would be +// 1 call to didCompleteRecording +// 0 or more calls to setRecognitionResult +// 1 call to didCompleteRecognition +class WebSpeechInputListener { +public: + // Informs that audio recording has completed and recognition is underway. This gets invoked + // irrespective of whether recording was stopped automatically by the 'endpointer' or if + // WebSpeechInputController::stopRecording() was called. + // Typically after this call the listener would update the UI to reflect that recognition is + // in progress. + virtual void didCompleteRecording(int) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Gives results from speech recognition, either partial or the final results. + // This method can potentially get called multiple times if there are partial results + // available as the user keeps speaking. If the speech could not be recognized properly + // or if there was any other errors in the process, this method may never be called. + virtual void setRecognitionResult(int, const WebSpeechInputResultArray&) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Informs that speech recognition has completed. This gets invoked irrespective of whether + // recognition was succesful or not, whether setRecognitionResult() was invoked or not. The + // handler typically frees up any temporary resources allocated and waits for the next speech + // recognition request. + virtual void didCompleteRecognition(int) { WEBKIT_ASSERT_NOT_REACHED(); } + +protected: + ~WebSpeechInputListener() { } +}; + +} // namespace WebKit + +#endif // WebSpeechInputListener_h diff --git a/Source/WebKit/chromium/public/WebSpeechInputResult.h b/Source/WebKit/chromium/public/WebSpeechInputResult.h new file mode 100644 index 000000000..a316fd230 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSpeechInputResult.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebSpeechInputResult_h +#define WebSpeechInputResult_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebCore { +class SpeechInputResult; +} + +namespace WebKit { + +// This class holds one speech recognition result including the text and other related +// fields, as received from the embedder. +class WebSpeechInputResult { +public: + WebSpeechInputResult() { } + ~WebSpeechInputResult() { reset(); } + + WEBKIT_EXPORT void set(const WebString& utterance, double confidence); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebSpeechInputResult(const WTF::PassRefPtr<WebCore::SpeechInputResult>&); + operator WTF::PassRefPtr<WebCore::SpeechInputResult>() const; +#endif + +private: + WebPrivatePtr<WebCore::SpeechInputResult> m_private; +}; + +typedef WebVector<WebSpeechInputResult> WebSpeechInputResultArray; + +} // namespace WebKit + +#endif // WebSpeechInputResult_h diff --git a/Source/WebKit/chromium/public/WebSpellCheckClient.h b/Source/WebKit/chromium/public/WebSpellCheckClient.h new file mode 100644 index 000000000..457bd13c9 --- /dev/null +++ b/Source/WebKit/chromium/public/WebSpellCheckClient.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSpellCheckClient_h +#define WebSpellCheckClient_h + +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebString; +class WebTextCheckingCompletion; + +class WebSpellCheckClient { +public: + // The client should perform spell-checking on the given text. If the + // text contains a misspelled word, then upon return misspelledOffset + // will point to the start of the misspelled word, and misspelledLength + // will indicates its length. Otherwise, if there was not a spelling + // error, then upon return misspelledLength is 0. If optional_suggestions + // is given, then it will be filled with suggested words (not a cheap step). + virtual void spellCheck(const WebString& text, + int& misspelledOffset, + int& misspelledLength, + WebVector<WebString>* optionalSuggestions) { } + // Requests asynchronous spelling and grammar checking, whose result should be + // returned by passed completion object. + virtual void requestCheckingOfText(const WebString&, WebTextCheckingCompletion*) { } + + // Computes an auto-corrected replacement for a misspelled word. If no + // replacement is found, then an empty string is returned. + virtual WebString autoCorrectWord(const WebString& misspelledWord) { return WebString(); } + + // Show or hide the spelling UI. + virtual void showSpellingUI(bool show) { } + + // Returns true if the spelling UI is showing. + virtual bool isShowingSpellingUI() { return false; } + + // Update the spelling UI with the given word. + virtual void updateSpellingUIWithMisspelledWord(const WebString& word) { } + +protected: + ~WebSpellCheckClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebStorageArea.h b/Source/WebKit/chromium/public/WebStorageArea.h new file mode 100644 index 000000000..cb5ee8d36 --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageArea.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageArea_h +#define WebStorageArea_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebURL; + +// In WebCore, there's one distinct StorageArea per origin per StorageNamespace. This +// class wraps a StorageArea. All the methods have obvious connections to the spec: +// http://dev.w3.org/html5/webstorage/ +class WebStorageArea { +public: + virtual ~WebStorageArea() { } + + enum Result { + ResultOK = 0, + ResultBlockedByQuota + }; + + // The number of key/value pairs in the storage area. + virtual unsigned length() = 0; + + // Get a value for a specific key. Valid key indices are 0 through length() - 1. + // Indexes may change on any set/removeItem call. Will return null if the index + // provided is out of range. + virtual WebString key(unsigned index) = 0; + + // Get the value that corresponds to a specific key. This returns null if there is + // no entry for that key. + virtual WebString getItem(const WebString& key) = 0; + + // Set the value that corresponds to a specific key. Result will either be ResultOK + // or some particular error. The value is NOT set when there's an error. url is the + // url that should be used if a storage event fires. + virtual void setItem(const WebString& key, const WebString& newValue, const WebURL&, Result&, WebString& oldValue) = 0; + + // Remove the value associated with a particular key. url is the url that should be used + // if a storage event fires. + virtual void removeItem(const WebString& key, const WebURL& url, WebString& oldValue) = 0; + + // Clear all key/value pairs. url is the url that should be used if a storage event fires. + virtual void clear(const WebURL& url, bool& somethingCleared) = 0; +}; + +} // namespace WebKit + +#endif // WebStorageArea_h diff --git a/Source/WebKit/chromium/public/WebStorageEventDispatcher.h b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h new file mode 100644 index 000000000..88d333a93 --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageEventDispatcher.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageEventDispatcher_h +#define WebStorageEventDispatcher_h + +#include "platform/WebString.h" + +namespace WebKit { + +class WebURL; + +// This is used to dispatch storage events to all pages. +// FIXME: Make this (or something) work for SessionStorage! +class WebStorageEventDispatcher { +public: + WEBKIT_EXPORT static WebStorageEventDispatcher* create(); + + virtual ~WebStorageEventDispatcher() { } + + // Dispatch the actual event. Doesn't yet work for SessionStorage. + virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, + const WebString& newValue, const WebString& origin, + const WebURL& url, bool isLocalStorage) = 0; +}; + +} // namespace WebKit + +#endif // WebStorageEventDispatcher_h diff --git a/Source/WebKit/chromium/public/WebStorageNamespace.h b/Source/WebKit/chromium/public/WebStorageNamespace.h new file mode 100644 index 000000000..bb748d958 --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageNamespace.h @@ -0,0 +1,80 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageNamespace_h +#define WebStorageNamespace_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebStorageArea; +class WebString; + +// WebStorageNamespace represents a collection of StorageAreas. Typically, you'll have +// multiple StorageNamespaces to represent the SessionStorage for each tab and a single +// StorageNamespace to represent LocalStorage for the entire browser. +class WebStorageNamespace { +public: + // Create a new WebStorageNamespace. LocalStorageNamespaces require a path to specify + // where the SQLite databases that make LocalStorage data persistent are located. + // If path is empty, data will not persist. You should call delete on the returned + // object when you're finished. + WEBKIT_EXPORT static WebStorageNamespace* createLocalStorageNamespace(const WebString& backingDirectoryPath, unsigned quota); + WEBKIT_EXPORT static WebStorageNamespace* createSessionStorageNamespace(unsigned quota); + + // The quota for each storage area. Suggested by the spec. + static const unsigned m_localStorageQuota = 5 * 1024 * 1024; + + // Since SessionStorage memory is allocated in the browser process, we place a + // per-origin quota on it. Like LocalStorage there are known attacks against + // this, so it's more of a sanity check than a real security measure. + static const unsigned m_sessionStorageQuota = 5 * 1024 * 1024; + + static const unsigned noQuota = UINT_MAX; + + virtual ~WebStorageNamespace() { } + + // Create a new WebStorageArea object. Two subsequent calls with the same origin + // will return two different WebStorageArea objects that share the same backing store. + // You should call delete on the returned object when you're finished. + virtual WebStorageArea* createStorageArea(const WebString& origin) = 0; + + // Copy a StorageNamespace. This only makes sense in the case of SessionStorage. + virtual WebStorageNamespace* copy() = 0; + + // Shutdown the StorageNamespace. Write all StorageArea's to disk and disallow new + // write activity. + virtual void close() = 0; +}; + +} // namespace WebKit + +#endif // WebStorageNamespace_h diff --git a/Source/WebKit/chromium/public/WebStorageQuotaCallbacks.h b/Source/WebKit/chromium/public/WebStorageQuotaCallbacks.h new file mode 100644 index 000000000..ee7dc5e35 --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageQuotaCallbacks.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageQuotaCallbacks_h +#define WebStorageQuotaCallbacks_h + +#include "WebStorageQuotaError.h" + +namespace WebKit { + +class WebStorageQuotaCallbacks { +public: + // Callback for WebFrameClient::queryStorageUsageAndQuota. + virtual void didQueryStorageUsageAndQuota(unsigned long long usageInBytes, unsigned long long quotaInBytes) = 0; + + // Callback for WebFrameClient::requestStorageQuota. + // This may return a smaller amount of quota than the requested. + virtual void didGrantStorageQuota(unsigned long long grantedQuotaInBytes) = 0; + + virtual void didFail(WebStorageQuotaError) = 0; + +protected: + virtual ~WebStorageQuotaCallbacks() { } +}; + +} // namespace WebKit + +#endif // WebStorageQuotaCallbacks_h diff --git a/Source/WebKit/chromium/public/WebStorageQuotaError.h b/Source/WebKit/chromium/public/WebStorageQuotaError.h new file mode 100644 index 000000000..13e5c038b --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageQuotaError.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageQuotaError_h +#define WebStorageQuotaError_h + +namespace WebKit { + +// The error code used for WebStorageQuota. +enum WebStorageQuotaError { + WebStorageQuotaErrorNotSupported = 9, + WebStorageQuotaErrorAbort = 20, +}; + +} // namespace WebKit + +#endif // WebStorageQuotaError_h diff --git a/Source/WebKit/chromium/public/WebStorageQuotaType.h b/Source/WebKit/chromium/public/WebStorageQuotaType.h new file mode 100644 index 000000000..b18caf8cb --- /dev/null +++ b/Source/WebKit/chromium/public/WebStorageQuotaType.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebStorageQuotaType_h +#define WebStorageQuotaType_h + +namespace WebKit { + +enum WebStorageQuotaType { + WebStorageQuotaTypeTemporary, + WebStorageQuotaTypePersistent, +}; + +} // namespace WebKit + +#endif // WebStorageQuotaType_h diff --git a/Source/WebKit/chromium/public/WebTestingSupport.h b/Source/WebKit/chromium/public/WebTestingSupport.h new file mode 100644 index 000000000..fb0814048 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTestingSupport.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebTestingSupport_h +#define WebTestingSupport_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebFrame; + +class WebTestingSupport { +public: + WEBKIT_EXPORT static void injectInternalsObject(WebFrame*); + WEBKIT_EXPORT static void resetInternalsObject(WebFrame*); +}; + +} + +#endif diff --git a/Source/WebKit/chromium/public/WebTextAffinity.h b/Source/WebKit/chromium/public/WebTextAffinity.h new file mode 100644 index 000000000..1224f6196 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextAffinity.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextAffinity_h +#define WebTextAffinity_h + +namespace WebKit { + +// These constants specify the preferred direction of selection. +enum WebTextAffinity { + WebTextAffinityUpstream, // The selection is moving toward the top of the document. + WebTextAffinityDownstream, // The selection is moving toward the bottom of the document. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextCaseSensitivity.h b/Source/WebKit/chromium/public/WebTextCaseSensitivity.h new file mode 100644 index 000000000..ae5860c51 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextCaseSensitivity.h @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextCaseSensitivity_h +#define WebTextCaseSensitivity_h + +namespace WebKit { + +// These constants specify the preferred case sensitivity. +enum WebTextCaseSensitivity { + WebTextCaseSensitive, // String matching is case-sensitive. + WebTextCaseInsensitive, // String matching is case-insensitive. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextCheckingCompletion.h b/Source/WebKit/chromium/public/WebTextCheckingCompletion.h new file mode 100644 index 000000000..32701e4c7 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextCheckingCompletion.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextCheckingCompletion_h +#define WebTextCheckingCompletion_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +struct WebTextCheckingResult; +template <typename T> class WebVector; + +// Gets called back when WebViewClient finished an asynchronous spell checking. +class WebTextCheckingCompletion { +public: + virtual void didFinishCheckingText(const WebVector<WebTextCheckingResult>&) = 0; +protected: + ~WebTextCheckingCompletion() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextCheckingResult.h b/Source/WebKit/chromium/public/WebTextCheckingResult.h new file mode 100644 index 000000000..010aa1abf --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextCheckingResult.h @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextCheckingResult_h +#define WebTextCheckingResult_h + +#include "platform/WebCommon.h" + +namespace WebKit { + +// A checked entry of text checking. +struct WebTextCheckingResult { + enum Error { + ErrorSpelling = 1 << 0, + ErrorGrammar = 1 << 1 + }; + + explicit WebTextCheckingResult(Error e = ErrorSpelling, int p = 0, int l = 0) + : error(e) + , position(p) + , length(l) + { + } + + Error error; + int position; + int length; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextDirection.h b/Source/WebKit/chromium/public/WebTextDirection.h new file mode 100644 index 000000000..3d5129608 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextDirection.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextDirection_h +#define WebTextDirection_h + +namespace WebKit { + +// Represents text directions (or writing directions) of a DOM node. +enum WebTextDirection { + WebTextDirectionDefault, // Natural writing direction ("inherit") + WebTextDirectionLeftToRight, + WebTextDirectionRightToLeft, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextInputType.h b/Source/WebKit/chromium/public/WebTextInputType.h new file mode 100644 index 000000000..428cf5549 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextInputType.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextInputType_h +#define WebTextInputType_h + +namespace WebKit { + +enum WebTextInputType { + // Input caret is not in an editable node, no input method shall be used. + WebTextInputTypeNone, + + // Input caret is in a normal editable node, any input method can be used. + WebTextInputTypeText, + + // Input caret is in a specific input field, and input method may be used + // only if it's suitable for the specific input field. + WebTextInputTypePassword, + WebTextInputTypeSearch, + WebTextInputTypeEmail, + WebTextInputTypeNumber, + WebTextInputTypeTelephone, + WebTextInputTypeURL, +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTextRun.h b/Source/WebKit/chromium/public/WebTextRun.h new file mode 100644 index 000000000..b7a57ae69 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTextRun.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTextRun_h +#define WebTextRun_h + +#include "platform/WebString.h" + +#ifdef WEBKIT_IMPLEMENTATION +namespace WebCore { class TextRun; } +#endif + +namespace WebKit { + +struct WebTextRun { + WebTextRun(const WebString& t, bool isRTL, bool hasDirectionalOverride) + : text(t) + , rtl(isRTL) + , directionalOverride(hasDirectionalOverride) + { + } + WebTextRun() + : rtl(false) + , directionalOverride(false) + { + } + + WebString text; + bool rtl; + bool directionalOverride; + +#ifdef WEBKIT_IMPLEMENTATION + // The resulting WebCore::TextRun will refer to the text in this + // struct, so "this" must outlive the WebCore text run. + operator WebCore::TextRun() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebTouchPoint.h b/Source/WebKit/chromium/public/WebTouchPoint.h new file mode 100644 index 000000000..1b20f8578 --- /dev/null +++ b/Source/WebKit/chromium/public/WebTouchPoint.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebTouchPoint_h +#define WebTouchPoint_h + +#include "platform/WebPoint.h" +#include "platform/WebCommon.h" + +namespace WebKit { + +class WebTouchPoint { +public: + WebTouchPoint() + : id(0) + , state(StateUndefined) + , radiusX(0) + , radiusY(0) + , rotationAngle(0) + , force(0) + { + } + + enum State { + StateUndefined, + StateReleased, + StatePressed, + StateMoved, + StateStationary, + StateCancelled, + }; + + int id; + State state; + WebPoint screenPosition; + WebPoint position; + + int radiusX; + int radiusY; + float rotationAngle; + float force; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebURLLoaderOptions.h b/Source/WebKit/chromium/public/WebURLLoaderOptions.h new file mode 100644 index 000000000..114039241 --- /dev/null +++ b/Source/WebKit/chromium/public/WebURLLoaderOptions.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009, 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLLoaderOptions_h +#define WebURLLoaderOptions_h + +namespace WebKit { + +struct WebURLLoaderOptions { + + enum CrossOriginRequestPolicy { + CrossOriginRequestPolicyDeny, + CrossOriginRequestPolicyUseAccessControl, + CrossOriginRequestPolicyAllow + }; + + WebURLLoaderOptions() + : untrustedHTTP(false) + , sniffContent(false) + , allowCredentials(false) + , forcePreflight(false) + , crossOriginRequestPolicy(CrossOriginRequestPolicyDeny) + { } + + bool untrustedHTTP; // Whether to validate the method and headers as if this was an XMLHttpRequest. + bool sniffContent; // Whether to sniff content. + bool allowCredentials; // Whether to send HTTP credentials and cookies with the request. + bool forcePreflight; // If policy is to use access control, whether to force a preflight for GET, HEAD, and POST requests. + CrossOriginRequestPolicy crossOriginRequestPolicy; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebUserMediaClient.h b/Source/WebKit/chromium/public/WebUserMediaClient.h new file mode 100644 index 000000000..a4b75e940 --- /dev/null +++ b/Source/WebKit/chromium/public/WebUserMediaClient.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebUserMediaClient_h +#define WebUserMediaClient_h + +namespace WebKit { + +class WebMediaStreamSource; +class WebUserMediaRequest; +template <typename T> class WebVector; + +class WebUserMediaClient { +public: + virtual ~WebUserMediaClient() { } + + virtual void requestUserMedia(const WebUserMediaRequest&, const WebVector<WebMediaStreamSource>&) = 0; + virtual void cancelUserMediaRequest(const WebUserMediaRequest&) = 0; +}; + +} // namespace WebKit + +#endif // WebUserMediaClient_h diff --git a/Source/WebKit/chromium/public/WebUserMediaRequest.h b/Source/WebKit/chromium/public/WebUserMediaRequest.h new file mode 100644 index 000000000..ab88125d6 --- /dev/null +++ b/Source/WebKit/chromium/public/WebUserMediaRequest.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebUserMediaRequest_h +#define WebUserMediaRequest_h + +#include "platform/WebCommon.h" +#include "platform/WebPrivatePtr.h" + +namespace WebCore { +class UserMediaRequest; +} + +namespace WebKit { + +class WebMediaStreamSource; +class WebSecurityOrigin; +class WebString; +template <typename T> class WebVector; + +class WebUserMediaRequest { +public: + WebUserMediaRequest() { } + WebUserMediaRequest(const WebUserMediaRequest& request) { assign(request); } + ~WebUserMediaRequest() { reset(); } + + WebUserMediaRequest& operator=(const WebUserMediaRequest& other) + { + assign(other); + return *this; + } + + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + WEBKIT_EXPORT bool equals(const WebUserMediaRequest&) const; + WEBKIT_EXPORT void assign(const WebUserMediaRequest&); + + WEBKIT_EXPORT bool audio() const; + WEBKIT_EXPORT bool video() const; + WEBKIT_EXPORT bool cameraPreferenceUser() const; + WEBKIT_EXPORT bool cameraPreferenceEnvironment() const; + WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const; + + WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>&); + WEBKIT_EXPORT void requestFailed(); + +#if WEBKIT_IMPLEMENTATION + WebUserMediaRequest(const PassRefPtr<WebCore::UserMediaRequest>&); + operator WebCore::UserMediaRequest*() const; +#endif + +private: + WebPrivatePtr<WebCore::UserMediaRequest> m_private; +}; + +inline bool operator==(const WebUserMediaRequest& a, const WebUserMediaRequest& b) +{ + return a.equals(b); +} + +} // namespace WebKit + +#endif // WebUserMediaRequest_h diff --git a/Source/WebKit/chromium/public/WebVideoFrame.h b/Source/WebKit/chromium/public/WebVideoFrame.h new file mode 100644 index 000000000..8e3b2cdbd --- /dev/null +++ b/Source/WebKit/chromium/public/WebVideoFrame.h @@ -0,0 +1,68 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebVideoFrame_h +#define WebVideoFrame_h + +namespace WebKit { + +// A proxy video frame interface to communicate frame data between chromium +// and WebKit. +class WebVideoFrame { +public: + enum Format { + FormatInvalid, + FormatRGB555, + FormatRGB565, + FormatRGB24, + FormatRGB32, + FormatRGBA, + FormatYV12, + FormatYV16, + FormatNV12, + FormatEmpty, + FormatASCII, + FormatI420, + FormatNativeTexture, + }; + + virtual ~WebVideoFrame() { } + virtual Format format() const { return FormatInvalid; } + virtual unsigned width() const { return 0; } + virtual unsigned height() const { return 0; } + virtual unsigned planes() const { return 0; } + virtual int stride(unsigned plane) const { return 0; } + virtual const void* data(unsigned plane) const { return 0; } + virtual unsigned textureId() const { return 0; } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h new file mode 100644 index 000000000..1f8530ff8 --- /dev/null +++ b/Source/WebKit/chromium/public/WebView.h @@ -0,0 +1,459 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebView_h +#define WebView_h + +#include "WebDragOperation.h" +#include "WebPageVisibilityState.h" +#include "WebWidget.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +namespace WebKit { + +class WebAccessibilityObject; +class WebAutofillClient; +class WebDevToolsAgent; +class WebDevToolsAgentClient; +class WebDragData; +class WebFrame; +class WebFrameClient; +class WebGraphicsContext3D; +class WebNode; +class WebPageOverlay; +class WebPermissionClient; +class WebSettings; +class WebSpellCheckClient; +class WebString; +class WebViewClient; +struct WebMediaPlayerAction; +struct WebPoint; + +class WebView : public WebWidget { +public: + WEBKIT_EXPORT static const double textSizeMultiplierRatio; + WEBKIT_EXPORT static const double minTextSizeMultiplier; + WEBKIT_EXPORT static const double maxTextSizeMultiplier; + WEBKIT_EXPORT static const float minPageScaleFactor; + WEBKIT_EXPORT static const float maxPageScaleFactor; + + // Controls the time that user scripts injected into the document run. + enum UserScriptInjectAt { + UserScriptInjectAtDocumentStart, + UserScriptInjectAtDocumentEnd + }; + + // Controls which frames user content is injected into. + enum UserContentInjectIn { + UserContentInjectInAllFrames, + UserContentInjectInTopFrameOnly + }; + + // Controls which documents user styles are injected into. + enum UserStyleInjectionTime { + UserStyleInjectInExistingDocuments, + UserStyleInjectInSubsequentDocuments + }; + + + // Initialization ------------------------------------------------------ + + // Creates a WebView that is NOT yet initialized. You will need to + // call initializeMainFrame to finish the initialization. It is valid + // to pass null client pointers. + WEBKIT_EXPORT static WebView* create(WebViewClient*); + + // After creating a WebView, you should immediately call this method. + // You can optionally modify the settings before calling this method. + // The WebFrameClient will receive events for the main frame and any + // child frames. It is valid to pass a null WebFrameClient pointer. + virtual void initializeMainFrame(WebFrameClient*) = 0; + + // Initializes the various client interfaces. + virtual void setAutofillClient(WebAutofillClient*) = 0; + virtual void setDevToolsAgentClient(WebDevToolsAgentClient*) = 0; + virtual void setPermissionClient(WebPermissionClient*) = 0; + virtual void setSpellCheckClient(WebSpellCheckClient*) = 0; + + + // Options ------------------------------------------------------------- + + // The returned pointer is valid for the lifetime of the WebView. + virtual WebSettings* settings() = 0; + + // Corresponds to the encoding of the main frame. Setting the page + // encoding may cause the main frame to reload. + virtual WebString pageEncoding() const = 0; + virtual void setPageEncoding(const WebString&) = 0; + + // Makes the WebView transparent. This is useful if you want to have + // some custom background rendered behind it. + virtual bool isTransparent() const = 0; + virtual void setIsTransparent(bool) = 0; + + // Controls whether pressing Tab key advances focus to links. + virtual bool tabsToLinks() const = 0; + virtual void setTabsToLinks(bool) = 0; + + // Method that controls whether pressing Tab key cycles through page + // elements or inserts a '\t' char in the focused text area. + virtual bool tabKeyCyclesThroughElements() const = 0; + virtual void setTabKeyCyclesThroughElements(bool) = 0; + + // Controls the WebView's active state, which may affect the rendering + // of elements on the page (i.e., tinting of input elements). + virtual bool isActive() const = 0; + virtual void setIsActive(bool) = 0; + + // Allows disabling domain relaxation. + virtual void setDomainRelaxationForbidden(bool, const WebString& scheme) = 0; + + + // Closing ------------------------------------------------------------- + + // Runs beforeunload handlers for the current page, returning false if + // any handler suppressed unloading. + virtual bool dispatchBeforeUnloadEvent() = 0; + + // Runs unload handlers for the current page. + virtual void dispatchUnloadEvent() = 0; + + + // Frames -------------------------------------------------------------- + + virtual WebFrame* mainFrame() = 0; + + // Returns the frame identified by the given name. This method + // supports pseudo-names like _self, _top, and _blank. It traverses + // the entire frame tree containing this tree looking for a frame that + // matches the given name. If the optional relativeToFrame parameter + // is specified, then the search begins with the given frame and its + // children. + virtual WebFrame* findFrameByName( + const WebString& name, WebFrame* relativeToFrame = 0) = 0; + + + // Focus --------------------------------------------------------------- + + virtual WebFrame* focusedFrame() = 0; + virtual void setFocusedFrame(WebFrame*) = 0; + + // Focus the first (last if reverse is true) focusable node. + virtual void setInitialFocus(bool reverse) = 0; + + // Clears the focused node (and selection if a text field is focused) + // to ensure that a text field on the page is not eating keystrokes we + // send it. + virtual void clearFocusedNode() = 0; + + // Scrolls the node currently in focus into view. + virtual void scrollFocusedNodeIntoView() = 0; + + // Scrolls the node currently in focus into |rect|, where |rect| is in + // window space. + virtual void scrollFocusedNodeIntoRect(const WebRect&) { } + + + // Zoom ---------------------------------------------------------------- + + // Returns the current zoom level. 0 is "original size", and each increment + // above or below represents zooming 20% larger or smaller to default limits + // of 300% and 50% of original size, respectively. Only plugins use + // non whole-numbers, since they might choose to have specific zoom level so + // that fixed-width content is fit-to-page-width, for example. + virtual double zoomLevel() = 0; + + // Changes the zoom level to the specified level, clamping at the limits + // noted above, and returns the current zoom level after applying the + // change. + // + // If |textOnly| is set, only the text will be zoomed; otherwise the entire + // page will be zoomed. You can only have either text zoom or full page zoom + // at one time. Changing the mode while the page is zoomed will have odd + // effects. + virtual double setZoomLevel(bool textOnly, double zoomLevel) = 0; + + // Updates the zoom limits for this view. + virtual void zoomLimitsChanged(double minimumZoomLevel, + double maximumZoomLevel) = 0; + + // Helper functions to convert between zoom level and zoom factor. zoom + // factor is zoom percent / 100, so 300% = 3.0. + WEBKIT_EXPORT static double zoomLevelToZoomFactor(double zoomLevel); + WEBKIT_EXPORT static double zoomFactorToZoomLevel(double factor); + + // Gets the scale factor of the page, where 1.0 is the normal size, > 1.0 + // is scaled up, < 1.0 is scaled down. + virtual float pageScaleFactor() const = 0; + + // Indicates whether the page scale factor has been set since navigating + // to a new page. + virtual bool isPageScaleFactorSet() const = 0; + + // Scales the page and the scroll offset by a given factor, while ensuring + // that the new scroll position does not go beyond the edge of the page. + virtual void setPageScaleFactorPreservingScrollOffset(float) = 0; + + // Scales a page by a factor of scaleFactor and then sets a scroll position to (x, y). + // setPageScaleFactor() magnifies and shrinks a page without affecting layout. + // On the other hand, zooming affects layout of the page. + virtual void setPageScaleFactor(float scaleFactor, const WebPoint& origin) = 0; + + // PageScaleFactor will be force-clamped between minPageScale and maxPageScale + // (and these values will persist until setPageScaleFactorLimits is called + // again). + virtual void setPageScaleFactorLimits(float minPageScale, float maxPageScale) = 0; + + virtual float minimumPageScaleFactor() const = 0; + virtual float maximumPageScaleFactor() const = 0; + + // The ratio of the current device's screen DPI to the target device's screen DPI. + virtual float deviceScaleFactor() const = 0; + + // Sets the ratio as computed by computeViewportAttributes. + virtual void setDeviceScaleFactor(float) = 0; + + // Indicates whether position:fixed elements should be laid out relative + // to the frame or relative to the page. + virtual bool shouldLayoutFixedElementsRelativeToFrame() const = 0; + + // Sets the relative layout of position:fixed elements. + virtual void setShouldLayoutFixedElementsRelativeToFrame(bool) = 0; + + + // Fixed Layout -------------------------------------------------------- + + // In fixed layout mode, the layout of the page is independent of the + // view port size, given by WebWidget::size(). + + virtual bool isFixedLayoutModeEnabled() const = 0; + virtual void enableFixedLayoutMode(bool enable) = 0; + + virtual WebSize fixedLayoutSize() const = 0; + virtual void setFixedLayoutSize(const WebSize&) = 0; + + + // Auto-Resize ----------------------------------------------------------- + + // In auto-resize mode, the view is automatically adjusted to fit the html + // content within the given bounds. + virtual void enableAutoResizeMode( + bool enable, + const WebSize& minSize, + const WebSize& maxSize) = 0; + + + // Media --------------------------------------------------------------- + + // Performs the specified action on the node at the given location. + virtual void performMediaPlayerAction( + const WebMediaPlayerAction&, const WebPoint& location) = 0; + + + // Data exchange ------------------------------------------------------- + + // Copy to the clipboard the image located at a particular point in the + // WebView (if there is such an image) + virtual void copyImageAt(const WebPoint&) = 0; + + // Notifies the WebView that a drag has terminated. + virtual void dragSourceEndedAt( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; + + // Notifies the WebView that a drag is going on. + virtual void dragSourceMovedTo( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperation operation) = 0; + + // Notfies the WebView that the system drag and drop operation has ended. + virtual void dragSourceSystemDragEnded() = 0; + + // Callback methods when a drag-and-drop operation is trying to drop + // something on the WebView. + virtual WebDragOperation dragTargetDragEnter( + const WebDragData&, + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed) = 0; + virtual WebDragOperation dragTargetDragOver( + const WebPoint& clientPoint, const WebPoint& screenPoint, + WebDragOperationsMask operationsAllowed) = 0; + virtual void dragTargetDragLeave() = 0; + virtual void dragTargetDrop( + const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; + + + // Support for resource loading initiated by plugins ------------------- + + // Returns next unused request identifier which is unique within the + // parent Page. + virtual unsigned long createUniqueIdentifierForRequest() = 0; + + + // Developer tools ----------------------------------------------------- + + // Inspect a particular point in the WebView. (x = -1 || y = -1) is a + // special case, meaning inspect the current page and not a specific + // point. + virtual void inspectElementAt(const WebPoint&) = 0; + + // Settings used by the inspector. + virtual WebString inspectorSettings() const = 0; + virtual void setInspectorSettings(const WebString&) = 0; + virtual bool inspectorSetting(const WebString& key, + WebString* value) const = 0; + virtual void setInspectorSetting(const WebString& key, + const WebString& value) = 0; + + // The embedder may optionally engage a WebDevToolsAgent. This may only + // be set once per WebView. + virtual WebDevToolsAgent* devToolsAgent() = 0; + + + // Accessibility ------------------------------------------------------- + + // Returns the accessibility object for this view. + virtual WebAccessibilityObject accessibilityObject() = 0; + + + // Autofill ----------------------------------------------------------- + + // Notifies the WebView that Autofill suggestions are available for a node. + // |uniqueIDs| is a vector of IDs that represent the unique ID of each + // Autofill profile in the suggestions popup. If a unique ID is 0, then the + // corresponding suggestion comes from Autocomplete rather than Autofill. + // If a unique ID is negative, then the corresponding "suggestion" is + // actually a user-facing warning, e.g. explaining why Autofill is + // unavailable for the current form. + virtual void applyAutofillSuggestions( + const WebNode&, + const WebVector<WebString>& names, + const WebVector<WebString>& labels, + const WebVector<WebString>& icons, + const WebVector<int>& uniqueIDs, + int separatorIndex) = 0; + + // Hides any popup (suggestions, selects...) that might be showing. + virtual void hidePopups() = 0; + + + // Context menu -------------------------------------------------------- + + virtual void performCustomContextMenuAction(unsigned action) = 0; + + + // Popup menu ---------------------------------------------------------- + + // Sets whether select popup menus should be rendered by the browser. + WEBKIT_EXPORT static void setUseExternalPopupMenus(bool); + + + // Visited link state -------------------------------------------------- + + // Tells all WebView instances to update the visited link state for the + // specified hash. + WEBKIT_EXPORT static void updateVisitedLinkState(unsigned long long hash); + + // Tells all WebView instances to update the visited state for all + // their links. + WEBKIT_EXPORT static void resetVisitedLinkState(); + + + // Custom colors ------------------------------------------------------- + + virtual void setScrollbarColors(unsigned inactiveColor, + unsigned activeColor, + unsigned trackColor) = 0; + + virtual void setSelectionColors(unsigned activeBackgroundColor, + unsigned activeForegroundColor, + unsigned inactiveBackgroundColor, + unsigned inactiveForegroundColor) = 0; + + // User scripts -------------------------------------------------------- + WEBKIT_EXPORT static void addUserScript(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserScriptInjectAt injectAt, + UserContentInjectIn injectIn); + WEBKIT_EXPORT static void addUserStyleSheet(const WebString& sourceCode, + const WebVector<WebString>& patterns, + UserContentInjectIn injectIn, + UserStyleInjectionTime injectionTime = UserStyleInjectInSubsequentDocuments); + WEBKIT_EXPORT static void removeAllUserContent(); + + // Modal dialog support ------------------------------------------------ + + // Call these methods before and after running a nested, modal event loop + // to suspend script callbacks and resource loads. + WEBKIT_EXPORT static void willEnterModalLoop(); + WEBKIT_EXPORT static void didExitModalLoop(); + + // GPU acceleration support -------------------------------------------- + + // Returns the (on-screen) WebGraphicsContext3D associated with + // this WebView. One will be created if it doesn't already exist. + // This is used to set up sharing between this context (which is + // that used by the compositor) and contexts for WebGL and other + // APIs. + virtual WebGraphicsContext3D* graphicsContext3D() = 0; + + // Visibility ----------------------------------------------------------- + + // Sets the visibility of the WebView. + virtual void setVisibilityState(WebPageVisibilityState visibilityState, + bool isInitialState) { } + + // PageOverlay ---------------------------------------------------------- + + // Adds/removes page overlay to this WebView. These functions change the + // graphical appearance of the WebView. WebPageOverlay paints the + // contents of the page overlay. It also provides an z-order number for + // the page overlay. The z-order number defines the paint order the page + // overlays. Page overlays with larger z-order number will be painted after + // page overlays with smaller z-order number. That is, they appear above + // the page overlays with smaller z-order number. If two page overlays have + // the same z-order number, the later added one will be on top. + virtual void addPageOverlay(WebPageOverlay*, int /*z-order*/) = 0; + virtual void removePageOverlay(WebPageOverlay*) = 0; + + // Testing functionality for LayoutTestController ----------------------- + + // Simulates a compositor lost context. + virtual void loseCompositorContext(int numTimes) = 0; + + +protected: + ~WebView() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebViewClient.h b/Source/WebKit/chromium/public/WebViewClient.h new file mode 100644 index 000000000..5a4d4e8e4 --- /dev/null +++ b/Source/WebKit/chromium/public/WebViewClient.h @@ -0,0 +1,350 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebViewClient_h +#define WebViewClient_h + +#include "WebAccessibilityNotification.h" +#include "WebDragOperation.h" +#include "WebEditingAction.h" +#include "WebFileChooserCompletion.h" +#include "WebFileChooserParams.h" +#include "WebPageVisibilityState.h" +#include "WebPopupType.h" +#include "WebTextAffinity.h" +#include "WebTextDirection.h" +#include "WebWidgetClient.h" +#include "platform/WebColor.h" +#include "platform/WebString.h" + +namespace WebKit { + +class WebAccessibilityObject; +class WebColorChooser; +class WebColorChooserClient; +class WebDeviceOrientationClient; +class WebDragData; +class WebElement; +class WebExternalPopupMenu; +class WebExternalPopupMenuClient; +class WebFileChooserCompletion; +class WebFrame; +class WebGeolocationClient; +class WebGeolocationService; +class WebIconLoadingCompletion; +class WebImage; +class WebInputElement; +class WebKeyboardEvent; +class WebNode; +class WebNotificationPresenter; +class WebRange; +class WebSpeechInputController; +class WebSpeechInputListener; +class WebStorageNamespace; +class WebURL; +class WebURLRequest; +class WebUserMediaClient; +class WebView; +class WebWidget; +struct WebConsoleMessage; +struct WebContextMenuData; +struct WebPoint; +struct WebPopupMenuInfo; +struct WebSize; +struct WebWindowFeatures; + +// Since a WebView is a WebWidget, a WebViewClient is a WebWidgetClient. +// Virtual inheritance allows an implementation of WebWidgetClient to be +// easily reused as part of an implementation of WebViewClient. +class WebViewClient : virtual public WebWidgetClient { +public: + // Factory methods ----------------------------------------------------- + + // Create a new related WebView. This method must clone its session storage + // so any subsequent calls to createSessionStorageNamespace conform to the + // WebStorage specification. + // The request parameter is only for the client to check if the request + // could be fulfilled. The client should not load the request. + virtual WebView* createView(WebFrame* creator, + const WebURLRequest& request, + const WebWindowFeatures& features, + const WebString& name) { + return 0; + } + + // Create a new WebPopupMenu. In the second form, the client is + // responsible for rendering the contents of the popup menu. + virtual WebWidget* createPopupMenu(WebPopupType) { return 0; } + virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { return 0; } + virtual WebExternalPopupMenu* createExternalPopupMenu( + const WebPopupMenuInfo&, WebExternalPopupMenuClient*) { return 0; } + + // Create a session storage namespace object associated with this WebView. + virtual WebStorageNamespace* createSessionStorageNamespace(unsigned quota) { return 0; } + + // Misc ---------------------------------------------------------------- + + // A new message was added to the console. + virtual void didAddMessageToConsole( + const WebConsoleMessage&, const WebString& sourceName, unsigned sourceLine) { } + + // Called when script in the page calls window.print(). If frame is + // non-null, then it selects a particular frame, including its + // children, to print. Otherwise, the main frame and its children + // should be printed. + virtual void printPage(WebFrame*) { } + + // Called to retrieve the provider of desktop notifications. + virtual WebNotificationPresenter* notificationPresenter() { return 0; } + + // Called to request an icon for the specified filenames. + // The icon is shown in a file upload control. + virtual bool queryIconForFiles(const WebVector<WebString>& filenames, WebIconLoadingCompletion*) { return false; } + + // This method enumerates all the files in the path. It returns immediately + // and asynchronously invokes the WebFileChooserCompletion with all the + // files in the directory. Returns false if the WebFileChooserCompletion + // will never be called. + virtual bool enumerateChosenDirectory(const WebString& path, WebFileChooserCompletion*) { return false; } + + + // Navigational -------------------------------------------------------- + + // These notifications bracket any loading that occurs in the WebView. + virtual void didStartLoading() { } + virtual void didStopLoading() { } + + // Notification that some progress was made loading the current page. + // loadProgress is a value between 0 (nothing loaded) and 1.0 (frame fully + // loaded). + virtual void didChangeLoadProgress(WebFrame*, double loadProgress) { } + + // Editing ------------------------------------------------------------- + + // These methods allow the client to intercept and overrule editing + // operations. + virtual bool shouldBeginEditing(const WebRange&) { return true; } + virtual bool shouldEndEditing(const WebRange&) { return true; } + virtual bool shouldInsertNode( + const WebNode&, const WebRange&, WebEditingAction) { return true; } + virtual bool shouldInsertText( + const WebString&, const WebRange&, WebEditingAction) { return true; } + virtual bool shouldChangeSelectedRange( + const WebRange& from, const WebRange& to, WebTextAffinity, + bool stillSelecting) { return true; } + virtual bool shouldDeleteRange(const WebRange&) { return true; } + virtual bool shouldApplyStyle(const WebString& style, const WebRange&) { return true; } + + virtual bool isSmartInsertDeleteEnabled() { return true; } + virtual bool isSelectTrailingWhitespaceEnabled() { return true; } + + virtual void didBeginEditing() { } + virtual void didChangeSelection(bool isSelectionEmpty) { } + virtual void didChangeContents() { } + virtual void didExecuteCommand(const WebString& commandName) { } + virtual void didEndEditing() { } + + // This method is called in response to WebView's handleInputEvent() + // when the default action for the current keyboard event is not + // suppressed by the page, to give the embedder a chance to handle + // the keyboard event specially. + // + // Returns true if the keyboard event was handled by the embedder, + // indicating that the default action should be suppressed. + virtual bool handleCurrentKeyboardEvent() { return false; } + + // Dialogs ------------------------------------------------------------- + + // This method opens the color chooser and returns a new WebColorChooser + // instance. If there is a WebColorChooser already from the last time this + // was called, it ends the color chooser by calling endChooser, and replaces + // it with the new one. + virtual WebColorChooser* createColorChooser(WebColorChooserClient*, + const WebColor&) { return 0; } + + // This method returns immediately after showing the dialog. When the + // dialog is closed, it should call the WebFileChooserCompletion to + // pass the results of the dialog. Returns false if + // WebFileChooseCompletion will never be called. + virtual bool runFileChooser(const WebFileChooserParams&, + WebFileChooserCompletion*) { return false; } + + // Displays a modal alert dialog containing the given message. Returns + // once the user dismisses the dialog. + virtual void runModalAlertDialog( + WebFrame*, const WebString& message) { } + + // Displays a modal confirmation dialog with the given message as + // description and OK/Cancel choices. Returns true if the user selects + // 'OK' or false otherwise. + virtual bool runModalConfirmDialog( + WebFrame*, const WebString& message) { return false; } + + // Displays a modal input dialog with the given message as description + // and OK/Cancel choices. The input field is pre-filled with + // defaultValue. Returns true if the user selects 'OK' or false + // otherwise. Upon returning true, actualValue contains the value of + // the input field. + virtual bool runModalPromptDialog( + WebFrame*, const WebString& message, const WebString& defaultValue, + WebString* actualValue) { return false; } + + // Displays a modal confirmation dialog containing the given message as + // description and OK/Cancel choices, where 'OK' means that it is okay + // to proceed with closing the view. Returns true if the user selects + // 'OK' or false otherwise. + virtual bool runModalBeforeUnloadDialog( + WebFrame*, const WebString& message) { return true; } + + + // UI ------------------------------------------------------------------ + + // Called when script modifies window.status + virtual void setStatusText(const WebString&) { } + + // Called when hovering over an anchor with the given URL. + virtual void setMouseOverURL(const WebURL&) { } + + // Called when keyboard focus switches to an anchor with the given URL. + virtual void setKeyboardFocusURL(const WebURL&) { } + + // Shows a context menu with commands relevant to a specific element on + // the given frame. Additional context data is supplied. + virtual void showContextMenu(WebFrame*, const WebContextMenuData&) { } + + // Called when a drag-n-drop operation should begin. + virtual void startDragging( + const WebDragData&, WebDragOperationsMask, const WebImage&, const WebPoint&) { } + + // Called to determine if drag-n-drop operations may initiate a page + // navigation. + virtual bool acceptsLoadDrops() { return true; } + + // Take focus away from the WebView by focusing an adjacent UI element + // in the containing window. + virtual void focusNext() { } + virtual void focusPrevious() { } + + // Called when a new node gets focused. + virtual void focusedNodeChanged(const WebNode&) { } + + virtual void numberOfWheelEventHandlersChanged(unsigned) { } + + // Indicates two things: + // 1) This view may have a new layout now. + // 2) Calling layout() is a no-op. + // After calling WebWidget::layout(), expect to get this notification + // unless the view did not need a layout. + virtual void didUpdateLayout() { } + + // Session history ----------------------------------------------------- + + // Tells the embedder to navigate back or forward in session history by + // the given offset (relative to the current position in session + // history). + virtual void navigateBackForwardSoon(int offset) { } + + // Returns the number of history items before/after the current + // history item. + virtual int historyBackListCount() { return 0; } + virtual int historyForwardListCount() { return 0; } + + // Called to notify the embedder when a new history item is added. + virtual void didAddHistoryItem() { } + + + // Accessibility ------------------------------------------------------- + + // Notifies embedder about an accessibility notification. + virtual void postAccessibilityNotification(const WebAccessibilityObject&, WebAccessibilityNotification) { } + + + // Developer tools ----------------------------------------------------- + + // Called to notify the client that the inspector's settings were + // changed and should be saved. See WebView::inspectorSettings. + virtual void didUpdateInspectorSettings() { } + + virtual void didUpdateInspectorSetting(const WebString& key, const WebString& value) { } + + // Geolocation --------------------------------------------------------- + + // Access the embedder API for (client-based) geolocation client . + virtual WebGeolocationClient* geolocationClient() { return 0; } + // Access the embedder API for (non-client-based) geolocation services. + virtual WebGeolocationService* geolocationService() { return 0; } + + // Speech -------------------------------------------------------------- + + // Access the embedder API for speech input services. + virtual WebSpeechInputController* speechInputController( + WebSpeechInputListener*) { return 0; } + + // Device Orientation -------------------------------------------------- + + // Access the embedder API for device orientation services. + virtual WebDeviceOrientationClient* deviceOrientationClient() { return 0; } + + + // Zoom ---------------------------------------------------------------- + + // Informs the browser that the zoom levels for this frame have changed from + // the default values. + virtual void zoomLimitsChanged(double minimumLevel, double maximumLevel) { } + + // Informs the browser that the zoom level has changed as a result of an + // action that wasn't initiated by the client. + virtual void zoomLevelChanged() { } + + // Registers a new URL handler for the given protocol. + virtual void registerProtocolHandler(const WebString& scheme, + const WebString& baseUrl, + const WebString& url, + const WebString& title) { } + + // Visibility ----------------------------------------------------------- + + // Returns the current visibility of the WebView. + virtual WebPageVisibilityState visibilityState() const + { + return WebPageVisibilityStateVisible; + } + + // Media Streams ------------------------------------------------------- + + virtual WebUserMediaClient* userMediaClient() { return 0; } + +protected: + ~WebViewClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebWidget.h b/Source/WebKit/chromium/public/WebWidget.h new file mode 100644 index 000000000..3f594f369 --- /dev/null +++ b/Source/WebKit/chromium/public/WebWidget.h @@ -0,0 +1,179 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebWidget_h +#define WebWidget_h + +#include "WebCompositionUnderline.h" +#include "WebTextInputType.h" +#include "WebTextDirection.h" +#include "platform/WebCanvas.h" +#include "platform/WebCommon.h" +#include "platform/WebRect.h" +#include "platform/WebSize.h" + +#define WEBKIT_HAS_NEW_FULLSCREEN_API 1 + +namespace WebKit { + +class WebInputEvent; +class WebString; +struct WebPoint; +template <typename T> class WebVector; + +class WebWidget { +public: + // This method closes and deletes the WebWidget. + virtual void close() { } + + // Returns the current size of the WebWidget. + virtual WebSize size() { return WebSize(); } + + // Used to group a series of resize events. For example, if the user + // drags a resizer then willStartLiveResize will be called, followed by a + // sequence of resize events, ending with willEndLiveResize when the user + // lets go of the resizer. + virtual void willStartLiveResize() { } + + // Called to resize the WebWidget. + virtual void resize(const WebSize&) { } + + // Ends a group of resize events that was started with a call to + // willStartLiveResize. + virtual void willEndLiveResize() { } + + // Called to notify the WebWidget of entering/exiting fullscreen mode. The + // resize method may be called between will{Enter,Exit}FullScreen and + // did{Enter,Exit}FullScreen. + virtual void willEnterFullScreen() { } + virtual void didEnterFullScreen() { } + virtual void willExitFullScreen() { } + virtual void didExitFullScreen() { } + + // Called to update imperative animation state. This should be called before + // paint, although the client can rate-limit these calls. When + // frameBeginTime is 0.0, the WebWidget will determine the frame begin time + // itself. + virtual void animate(double frameBeginTime) { } + + // Called to layout the WebWidget. This MUST be called before Paint, + // and it may result in calls to WebWidgetClient::didInvalidateRect. + virtual void layout() { } + + // Called to paint the rectangular region within the WebWidget + // onto the specified canvas at (viewPort.x,viewPort.y). You MUST call + // Layout before calling this method. It is okay to call paint + // multiple times once layout has been called, assuming no other + // changes are made to the WebWidget (e.g., once events are + // processed, it should be assumed that another call to layout is + // warranted before painting again). + virtual void paint(WebCanvas*, const WebRect& viewPort) { } + + // In non-threaded compositing mode, triggers compositing of the current + // layers onto the screen. You MUST call Layout before calling this method, + // for the same reasons described in the paint method above + // + // In threaded compositing mode, indicates that the widget should update + // itself, for example due to window damage. The redraw will begin + // asynchronously and perform layout and animation internally. Do not call + // animate or layout in this case. + virtual void composite(bool finish) = 0; + + // Called to inform the WebWidget of a change in theme. + // Implementors that cache rendered copies of widgets need to re-render + // on receiving this message + virtual void themeChanged() { } + + // Called to inform the WebWidget of an input event. Returns true if + // the event has been processed, false otherwise. + virtual bool handleInputEvent(const WebInputEvent&) { return false; } + + // Called to inform the WebWidget that mouse capture was lost. + virtual void mouseCaptureLost() { } + + // Called to inform the WebWidget that it has gained or lost keyboard focus. + virtual void setFocus(bool) { } + + // Called to inform the WebWidget of a new composition text. + // If selectionStart and selectionEnd has the same value, then it indicates + // the input caret position. If the text is empty, then the existing + // composition text will be cancelled. + // Returns true if the composition text was set successfully. + virtual bool setComposition( + const WebString& text, + const WebVector<WebCompositionUnderline>& underlines, + int selectionStart, + int selectionEnd) { return false; } + + // Called to inform the WebWidget to confirm an ongoing composition. + // This method is same as confirmComposition(WebString()); + // Returns true if there is an ongoing composition. + virtual bool confirmComposition() { return false; } + + // Called to inform the WebWidget to confirm an ongoing composition with a + // new composition text. If the text is empty then the current composition + // text is confirmed. If there is no ongoing composition, then deletes the + // current selection and inserts the text. This method has no effect if + // there is no ongoing composition and the text is empty. + // Returns true if there is an ongoing composition or the text is inserted. + virtual bool confirmComposition(const WebString& text) { return false; } + + // Fetches the character range of the current composition, also called the + // "marked range." Returns true and fills the out-paramters on success; + // returns false on failure. + virtual bool compositionRange(size_t* location, size_t* length) { return false; } + + // Returns the current text input type of this WebWidget. + virtual WebTextInputType textInputType() { return WebKit::WebTextInputTypeNone; } + + // Returns the start and end bounds of the current selection. + // If the selection range is empty, it returns the caret bounds. + virtual bool selectionBounds(WebRect& start, WebRect& end) const { return false; } + + // Fetch the current selection range of this WebWidget. If there is no + // selection, it will output a 0-length range with the location at the + // caret. Returns true and fills the out-paramters on success; returns false + // on failure. + virtual bool caretOrSelectionRange(size_t* location, size_t* length) { return false; } + + // Changes the text direction of the selected input node. + virtual void setTextDirection(WebTextDirection) { } + + // Returns true if the WebWidget uses GPU accelerated compositing + // to render its contents. + virtual bool isAcceleratedCompositingActive() const { return false; } + +protected: + ~WebWidget() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebWidgetClient.h b/Source/WebKit/chromium/public/WebWidgetClient.h new file mode 100644 index 000000000..e5b405dea --- /dev/null +++ b/Source/WebKit/chromium/public/WebWidgetClient.h @@ -0,0 +1,135 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebWidgetClient_h +#define WebWidgetClient_h + +#include "WebNavigationPolicy.h" +#include "WebScreenInfo.h" +#include "platform/WebCommon.h" +#include "platform/WebRect.h" + +namespace WebKit { + +class WebString; +class WebWidget; +struct WebCursorInfo; +struct WebSize; + +class WebWidgetClient { +public: + // Called when a region of the WebWidget needs to be re-painted. + virtual void didInvalidateRect(const WebRect&) { } + + // Called when a region of the WebWidget, given by clipRect, should be + // scrolled by the specified dx and dy amounts. + virtual void didScrollRect(int dx, int dy, const WebRect& clipRect) { } + + // Called when the Widget has changed size as a result of an auto-resize. + virtual void didAutoResize(const WebSize& newSize) { } + + // Called when the compositor is enabled or disabled. + // The WebCompositor identifier can be used on the compositor thread to get access + // to the WebCompositor instance associated with this WebWidget. + // If there is no WebCompositor associated with this WebWidget (for example if + // threaded compositing is not enabled) then calling WebCompositor::fromIdentifier() + // for the specified identifier will return 0. + virtual void didActivateCompositor(int compositorIdentifier) { } + virtual void didDeactivateCompositor() { } + + // Called for compositing mode when the draw commands for a WebKit-side + // frame have been issued. + virtual void didCommitAndDrawCompositorFrame() { } + + // Called for compositing mode when swapbuffers has been posted in the GPU + // process. + virtual void didCompleteSwapBuffers() { } + + // Called when a call to WebWidget::composite is required + virtual void scheduleComposite() { } + + // Called when a call to WebWidget::animate is required + virtual void scheduleAnimation() { } + + // Called when the widget acquires or loses focus, respectively. + virtual void didFocus() { } + virtual void didBlur() { } + + // Called when the cursor for the widget changes. + virtual void didChangeCursor(const WebCursorInfo&) { } + + // Called when the widget should be closed. WebWidget::close() should + // be called asynchronously as a result of this notification. + virtual void closeWidgetSoon() { } + + // Called to show the widget according to the given policy. + virtual void show(WebNavigationPolicy) { } + + // Called to block execution of the current thread until the widget is + // closed. + virtual void runModal() { } + + // Called to enter/exit fullscreen mode. If enterFullScreen returns true, + // then WebWidget::{will,Did}EnterFullScreen should bound resizing the + // WebWidget into fullscreen mode. Similarly, when exitFullScreen is + // called, WebWidget::{will,Did}ExitFullScreen should bound resizing the + // WebWidget out of fullscreen mode. + virtual bool enterFullScreen() { return false; } + virtual void exitFullScreen() { } + + // Called to get/set the position of the widget in screen coordinates. + virtual WebRect windowRect() { return WebRect(); } + virtual void setWindowRect(const WebRect&) { } + + // Called when a tooltip should be shown at the current cursor position. + virtual void setToolTipText(const WebString&, WebTextDirection hint) { } + + // Called to get the position of the resizer rect in window coordinates. + virtual WebRect windowResizerRect() { return WebRect(); } + + // Called to get the position of the root window containing the widget + // in screen coordinates. + virtual WebRect rootWindowRect() { return WebRect(); } + + // Called to query information about the screen where this widget is + // displayed. + virtual WebScreenInfo screenInfo() { return WebScreenInfo(); } + + // When this method gets called, WebWidgetClient implementation should + // reset the input method by cancelling any ongoing composition. + virtual void resetInputMethod() { } + +protected: + ~WebWidgetClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebWindowFeatures.h b/Source/WebKit/chromium/public/WebWindowFeatures.h new file mode 100644 index 000000000..e656b2164 --- /dev/null +++ b/Source/WebKit/chromium/public/WebWindowFeatures.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebWindowFeatures_h +#define WebWindowFeatures_h + +#include "platform/WebCommon.h" +#include "platform/WebString.h" +#include "platform/WebVector.h" + +#if WEBKIT_IMPLEMENTATION +#include "WindowFeatures.h" +#endif + +namespace WebKit { + +struct WebWindowFeatures { + float x; + bool xSet; + float y; + bool ySet; + float width; + bool widthSet; + float height; + bool heightSet; + + bool menuBarVisible; + bool statusBarVisible; + bool toolBarVisible; + bool locationBarVisible; + bool scrollbarsVisible; + bool resizable; + + bool fullscreen; + bool dialog; + WebVector<WebString> additionalFeatures; + + WebWindowFeatures() + : xSet(false) + , ySet(false) + , widthSet(false) + , heightSet(false) + , menuBarVisible(true) + , statusBarVisible(true) + , toolBarVisible(true) + , locationBarVisible(true) + , scrollbarsVisible(true) + , resizable(true) + , fullscreen(false) + , dialog(false) + { + } + + +#if WEBKIT_IMPLEMENTATION + WebWindowFeatures(const WebCore::WindowFeatures& f) + : x(f.x) + , xSet(f.xSet) + , y(f.y) + , ySet(f.ySet) + , width(f.width) + , widthSet(f.widthSet) + , height(f.height) + , heightSet(f.heightSet) + , menuBarVisible(f.menuBarVisible) + , statusBarVisible(f.statusBarVisible) + , toolBarVisible(f.toolBarVisible) + , locationBarVisible(f.locationBarVisible) + , scrollbarsVisible(f.scrollbarsVisible) + , resizable(f.resizable) + , fullscreen(f.fullscreen) + , dialog(f.dialog) + , additionalFeatures(f.additionalFeatures) + { + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebWorker.h b/Source/WebKit/chromium/public/WebWorker.h new file mode 100644 index 000000000..c70a87361 --- /dev/null +++ b/Source/WebKit/chromium/public/WebWorker.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebWorker_h +#define WebWorker_h + +#include "WebMessagePortChannel.h" + +namespace WebKit { + +class WebString; +class WebURL; +class WebWorkerClient; + +// Provides an interface to the script execution context for a worker. +class WebWorker { +public: + // Instantiates a built-in WebWorker. + WEBKIT_EXPORT static WebWorker* create(WebWorkerClient*); + + virtual ~WebWorker() { } + virtual void startWorkerContext(const WebURL& scriptURL, + const WebString& userAgent, + const WebString& sourceCode) = 0; + virtual void terminateWorkerContext() = 0; + virtual void postMessageToWorkerContext( + const WebString&, + const WebMessagePortChannelArray&) = 0; + virtual void workerObjectDestroyed() = 0; + virtual void clientDestroyed() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/WebWorkerRunLoop.h b/Source/WebKit/chromium/public/WebWorkerRunLoop.h new file mode 100644 index 000000000..d15abed91 --- /dev/null +++ b/Source/WebKit/chromium/public/WebWorkerRunLoop.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google 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. + */ + +#ifndef WebWorkerRunLoop_h +#define WebWorkerRunLoop_h + +#include "platform/WebCommon.h" + +namespace WebCore { +class WorkerRunLoop; +} + +namespace WebKit { + +class WebWorkerRunLoop { +public: + class Task { + public: + virtual ~Task() { } + virtual void Run() = 0; + }; + WEBKIT_EXPORT void postTask(Task*); + WEBKIT_EXPORT bool equals(const WebWorkerRunLoop&) const; + WEBKIT_EXPORT bool lessThan(const WebWorkerRunLoop&) const; + +#if WEBKIT_IMPLEMENTATION + WebWorkerRunLoop(WebCore::WorkerRunLoop*); +#endif + +private: + WebCore::WorkerRunLoop* m_workerRunLoop; +}; + +inline bool operator==(const WebWorkerRunLoop& a, const WebWorkerRunLoop& b) +{ + return a.equals(b); +} + +inline bool operator<(const WebWorkerRunLoop& a, const WebWorkerRunLoop& b) +{ + return a.lessThan(b); +} + +} + +#endif diff --git a/Source/WebKit/chromium/public/android/WebInputEventFactory.h b/Source/WebKit/chromium/public/android/WebInputEventFactory.h new file mode 100644 index 000000000..d49be4187 --- /dev/null +++ b/Source/WebKit/chromium/public/android/WebInputEventFactory.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../platform/WebCommon.h" +#include "../WebInputEvent.h" + +namespace WebKit { + +class WebKeyboardEvent; + +class WebInputEventFactory { +public: + enum MouseEventType { + MouseEventTypeDown = 0, + MouseEventTypeUp, + MouseEventTypeMove, + }; + + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(WebInputEvent::Type, + int modifiers, + double timeStampSeconds, + int keycode, + WebUChar unicodeCharacter, + bool isSystemKey); + + WEBKIT_EXPORT static WebMouseEvent mouseEvent(int x, + int y, + int windowX, + int windowY, + MouseEventType, + double timeStampSeconds, + WebMouseEvent::Button = WebMouseEvent::ButtonLeft); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/android/WebSandboxSupport.h b/Source/WebKit/chromium/public/android/WebSandboxSupport.h new file mode 100644 index 000000000..f1ed6b23d --- /dev/null +++ b/Source/WebKit/chromium/public/android/WebSandboxSupport.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WEBKIT_MIGRATE_HEADERS_TO_PLATFORM +#include "../platform/android/WebSandboxSupport.h" +#endif diff --git a/Source/WebKit/chromium/public/gtk/WebFontInfo.h b/Source/WebKit/chromium/public/gtk/WebFontInfo.h new file mode 100644 index 000000000..2fc00ba08 --- /dev/null +++ b/Source/WebKit/chromium/public/gtk/WebFontInfo.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ +// This file can be deleted once http://codereview.chromium.org/8054025/ +// gets committed in Chromium. +#include "../linux/WebFontInfo.h" diff --git a/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h b/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h new file mode 100644 index 000000000..0300c82b7 --- /dev/null +++ b/Source/WebKit/chromium/public/gtk/WebInputEventFactory.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../platform/WebCommon.h" + +typedef struct _GdkEventButton GdkEventButton; +typedef struct _GdkEventMotion GdkEventMotion; +typedef struct _GdkEventCrossing GdkEventCrossing; +typedef struct _GdkEventScroll GdkEventScroll; +typedef struct _GdkEventKey GdkEventKey; + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebMouseWheelEvent; + +class WebInputEventFactory { +public: + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(const GdkEventKey*); + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(wchar_t character, int state, double timeStampSeconds); + WEBKIT_EXPORT static WebMouseEvent mouseEvent(const GdkEventButton*); + WEBKIT_EXPORT static WebMouseEvent mouseEvent(const GdkEventMotion*); + WEBKIT_EXPORT static WebMouseEvent mouseEvent(const GdkEventCrossing*); + WEBKIT_EXPORT static WebMouseWheelEvent mouseWheelEvent(const GdkEventScroll*); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/linux/WebFontInfo.h b/Source/WebKit/chromium/public/linux/WebFontInfo.h new file mode 100644 index 000000000..72e1091d6 --- /dev/null +++ b/Source/WebKit/chromium/public/linux/WebFontInfo.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontInfo_h +#define WebFontInfo_h + +#include "../linux/WebFontRenderStyle.h" +#include "../platform/WebCString.h" +#include "../platform/linux/WebFontFamily.h" + +#include <string.h> +#include <unistd.h> + +namespace WebKit { + +class WebFontInfo { +public: + // Return a font family which provides glyphs for the Unicode code points + // specified by |utf16| + // characters: a native-endian UTF16 string + // numCharacters: the number of 16-bit words in |utf16| + // preferredLocale: preferred locale identifier for the |characters| + // (e.g. "en", "ja", "zh-CN") + // + // Returns: the font family or an empty string if the request could not be + // satisfied. + // Returns: the font family instance. The instance has an empty font name if the request could not be satisfied. + WEBKIT_EXPORT static void familyForChars(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*); + + // Fill out the given WebFontRenderStyle with the user's preferences for + // rendering the given font at the given size. + // family: i.e. "Times New Roman" + // sizeAndStyle: + // 3322222222221111111111 + // 10987654321098765432109876543210 + // +--------------------------------+ + // |..............Size............IB| + // +--------------------------------+ + // I: italic flag + // B: bold flag + WEBKIT_EXPORT static void renderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* result); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h new file mode 100644 index 000000000..9b16380a5 --- /dev/null +++ b/Source/WebKit/chromium/public/linux/WebFontRenderStyle.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontRenderStyle_h +#define WebFontRenderStyle_h + +#include "../platform/WebCommon.h" + +namespace WebCore { struct FontRenderStyle; } + +namespace WebKit { + +struct WEBKIT_EXPORT WebFontRenderStyle { + // Each of the use* members below can take one of three values: + // 0: off + // 1: on + // 2: no preference expressed + char useBitmaps; // use embedded bitmap strike if possible + char useAutoHint; // use 'auto' hinting (FreeType specific) + char useHinting; // hint glyphs to the pixel grid + char hintStyle; // level of hinting, 0..3 + char useAntiAlias; // antialias glyph shapes + char useSubpixel; // use subpixel antialias + +#ifdef WEBKIT_IMPLEMENTATION + // Translates the members of this struct to a FontRenderStyle + void toFontRenderStyle(WebCore::FontRenderStyle*); +#endif + + void setDefaults(); +}; + +} // namespace WebKit + +#endif // WebFontRenderStyle_h diff --git a/Source/WebKit/chromium/public/linux/WebFontRendering.h b/Source/WebKit/chromium/public/linux/WebFontRendering.h new file mode 100644 index 000000000..87a59b8ca --- /dev/null +++ b/Source/WebKit/chromium/public/linux/WebFontRendering.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontRendering_h +#define WebFontRendering_h + +#include "../platform/WebCommon.h" +#include <SkFontHost.h> +#include <SkPaint.h> + +namespace WebKit { + +class WebFontRendering { +public: + // Set global font renderering preferences. + + WEBKIT_EXPORT static void setHinting(SkPaint::Hinting); + WEBKIT_EXPORT static void setAntiAlias(bool on); + WEBKIT_EXPORT static void setSubpixelGlyphs(bool on); + WEBKIT_EXPORT static void setLCDOrder(SkFontHost::LCDOrder); + WEBKIT_EXPORT static void setLCDOrientation(SkFontHost::LCDOrientation); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/linux/WebRenderTheme.h b/Source/WebKit/chromium/public/linux/WebRenderTheme.h new file mode 100644 index 000000000..ae517c664 --- /dev/null +++ b/Source/WebKit/chromium/public/linux/WebRenderTheme.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2009 Joel Stanley. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebRenderTheme_h +#define WebRenderTheme_h + +#include "../platform/WebCommon.h" + +namespace WebKit { + +// Set caret blink interval for text input areas. +WEBKIT_EXPORT void setCaretBlinkInterval(double); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/linux/WebSandboxSupport.h b/Source/WebKit/chromium/public/linux/WebSandboxSupport.h new file mode 100644 index 000000000..2ccae8c17 --- /dev/null +++ b/Source/WebKit/chromium/public/linux/WebSandboxSupport.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WEBKIT_MIGRATE_HEADERS_TO_PLATFORM +#include "../platform/linux/WebSandboxSupport.h" +#endif diff --git a/Source/WebKit/chromium/public/mac/WebInputEventFactory.h b/Source/WebKit/chromium/public/mac/WebInputEventFactory.h new file mode 100644 index 000000000..a992183db --- /dev/null +++ b/Source/WebKit/chromium/public/mac/WebInputEventFactory.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../platform/WebCommon.h" + +#ifdef __OBJC__ +@class NSEvent; +@class NSView; +#else +class NSEvent; +class NSView; +#endif + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebMouseWheelEvent; +class WebGestureEvent; + +class WebInputEventFactory { +public: + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(NSEvent*); + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(wchar_t character, int modifiers, double timeStampSeconds); + WEBKIT_EXPORT static WebMouseEvent mouseEvent(NSEvent*, NSView*); + WEBKIT_EXPORT static WebMouseWheelEvent mouseWheelEvent(NSEvent*, NSView*); + WEBKIT_EXPORT static WebGestureEvent gestureEvent(NSEvent *, NSView *); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/mac/WebSandboxSupport.h b/Source/WebKit/chromium/public/mac/WebSandboxSupport.h new file mode 100644 index 000000000..71131d270 --- /dev/null +++ b/Source/WebKit/chromium/public/mac/WebSandboxSupport.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WEBKIT_MIGRATE_HEADERS_TO_PLATFORM +#include "../platform/mac/WebSandboxSupport.h" +#endif diff --git a/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h b/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h new file mode 100644 index 000000000..794e75e7c --- /dev/null +++ b/Source/WebKit/chromium/public/mac/WebScreenInfoFactory.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../platform/WebCommon.h" + +#ifdef __OBJC__ +@class NSView; +#else +class NSView; +#endif + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_EXPORT static WebScreenInfo screenInfo(NSView*); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/mac/WebSubstringUtil.h b/Source/WebKit/chromium/public/mac/WebSubstringUtil.h new file mode 100644 index 000000000..b21fe21e6 --- /dev/null +++ b/Source/WebKit/chromium/public/mac/WebSubstringUtil.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSubstringUtil_h +#define WebSubstringUtil_h + +namespace WebKit { +class WebFrame; +} + +#if __OBJC__ +@class NSAttributedString; +#else +class NSAttributedString; +#endif + +namespace WebKit { + +class WebSubstringUtil { +public: + // Returns an autoreleased NSAttributedString that is a substring of the + // Frame at the given range, or nil on error. + WEBKIT_EXPORT static NSAttributedString* attributedSubstringInRange(WebFrame*, + size_t location, + size_t length); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebArrayBufferView.h b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h new file mode 100644 index 000000000..8f2356930 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#ifndef WebArrayBufferView_h +#define WebArrayBufferView_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WTF { class ArrayBufferView; } + +namespace WebKit { + +// Provides access to an ArrayBufferView. +class WebArrayBufferView { +public: + ~WebArrayBufferView() { reset(); } + WebArrayBufferView() { } + WebArrayBufferView(const WebArrayBufferView& v) { assign(v); } + + WEBKIT_EXPORT void* baseAddress() const; + WEBKIT_EXPORT unsigned byteOffset() const; + WEBKIT_EXPORT unsigned byteLength() const; + + WEBKIT_EXPORT void assign(const WebArrayBufferView&); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebArrayBufferView(const WTF::PassRefPtr<WTF::ArrayBufferView>&); + WebArrayBufferView& operator=(const WTF::PassRefPtr<WTF::ArrayBufferView>&); + operator WTF::PassRefPtr<WTF::ArrayBufferView>() const; +#endif + +private: + WebPrivatePtr<WTF::ArrayBufferView> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebAudioBus.h b/Source/WebKit/chromium/public/platform/WebAudioBus.h new file mode 100644 index 000000000..750ae79e2 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebAudioBus.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010, Google 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. + */ + +#ifndef WebAudioBus_h +#define WebAudioBus_h + +#include "WebCommon.h" + +namespace WebCore { class AudioBus; } + +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassOwnPtr; } +#endif + +namespace WebKit { + +class WebAudioBusPrivate; + +// A container for multi-channel linear PCM audio data. +// +// WARNING: It is not safe to pass a WebAudioBus across threads!!! +// +class WebAudioBus { +public: + WebAudioBus() : m_private(0) { } + ~WebAudioBus() { reset(); } + + // initialize() allocates memory of the given length for the given number of channels. + WEBKIT_EXPORT void initialize(unsigned numberOfChannels, size_t length, double sampleRate); + + // reset() releases the memory allocated from initialize(). + WEBKIT_EXPORT void reset(); + + WEBKIT_EXPORT unsigned numberOfChannels() const; + WEBKIT_EXPORT size_t length() const; + WEBKIT_EXPORT double sampleRate() const; + + WEBKIT_EXPORT float* channelData(unsigned channelIndex); + +#if WEBKIT_IMPLEMENTATION + WTF::PassOwnPtr<WebCore::AudioBus> release(); +#endif + +private: + // Disallow copy and assign. + WebAudioBus(const WebAudioBus&); + void operator=(const WebAudioBus&); + + WebCore::AudioBus* m_private; +}; + +} // namespace WebKit + +#endif // WebAudioBus_h diff --git a/Source/WebKit/chromium/public/platform/WebAudioDevice.h b/Source/WebKit/chromium/public/platform/WebAudioDevice.h new file mode 100644 index 000000000..00aea975f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebAudioDevice.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE 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 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. + */ + +#ifndef WebAudioDevice_h +#define WebAudioDevice_h + +#include "WebVector.h" + +namespace WebKit { + +// Abstract interface to the Chromium audio system. + +class WebAudioDevice { +public: + class RenderCallback { + public: + virtual void render(const WebVector<float*>& audioData, size_t numberOfFrames) = 0; + protected: + virtual ~RenderCallback() { } + }; + + virtual ~WebAudioDevice() { } + + virtual void start() = 0; + virtual void stop() = 0; + virtual double sampleRate() = 0; +}; + +} // namespace WebKit + +#endif // WebAudioDevice_h diff --git a/Source/WebKit/chromium/public/platform/WebBlobData.h b/Source/WebKit/chromium/public/platform/WebBlobData.h new file mode 100644 index 000000000..7fa32d3b6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebBlobData.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebBlobData_h +#define WebBlobData_h + +#include "WebString.h" +#include "WebThreadSafeData.h" +#include "WebURL.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class BlobData; } +namespace WTF { template <typename T> class PassOwnPtr; } +#endif + +namespace WebKit { + +class WebBlobDataPrivate; + +class WebBlobData { +public: + struct Item { + enum { TypeData, TypeFile, TypeBlob } type; + WebThreadSafeData data; + WebString filePath; + WebURL blobURL; + long long offset; + long long length; // -1 means go to the end of the file/blob. + double expectedModificationTime; // 0.0 means that the time is not set. + }; + + ~WebBlobData() { reset(); } + + WebBlobData() : m_private(0) { } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + + bool isNull() const { return !m_private; } + + // Returns the number of items. + WEBKIT_EXPORT size_t itemCount() const; + + // Retrieves the values of the item at the given index. Returns false if + // index is out of bounds. + WEBKIT_EXPORT bool itemAt(size_t index, Item& result) const; + + WEBKIT_EXPORT WebString contentType() const; + + WEBKIT_EXPORT WebString contentDisposition() const; + +#if WEBKIT_IMPLEMENTATION + WebBlobData(const WTF::PassOwnPtr<WebCore::BlobData>&); + WebBlobData& operator=(const WTF::PassOwnPtr<WebCore::BlobData>&); + operator WTF::PassOwnPtr<WebCore::BlobData>(); +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(const WTF::PassOwnPtr<WebCore::BlobData>&); +#endif + WebBlobDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif // WebBlobData_h diff --git a/Source/WebKit/chromium/public/platform/WebBlobRegistry.h b/Source/WebKit/chromium/public/platform/WebBlobRegistry.h new file mode 100644 index 000000000..d882abad9 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebBlobRegistry.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebBlobRegistry_h +#define WebBlobRegistry_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebBlobData; +class WebURL; + +class WebBlobRegistry { +public: + WEBKIT_EXPORT static WebBlobRegistry* create(); + + virtual ~WebBlobRegistry() { } + + // Registers a blob URL referring to the specified blob data. + virtual void registerBlobURL(const WebURL&, WebBlobData&) = 0; + + // Registers a blob URL referring to the blob data identified by the specified srcURL. + virtual void registerBlobURL(const WebURL&, const WebURL& srcURL) = 0; + + virtual void unregisterBlobURL(const WebURL&) = 0; +}; + +} // namespace WebKit + +#endif // WebBlobRegistry_h diff --git a/Source/WebKit/chromium/public/platform/WebCString.h b/Source/WebKit/chromium/public/platform/WebCString.h new file mode 100644 index 000000000..7a4486db3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCString.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#include "../../../../Platform/chromium/public/WebCString.h" + diff --git a/Source/WebKit/chromium/public/platform/WebCanvas.h b/Source/WebKit/chromium/public/platform/WebCanvas.h new file mode 100644 index 000000000..4cf729ee1 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCanvas.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCanvas_h +#define WebCanvas_h + +#include "WebCommon.h" + +#if WEBKIT_USING_SKIA +class SkCanvas; +#elif WEBKIT_USING_CG +struct CGContext; +#endif + +namespace WebKit { + +#if WEBKIT_USING_SKIA +typedef SkCanvas WebCanvas; +#elif WEBKIT_USING_CG +typedef struct CGContext WebCanvas; +#else +#error "Need to define WebCanvas" +#endif + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebClipboard.h b/Source/WebKit/chromium/public/platform/WebClipboard.h new file mode 100644 index 000000000..503213952 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebClipboard.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebClipboard_h +#define WebClipboard_h + +#include "WebCommon.h" +#include "WebData.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +class WebDragData; +class WebImage; +class WebURL; + +class WebClipboard { +public: + enum Format { + FormatPlainText, + FormatHTML, + FormatBookmark, + FormatSmartPaste + }; + + enum Buffer { + BufferStandard, + // Used on platforms like the X Window System that treat selection + // as a type of clipboard. + BufferSelection, + }; + + // Returns an identifier which can be used to determine whether the data + // contained within the clipboard has changed. + virtual uint64 sequenceNumber(Buffer) { return 0; } + + virtual bool isFormatAvailable(Format, Buffer) { return false; } + + virtual WebVector<WebString> readAvailableTypes( + Buffer, bool* containsFilenames) { return WebVector<WebString>(); } + virtual WebString readPlainText(Buffer) { return WebString(); } + // fragmentStart and fragmentEnd are indexes into the returned markup that + // indicate the start and end of the fragment if the returned markup + // contains additional context. If there is no additional context, + // fragmentStart will be zero and fragmentEnd will be the same as the length + // of the returned markup. + virtual WebString readHTML( + Buffer buffer, WebURL* pageURL, unsigned* fragmentStart, + unsigned* fragmentEnd) { return WebString(); } + virtual WebData readImage(Buffer) { return WebData(); } + virtual WebString readCustomData( + Buffer, const WebString& type) { return WebString(); } + + virtual void writePlainText(const WebString&) { } + virtual void writeHTML( + const WebString& htmlText, const WebURL&, + const WebString& plainText, bool writeSmartPaste) { } + virtual void writeURL( + const WebURL&, const WebString& title) { } + virtual void writeImage( + const WebImage&, const WebURL&, const WebString& title) { } + virtual void writeDataObject(const WebDragData&) { } + +protected: + ~WebClipboard() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebColor.h b/Source/WebKit/chromium/public/platform/WebColor.h new file mode 100644 index 000000000..da45eb1c6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebColor.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebColor_h +#define WebColor_h + +#include "WebColorName.h" +#include "WebCommon.h" + +namespace WebKit { + +typedef unsigned WebColor; // RGBA quad. Equivalent to SkColor. + +// Sets the values of a set of named colors. +WEBKIT_EXPORT void setNamedColors(const WebColorName*, const WebColor*, size_t length); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebColorName.h b/Source/WebKit/chromium/public/platform/WebColorName.h new file mode 100644 index 000000000..f97ed265f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebColorName.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2009 Google 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: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * 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. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT +* OWNER OR 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. +*/ + +#ifndef WebColorName_h +#define WebColorName_h + +namespace WebKit { + +enum WebColorName { + WebColorActiveBorder, + WebColorActiveCaption, + WebColorAppworkspace, + WebColorBackground, + WebColorButtonFace, + WebColorButtonHighlight, + WebColorButtonShadow, + WebColorButtonText, + WebColorCaptionText, + WebColorGrayText, + WebColorHighlight, + WebColorHighlightText, + WebColorInactiveBorder, + WebColorInactiveCaption, + WebColorInactiveCaptionText, + WebColorInfoBackground, + WebColorInfoText, + WebColorMenu, + WebColorMenuText, + WebColorScrollbar, + WebColorText, + WebColorThreedDarkShadow, + WebColorThreedShadow, + WebColorThreedFace, + WebColorThreedHighlight, + WebColorThreedLightShadow, + WebColorWebkitFocusRingColor, + WebColorWindow, + WebColorWindowFrame, + WebColorWindowText +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebCommon.h b/Source/WebKit/chromium/public/platform/WebCommon.h new file mode 100644 index 000000000..39b40eb7f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCommon.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#include "../../../../Platform/chromium/public/WebCommon.h" diff --git a/Source/WebKit/chromium/public/platform/WebContentLayer.h b/Source/WebKit/chromium/public/platform/WebContentLayer.h new file mode 100644 index 000000000..6d7f91483 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebContentLayer.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebContentLayer_h +#define WebContentLayer_h + +#include "WebCommon.h" +#include "WebLayer.h" + +namespace WebKit { +class WebContentLayerClient; +class WebContentLayerImpl; +struct WebFloatRect; + +class WebContentLayer : public WebLayer { +public: + WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*); + + WebContentLayer() { } + WebContentLayer(const WebContentLayer& layer) : WebLayer(layer) { } + virtual ~WebContentLayer() { } + WebContentLayer& operator=(const WebContentLayer& layer) + { + WebLayer::assign(layer); + return *this; + } + + // Sets whether the layer draws its content when compositing. + WEBKIT_EXPORT void setDrawsContent(bool); + WEBKIT_EXPORT bool drawsContent() const; + + // Sets a region of the layer as invalid, i.e. needs to update its content. + // The visible area of the dirty rect will be passed to one or more calls to + // WebContentLayerClient::paintContents before the compositing pass occurs. + WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); + + // Sets the entire layer as invalid, i.e. needs to update its content. + WEBKIT_EXPORT void invalidate(); + +#if WEBKIT_IMPLEMENTATION + WebContentLayer(const WTF::PassRefPtr<WebContentLayerImpl>&); + WebContentLayer& operator=(const WTF::PassRefPtr<WebContentLayerImpl>&); + operator WTF::PassRefPtr<WebContentLayerImpl>() const; +#endif +}; + +} // namespace WebKit + +#endif // WebContentLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebContentLayerClient.h b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h new file mode 100644 index 000000000..deb36e077 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebContentLayerClient_h +#define WebContentLayerClient_h + +#include "WebCanvas.h" + +namespace WebKit { +struct WebRect; + +class WebContentLayerClient { +public: + // Paints the content area for the layer, typically dirty rects submitted + // through WebContentLayer::setNeedsDisplay, submitting drawing commands + // through the WebCanvas. + // The canvas is already clipped to the |clip| rect. + virtual void paintContents(WebCanvas*, const WebRect& clip) = 0; + +protected: + virtual ~WebContentLayerClient() { } +}; + +} // namespace WebKit + +#endif // WebContentLayerClient_h diff --git a/Source/WebKit/chromium/public/platform/WebCookie.h b/Source/WebKit/chromium/public/platform/WebCookie.h new file mode 100644 index 000000000..318b0e3e3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCookie.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCookie_h +#define WebCookie_h + +#include "WebCommon.h" +#include "WebString.h" + +namespace WebKit { + +// A cookie. +// +struct WebCookie { + WebCookie() + : expires(0) + , httpOnly(false) + , secure(false) + , session(false) + { + } + + WebCookie(const WebString& name, const WebString& value, const WebString& domain, + const WebString& path, double expires, bool httpOnly, bool secure, bool session) + : name(name) + , value(value) + , domain(domain) + , path(path) + , expires(expires) + , httpOnly(httpOnly) + , secure(secure) + , session(session) + { + } + + WebString name; + WebString value; + WebString domain; + WebString path; + double expires; + bool httpOnly; + bool secure; + bool session; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebCookieJar.h b/Source/WebKit/chromium/public/platform/WebCookieJar.h new file mode 100644 index 000000000..6daba6bc4 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCookieJar.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebCookieJar_h +#define WebCookieJar_h + +#include "WebString.h" + +namespace WebKit { +class WebURL; +struct WebCookie; +template <typename T> class WebVector; + +class WebCookieJar { +public: + virtual void setCookie(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookie) { } + virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual WebString cookieRequestHeaderFieldValue(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual void rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>&) { } + virtual void deleteCookie(const WebURL&, const WebString& cookieName) { } + virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; } + +protected: + ~WebCookieJar() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebData.h b/Source/WebKit/chromium/public/platform/WebData.h new file mode 100644 index 000000000..17d3f388c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebData.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebData_h +#define WebData_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class SharedBuffer; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDataPrivate; + +// A container for raw bytes. It is inexpensive to copy a WebData object. +// +// WARNING: It is not safe to pass a WebData across threads!!! +// +class WebData { +public: + ~WebData() { reset(); } + + WebData() : m_private(0) { } + + WebData(const char* data, size_t size) : m_private(0) + { + assign(data, size); + } + + template <int N> + WebData(const char (&data)[N]) : m_private(0) + { + assign(data, N - 1); + } + + WebData(const WebData& d) : m_private(0) { assign(d); } + + WebData& operator=(const WebData& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebData&); + WEBKIT_EXPORT void assign(const char* data, size_t size); + + WEBKIT_EXPORT size_t size() const; + WEBKIT_EXPORT const char* data() const; + + bool isEmpty() const { return !size(); } + bool isNull() const { return !m_private; } + +#if WEBKIT_IMPLEMENTATION + WebData(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + WebData& operator=(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + operator WTF::PassRefPtr<WebCore::SharedBuffer>() const; +#else + template <class C> + WebData(const C& c) : m_private(0) + { + assign(c.data(), c.size()); + } + + template <class C> + WebData& operator=(const C& c) + { + assign(c.data(), c.size()); + return *this; + } +#endif + +private: + void assign(WebDataPrivate*); + WebDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebDragData.h b/Source/WebKit/chromium/public/platform/WebDragData.h new file mode 100644 index 000000000..171231eca --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebDragData.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebDragData_h +#define WebDragData_h + +#include "WebCommon.h" +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class ChromiumDataObject; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebData; +class WebDragDataPrivate; +class WebURL; +template <typename T> class WebVector; + +// Holds data that may be exchanged through a drag-n-drop operation. It is +// inexpensive to copy a WebDragData object. +class WebDragData { +public: + ~WebDragData() { reset(); } + + WebDragData() : m_private(0) { } + WebDragData(const WebDragData& d) : m_private(0) { assign(d); } + WebDragData& operator=(const WebDragData& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebDragData&); + + bool isNull() const { return !m_private; } + + WEBKIT_EXPORT WebString url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + WEBKIT_EXPORT WebString urlTitle() const; + WEBKIT_EXPORT void setURLTitle(const WebString&); + + WEBKIT_EXPORT WebString downloadMetadata() const; + WEBKIT_EXPORT void setDownloadMetadata(const WebString&); + + WEBKIT_EXPORT WebString fileExtension() const; + WEBKIT_EXPORT void setFileExtension(const WebString&); + + WEBKIT_EXPORT bool containsFilenames() const; + WEBKIT_EXPORT void filenames(WebVector<WebString>&) const; + WEBKIT_EXPORT void setFilenames(const WebVector<WebString>&); + WEBKIT_EXPORT void appendToFilenames(const WebString&); + + WEBKIT_EXPORT WebString plainText() const; + WEBKIT_EXPORT void setPlainText(const WebString&); + + WEBKIT_EXPORT WebString htmlText() const; + WEBKIT_EXPORT void setHTMLText(const WebString&); + + WEBKIT_EXPORT WebURL htmlBaseURL() const; + WEBKIT_EXPORT void setHTMLBaseURL(const WebURL&); + + WEBKIT_EXPORT WebString fileContentFilename() const; + WEBKIT_EXPORT void setFileContentFilename(const WebString&); + + WEBKIT_EXPORT WebData fileContent() const; + WEBKIT_EXPORT void setFileContent(const WebData&); + + struct CustomData { + WebString type; + WebString data; + }; + WEBKIT_EXPORT WebVector<CustomData> customData() const; + WEBKIT_EXPORT void setCustomData(const WebVector<CustomData>&); + +#if WEBKIT_IMPLEMENTATION + WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const; +#endif + +private: + void assign(WebDragDataPrivate*); + void ensureMutable(); + WebDragDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h new file mode 100644 index 000000000..ce87bb238 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebExternalTextureLayer_h +#define WebExternalTextureLayer_h + +#include "WebCommon.h" +#include "WebFloatRect.h" +#include "WebLayer.h" + +namespace WebKit { +class WebExternalTextureLayerImpl; + +// This class represents a layer that renders a texture that is generated +// externally (not managed by the WebLayerTreeView). +// The texture will be used by the WebLayerTreeView during compositing passes. +// When in single-thread mode, this means during WebLayerTreeView::composite(). +// When using the threaded compositor, this can mean at an arbitrary time until +// the WebLayerTreeView is destroyed. +class WebExternalTextureLayer : public WebLayer { +public: + WEBKIT_EXPORT static WebExternalTextureLayer create(); + + WebExternalTextureLayer() { } + WebExternalTextureLayer(const WebExternalTextureLayer& layer) : WebLayer(layer) { } + virtual ~WebExternalTextureLayer() { } + WebExternalTextureLayer& operator=(const WebExternalTextureLayer& layer) + { + WebLayer::assign(layer); + return *this; + } + + // Sets the texture id that represents the layer, in the namespace of the + // compositor context. + WEBKIT_EXPORT void setTextureId(unsigned); + WEBKIT_EXPORT unsigned textureId() const; + + // Sets whether or not the texture should be flipped in the Y direction when + // rendered. + WEBKIT_EXPORT void setFlipped(bool); + WEBKIT_EXPORT bool flipped() const; + + // Sets the rect in UV space of the texture that is mapped to the layer + // bounds. + WEBKIT_EXPORT void setUVRect(const WebFloatRect&); + WEBKIT_EXPORT WebFloatRect uvRect() const; + + // Marks a region of the layer as needing a display. These regions are + // collected in a union until the display occurs. + WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); + +#if WEBKIT_IMPLEMENTATION + WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); + WebExternalTextureLayer& operator=(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); + operator WTF::PassRefPtr<WebExternalTextureLayerImpl>() const; +#endif +}; + +} // namespace WebKit + +#endif // WebExternalTextureLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h new file mode 100644 index 000000000..583efe07c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFileSystem_h +#define WebFileSystem_h + +#include "WebCommon.h" +#include "WebURL.h" + +namespace WebKit { + +// FIXME: Move these classes into platform. +class WebFileSystemCallbacks; +class WebFileWriter; +class WebFileWriterClient; + +class WebFileSystem { +public: + enum Type { + TypeTemporary, + TypePersistent, + TypeExternal, + }; + + // Moves a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Copies a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Deletes a file or directory at a given |path|. + // It is an error to try to remove a directory that is not empty. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void remove(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Deletes a file or directory recursively at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Retrieves the metadata information of the file or directory at the given |path|. + // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a file at given |path|. + // If the |path| doesn't exist, it creates a new file at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or + // it has successfully created a new file at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a directory at a given |path|. + // If the |path| doesn't exist, it creates a new directory at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or it has successfully created a new directory at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when + // the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a file exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void fileExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a directory exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Reads directory entries of a given directory at |path|. + // WebFileSystemCallbacks::didReadDirectory() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readDirectory(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a WebFileWriter that can be used to write to the given file. + // This is a fast, synchronous call, and should not stat the filesystem. + virtual WebFileWriter* createFileWriter(const WebURL& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } + +protected: + virtual ~WebFileSystem() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatPoint.h b/Source/WebKit/chromium/public/platform/WebFloatPoint.h new file mode 100644 index 000000000..4afc16b9c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatQuad.h b/Source/WebKit/chromium/public/platform/WebFloatQuad.h new file mode 100644 index 000000000..da5eb0542 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatQuad.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFloatQuad_h +#define WebFloatQuad_h + +#include "WebCommon.h" +#include "WebFloatPoint.h" +#include "WebRect.h" + +#include <algorithm> +#include <cmath> + +#if WEBKIT_IMPLEMENTATION +#include "FloatQuad.h" +#endif + +namespace WebKit { + +struct WebFloatQuad { + WebFloatPoint p[4]; + + WebFloatQuad() + { + } + + WebFloatQuad(const WebFloatPoint& p0, const WebFloatPoint& p1, const WebFloatPoint& p2, const WebFloatPoint& p3) + { + p[0] = p0; + p[1] = p1; + p[2] = p2; + p[3] = p3; + } + + WEBKIT_EXPORT WebRect enclosingRect() const; + +#if WEBKIT_IMPLEMENTATION + WebFloatQuad& operator=(const WebCore::FloatQuad& q) + { + p[0] = q.p1(); + p[1] = q.p2(); + p[2] = q.p3(); + p[3] = q.p4(); + return *this; + } + WebFloatQuad(const WebCore::FloatQuad& q) + { + *this = q; + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatRect.h b/Source/WebKit/chromium/public/platform/WebFloatRect.h new file mode 100644 index 000000000..a883513fc --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatRect.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFloatRect_h +#define WebFloatRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif + +namespace WebKit { + +struct WebFloatRect { + float x; + float y; + float width; + float height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebGamepad.h b/Source/WebKit/chromium/public/platform/WebGamepad.h new file mode 100644 index 000000000..71d37b3ba --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGamepad.h @@ -0,0 +1,74 @@ +// Copyright (C) 2011, Google 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. + +#ifndef WebGamepad_h +#define WebGamepad_h + +#include "WebCommon.h" + +namespace WebKit { + +// This structure is intentionally POD and fixed size so that it can be shared +// memory between hardware polling threads and the rest of the browser. See +// also WebGamepads.h. +class WebGamepad { +public: + static const size_t idLengthCap = 128; + static const size_t axesLengthCap = 16; + static const size_t buttonsLengthCap = 32; + + WebGamepad() + : connected(false) + , timestamp(0) + , axesLength(0) + , buttonsLength(0) + { + id[0] = 0; + } + + // Is there a gamepad connected at this index? + bool connected; + + // Device identifier (based on manufacturer, model, etc.). + WebUChar id[idLengthCap]; + + // Monotonically increasing value referring to when the data were last + // updated. + unsigned long long timestamp; + + // Number of valid entries in the axes array. + unsigned axesLength; + + // Normalized values representing axes, in the range [-1..1]. + float axes[axesLengthCap]; + + // Number of valid entries in the buttons array. + unsigned buttonsLength; + + // Normalized values representing buttons, in the range [0..1]. + float buttons[buttonsLengthCap]; +}; + +} + +#endif // WebGamepad_h diff --git a/Source/WebKit/chromium/public/platform/WebGamepads.h b/Source/WebKit/chromium/public/platform/WebGamepads.h new file mode 100644 index 000000000..b1cc18ef8 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGamepads.h @@ -0,0 +1,50 @@ +// Copyright (C) 2011, Google 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. + +#ifndef WebGamepads_h +#define WebGamepads_h + +#include "WebGamepad.h" + +namespace WebKit { + +// This structure is intentionally POD and fixed size so that it can be stored +// in shared memory between hardware polling threads and the rest of the +// browser. +class WebGamepads { +public: + WebGamepads() + : length(0) { } + + static const size_t itemsLengthCap = 4; + + // Number of valid entries in the items array. + unsigned length; + + // Gamepad data for N separate gamepad devices. + WebGamepad items[itemsLengthCap]; +}; + +} + +#endif // WebGamepads_h diff --git a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h new file mode 100644 index 000000000..3811436c2 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h @@ -0,0 +1,404 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebGraphicsContext3D_h +#define WebGraphicsContext3D_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebString.h" + +#define USE_WGC3D_TYPES + +#if WEBKIT_USING_SKIA +struct GrGLInterface; +#endif + +namespace WebKit { + +// WGC3D types match the corresponding GL types as defined in OpenGL ES 2.0 +// header file gl2.h from khronos.org. +typedef char WGC3Dchar; +typedef unsigned int WGC3Denum; +typedef unsigned char WGC3Dboolean; +typedef unsigned int WGC3Dbitfield; +typedef signed char WGC3Dbyte; +typedef unsigned char WGC3Dubyte; +typedef short WGC3Dshort; +typedef unsigned short WGC3Dushort; +typedef int WGC3Dint; +typedef int WGC3Dsizei; +typedef unsigned int WGC3Duint; +typedef float WGC3Dfloat; +typedef float WGC3Dclampf; +typedef signed long int WGC3Dintptr; +typedef signed long int WGC3Dsizeiptr; + +// Typedef for server-side objects like OpenGL textures and program objects. +typedef WGC3Duint WebGLId; + +// FIXME: We shouldn't mention WebView in platform. +class WebView; + +// This interface abstracts the operations performed by the +// GraphicsContext3D in order to implement WebGL. Nearly all of the +// methods exposed on this interface map directly to entry points in +// the OpenGL ES 2.0 API. +// +// Creating a WebGraphicsContext does not make it current, or guarantee +// that the context has been created successfully. Use +// makeContextCurrent() to complete initialization of the context, treating +// a false return value as indication that the context could not be created +// successfully. +class WebGraphicsContext3D : public WebNonCopyable { +public: + // Return value from getActiveUniform and getActiveAttrib. + struct ActiveInfo { + WebString name; + WGC3Denum type; + WGC3Dint size; + }; + + // Context creation attributes. + struct Attributes { + Attributes() + : alpha(true) + , depth(true) + , stencil(true) + , antialias(true) + , premultipliedAlpha(true) + , canRecoverFromContextLoss(true) + , noExtensions(false) + , shareResources(true) + , forUseOnAnotherThread(false) + { + } + + bool alpha; + bool depth; + bool stencil; + bool antialias; + bool premultipliedAlpha; + bool canRecoverFromContextLoss; + bool noExtensions; + bool shareResources; + bool forUseOnAnotherThread; + }; + + class WebGraphicsContextLostCallback { + public: + virtual void onContextLost() = 0; + virtual ~WebGraphicsContextLostCallback() { } + }; + + class WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { + public: + virtual void onSwapBuffersComplete() = 0; + virtual ~WebGraphicsSwapBuffersCompleteCallbackCHROMIUM() { } + }; + + // This destructor needs to be public so that using classes can destroy instances if initialization fails. + virtual ~WebGraphicsContext3D() {} + + // Initializes the graphics context; should be the first operation performed + // on newly-constructed instances. Returns true on success. + virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0; + + // Makes the OpenGL context current on the current thread. Returns true on + // success. + virtual bool makeContextCurrent() = 0; + + // The size of the region into which this WebGraphicsContext3D is rendering. + // Returns the last values passed to reshape(). + virtual int width() = 0; + virtual int height() = 0; + + // Resizes the region into which this WebGraphicsContext3D is drawing. + virtual void reshape(int width, int height) = 0; + + // GL_CHROMIUM_setVisibility - Changes the visibility of the backbuffer + virtual void setVisibilityCHROMIUM(bool visible) = 0; + + // Query whether it is built on top of compliant GLES2 implementation. + virtual bool isGLES2Compliant() = 0; + + virtual bool setParentContext(WebGraphicsContext3D* parentContext) { return false; } + + // Helper for software compositing path. Reads back the frame buffer into + // the memory region pointed to by "pixels" with size "bufferSize". It is + // expected that the storage for "pixels" covers (4 * width * height) bytes. + // Returns true on success. + virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, WebGLId framebuffer, int width, int height) = 0; + + // Returns the id of the texture which is used for storing the contents of + // the framebuffer associated with this context. This texture is accessible + // by the gpu-based page compositor. + virtual WebGLId getPlatformTextureId() = 0; + + // Copies the contents of the off-screen render target used by the WebGL + // context to the corresponding texture used by the compositor. + virtual void prepareTexture() = 0; + + // GL_CHROMIUM_post_sub_buffer - Copies part of the back buffer to the front buffer. + virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) = 0; + + // Synthesizes an OpenGL error which will be returned from a + // later call to getError. This is used to emulate OpenGL ES + // 2.0 behavior on the desktop and to enforce additional error + // checking mandated by WebGL. + // + // Per the behavior of glGetError, this stores at most one + // instance of any given error, and returns them from calls to + // getError in the order they were added. + virtual void synthesizeGLError(WGC3Denum) = 0; + + virtual bool isContextLost() = 0; + + // GL_CHROMIUM_map_sub + virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) = 0; + virtual void unmapBufferSubDataCHROMIUM(const void*) = 0; + virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) = 0; + virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0; + + // GL_CHROMIUM_request_extension + virtual WebString getRequestableExtensionsCHROMIUM() = 0; + virtual void requestExtensionCHROMIUM(const char*) = 0; + + // GL_CHROMIUM_framebuffer_multisample + virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) = 0; + virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; + + // GL_CHROMIUM_swapbuffers_complete_callback + virtual void setSwapBuffersCompleteCallbackCHROMIUM(WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback) { } + + // GL_CHROMIUM_rate_limit_offscreen_context + virtual void rateLimitOffscreenContextCHROMIUM() { } + + // The entry points below map directly to the OpenGL ES 2.0 API. + // See: http://www.khronos.org/registry/gles/ + // and: http://www.khronos.org/opengles/sdk/docs/man/ + virtual void activeTexture(WGC3Denum texture) = 0; + virtual void attachShader(WebGLId program, WebGLId shader) = 0; + virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) = 0; + virtual void bindBuffer(WGC3Denum target, WebGLId buffer) = 0; + virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) = 0; + virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) = 0; + virtual void bindTexture(WGC3Denum target, WebGLId texture) = 0; + virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; + virtual void blendEquation(WGC3Denum mode) = 0; + virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) = 0; + virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) = 0; + virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) = 0; + + virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) = 0; + virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) = 0; + + virtual WGC3Denum checkFramebufferStatus(WGC3Denum target) = 0; + virtual void clear(WGC3Dbitfield mask) = 0; + virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; + virtual void clearDepth(WGC3Dclampf depth) = 0; + virtual void clearStencil(WGC3Dint s) = 0; + virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) = 0; + virtual void compileShader(WebGLId shader) = 0; + + virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) = 0; + virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) = 0; + virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) = 0; + virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void cullFace(WGC3Denum mode) = 0; + virtual void depthFunc(WGC3Denum func) = 0; + virtual void depthMask(WGC3Dboolean flag) = 0; + virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) = 0; + virtual void detachShader(WebGLId program, WebGLId shader) = 0; + virtual void disable(WGC3Denum cap) = 0; + virtual void disableVertexAttribArray(WGC3Duint index) = 0; + virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) = 0; + virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) = 0; + + virtual void enable(WGC3Denum cap) = 0; + virtual void enableVertexAttribArray(WGC3Duint index) = 0; + virtual void finish() = 0; + virtual void flush() = 0; + virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) = 0; + virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) = 0; + virtual void frontFace(WGC3Denum mode) = 0; + virtual void generateMipmap(WGC3Denum target) = 0; + + virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; + virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; + virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) = 0; + virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) = 0; + virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) = 0; + virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual Attributes getContextAttributes() = 0; + virtual WGC3Denum getError() = 0; + virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WebString getProgramInfoLog(WebGLId program) = 0; + virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WebString getShaderInfoLog(WebGLId shader) = 0; + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + virtual WebString getShaderSource(WebGLId shader) = 0; + virtual WebString getString(WGC3Denum name) = 0; + virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) = 0; + virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) = 0; + virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) = 0; + virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) = 0; + + virtual void hint(WGC3Denum target, WGC3Denum mode) = 0; + virtual WGC3Dboolean isBuffer(WebGLId buffer) = 0; + virtual WGC3Dboolean isEnabled(WGC3Denum cap) = 0; + virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) = 0; + virtual WGC3Dboolean isProgram(WebGLId program) = 0; + virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) = 0; + virtual WGC3Dboolean isShader(WebGLId shader) = 0; + virtual WGC3Dboolean isTexture(WebGLId texture) = 0; + virtual void lineWidth(WGC3Dfloat) = 0; + virtual void linkProgram(WebGLId program) = 0; + virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) = 0; + virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) = 0; + + virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) = 0; + + virtual void releaseShaderCompiler() = 0; + + virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) = 0; + virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) = 0; + virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; + virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; + virtual void stencilMask(WGC3Duint mask) = 0; + virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) = 0; + virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; + virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; + + virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; + + virtual void texParameterf(WGC3Denum target, WGC3Denum pname, WGC3Dfloat param) = 0; + virtual void texParameteri(WGC3Denum target, WGC3Denum pname, WGC3Dint param) = 0; + + virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; + + virtual void uniform1f(WGC3Dint location, WGC3Dfloat x) = 0; + virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform1i(WGC3Dint location, WGC3Dint x) = 0; + virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y) = 0; + virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y) = 0; + virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform3f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; + virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z) = 0; + virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; + virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w) = 0; + virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniformMatrix2fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + virtual void uniformMatrix3fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + virtual void uniformMatrix4fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + + virtual void useProgram(WebGLId program) = 0; + virtual void validateProgram(WebGLId program) = 0; + + virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x) = 0; + virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y) = 0; + virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib3f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; + virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib4f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; + virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, + WGC3Dsizei stride, WGC3Dintptr offset) = 0; + + virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + + // Support for buffer creation and deletion. + virtual WebGLId createBuffer() = 0; + virtual WebGLId createFramebuffer() = 0; + virtual WebGLId createProgram() = 0; + virtual WebGLId createRenderbuffer() = 0; + virtual WebGLId createShader(WGC3Denum) = 0; + virtual WebGLId createTexture() = 0; + + virtual void deleteBuffer(WebGLId) = 0; + virtual void deleteFramebuffer(WebGLId) = 0; + virtual void deleteProgram(WebGLId) = 0; + virtual void deleteRenderbuffer(WebGLId) = 0; + virtual void deleteShader(WebGLId) = 0; + virtual void deleteTexture(WebGLId) = 0; + + virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) {} + // GL_ARB_robustness + // + // This entry point must provide slightly different semantics than + // the GL_ARB_robustness extension; specifically, the lost context + // state is sticky, rather than reported only once. + virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ } + + // FIXME: make this function pure virtual once it is implemented in + // both command buffer port and in-process port. + virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) { return WebString(); } + + // GL_CHROMIUM_iosurface + virtual void texImageIOSurface2DCHROMIUM(WGC3Denum target, WGC3Dint width, WGC3Dint height, WGC3Duint ioSurfaceId, WGC3Duint plane) { } + + // GL_EXT_texture_storage + virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, + WGC3Dint width, WGC3Dint height) { } + + +#if WEBKIT_USING_SKIA + GrGLInterface* createGrGLInterface(); +#endif + +protected: +#if WEBKIT_USING_SKIA + virtual GrGLInterface* onCreateGrGLInterface() { return 0; } +#endif + +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPBody.h b/Source/WebKit/chromium/public/platform/WebHTTPBody.h new file mode 100644 index 000000000..e97856320 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPBody.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebHTTPBody_h +#define WebHTTPBody_h + +#include "WebData.h" +#include "WebNonCopyable.h" +#include "WebString.h" +#include "WebURL.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FormData; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebHTTPBodyPrivate; + +class WebHTTPBody { +public: + struct Element { + enum Type { TypeData, TypeFile, TypeBlob } type; + WebData data; + WebString filePath; + long long fileStart; + long long fileLength; // -1 means to the end of the file. + double modificationTime; + WebURL blobURL; + }; + + ~WebHTTPBody() { reset(); } + + WebHTTPBody() : m_private(0) { } + WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } + WebHTTPBody& operator=(const WebHTTPBody& b) + { + assign(b); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebHTTPBody&); + + bool isNull() const { return !m_private; } + + // Returns the number of elements comprising the http body. + WEBKIT_EXPORT size_t elementCount() const; + + // Sets the values of the element at the given index. Returns false if + // index is out of bounds. + WEBKIT_EXPORT bool elementAt(size_t index, Element&) const; + + // Append to the list of elements. + WEBKIT_EXPORT void appendData(const WebData&); + WEBKIT_EXPORT void appendFile(const WebString&); + // Passing -1 to fileLength means to the end of the file. + WEBKIT_EXPORT void appendFileRange(const WebString&, long long fileStart, long long fileLength, double modificationTime); + WEBKIT_EXPORT void appendBlob(const WebURL&); + + // Identifies a particular form submission instance. A value of 0 is + // used to indicate an unspecified identifier. + WEBKIT_EXPORT long long identifier() const; + WEBKIT_EXPORT void setIdentifier(long long); + +#if WEBKIT_IMPLEMENTATION + WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); + WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); + operator WTF::PassRefPtr<WebCore::FormData>() const; +#endif + +private: + void assign(WebHTTPBodyPrivate*); + void ensureMutable(); + WebHTTPBodyPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h new file mode 100644 index 000000000..2ca86c01c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebHTTPHeaderVisitor_h +#define WebHTTPHeaderVisitor_h + +namespace WebKit { + +class WebString; + +class WebHTTPHeaderVisitor { +public: + virtual void visitHeader(const WebString& name, const WebString& value) = 0; + +protected: + ~WebHTTPHeaderVisitor() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h new file mode 100644 index 000000000..09bf16992 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebHTTPLoadInfo_h +#define WebHTTPLoadInfo_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +struct ResourceLoadInfo; +} + +namespace WebKit { +class WebString; + +class WebHTTPLoadInfo { +public: + WebHTTPLoadInfo() { initialize(); } + ~WebHTTPLoadInfo() { reset(); } + WebHTTPLoadInfo(const WebHTTPLoadInfo& r) { assign(r); } + WebHTTPLoadInfo& operator =(const WebHTTPLoadInfo& r) + { + assign(r); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebHTTPLoadInfo& r); + + WEBKIT_EXPORT int httpStatusCode() const; + WEBKIT_EXPORT void setHTTPStatusCode(int); + + WEBKIT_EXPORT WebString httpStatusText() const; + WEBKIT_EXPORT void setHTTPStatusText(const WebString&); + + WEBKIT_EXPORT long long encodedDataLength() const; + WEBKIT_EXPORT void setEncodedDataLength(long long); + + WEBKIT_EXPORT void addRequestHeader(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addResponseHeader(const WebString& name, const WebString& value); + + WEBKIT_EXPORT WebString requestHeadersText() const; + WEBKIT_EXPORT void setRequestHeadersText(const WebString&); + + WEBKIT_EXPORT WebString responseHeadersText() const; + WEBKIT_EXPORT void setResponseHeadersText(const WebString&); + +#if WEBKIT_IMPLEMENTATION + WebHTTPLoadInfo(WTF::PassRefPtr<WebCore::ResourceLoadInfo>); + operator WTF::PassRefPtr<WebCore::ResourceLoadInfo>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadInfo> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebImage.h b/Source/WebKit/chromium/public/platform/WebImage.h new file mode 100644 index 000000000..bf0e9722e --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebImage.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebImage_h +#define WebImage_h + +#include "WebCommon.h" + +#if WEBKIT_USING_SKIA +#include <SkBitmap.h> +#elif WEBKIT_USING_CG +typedef struct CGImage* CGImageRef; +#endif + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Image; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebData; +struct WebSize; + +// A container for an ARGB bitmap. +class WebImage { +public: + ~WebImage() { reset(); } + + WebImage() { init(); } + WebImage(const WebImage& image) + { + init(); + assign(image); + } + + WebImage& operator=(const WebImage& image) + { + assign(image); + return *this; + } + + // Decodes the given image data. If the image has multiple frames, + // then the frame whose size is desiredSize is returned. Otherwise, + // the first frame is returned. + WEBKIT_EXPORT static WebImage fromData(const WebData&, const WebSize& desiredSize); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebImage&); + + WEBKIT_EXPORT bool isNull() const; + WEBKIT_EXPORT WebSize size() const; + +#if WEBKIT_IMPLEMENTATION + WebImage(const WTF::PassRefPtr<WebCore::Image>&); + WebImage& operator=(const WTF::PassRefPtr<WebCore::Image>&); +#endif + +#if WEBKIT_USING_SKIA + WebImage(const SkBitmap& bitmap) : m_bitmap(bitmap) { } + + WebImage& operator=(const SkBitmap& bitmap) + { + m_bitmap = bitmap; + return *this; + } + + SkBitmap& getSkBitmap() { return m_bitmap; } + const SkBitmap& getSkBitmap() const { return m_bitmap; } + +private: + void init() { } + SkBitmap m_bitmap; + +#elif WEBKIT_USING_CG + WebImage(CGImageRef imageRef) + { + init(); + assign(imageRef); + } + + WebImage& operator=(CGImageRef imageRef) + { + assign(imageRef); + return *this; + } + + CGImageRef getCGImageRef() const { return m_imageRef; } + +private: + void init() { m_imageRef = 0; } + WEBKIT_EXPORT void assign(CGImageRef); + CGImageRef m_imageRef; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h new file mode 100644 index 000000000..6c0e74f12 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -0,0 +1,347 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebKitPlatformSupport_h +#define WebKitPlatformSupport_h + +#include "WebAudioBus.h" +#include "WebAudioDevice.h" +#include "WebCommon.h" +#include "WebData.h" +#include "WebGamepads.h" +#include "WebLocalizedString.h" +#include "WebSerializedScriptValue.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +#include <time.h> + +#ifdef WIN32 +typedef void *HANDLE; +#endif + +namespace WebKit { + +class WebApplicationCacheHost; // FIXME: Does this belong in platform? +class WebApplicationCacheHostClient; // FIXME: Does this belong in platform? +class WebBlobRegistry; +class WebClipboard; +class WebCookieJar; +class WebFileSystem; +class WebFileUtilities; +class WebGraphicsContext3D; +class WebIDBFactory; // FIXME: Does this belong in platform? +class WebIDBKey; // FIXME: Does this belong in platform? +class WebMessagePortChannel; // FIXME: Does this belong in platform? +class WebMimeRegistry; +class WebPeerConnectionHandler; +class WebPeerConnectionHandlerClient; +class WebPluginListBuilder; // FIXME: Does this belong in platform? +class WebSandboxSupport; +class WebSharedWorkerRepository; // FIXME: Does this belong in platform? +class WebSocketStreamHandle; +class WebStorageNamespace; // FIXME: Does this belong in platform? +class WebThemeEngine; +class WebThread; +class WebURLLoader; +class WebWorkerRunLoop; + +class WebKitPlatformSupport { +public: + // Must return non-null. + virtual WebClipboard* clipboard() { return 0; } + + // Must return non-null. + virtual WebMimeRegistry* mimeRegistry() { return 0; } + + // Must return non-null. + virtual WebFileUtilities* fileUtilities() { return 0; } + + // May return null if sandbox support is not necessary + virtual WebSandboxSupport* sandboxSupport() { return 0; } + + // May return null on some platforms. + virtual WebThemeEngine* themeEngine() { return 0; } + + // May return null. + virtual WebCookieJar* cookieJar() { return 0; } + + // Blob ---------------------------------------------------------------- + + // Must return non-null. + virtual WebBlobRegistry* blobRegistry() { return 0; } + + // DOM Storage -------------------------------------------------- + + // Return a LocalStorage namespace that corresponds to the following path. + virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } + + // Called when storage events fire. + virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, + const WebString& newValue, const WebString& origin, + const WebURL& url, bool isLocalStorage) { } + + + // Gamepad ------------------------------------------------------------- + + virtual void sampleGamepads(WebGamepads& into) { into.length = 0; } + + + // History ------------------------------------------------------------- + + // Returns the hash for the given canonicalized URL for use in visited + // link coloring. + virtual unsigned long long visitedLinkHash( + const char* canonicalURL, size_t length) { return 0; } + + // Returns whether the given link hash is in the user's history. The + // hash must have been generated by calling VisitedLinkHash(). + virtual bool isLinkVisited(unsigned long long linkHash) { return false; } + + + // HTML5 Database ------------------------------------------------------ + +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + + // Opens a database file; dirHandle should be 0 if the caller does not need + // a handle to the directory containing this file + virtual FileHandle databaseOpenFile( + const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } + + // Deletes a database file and returns the error code + virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } + + // Returns the attributes of the given database file + virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; } + + // Returns the size of the given database file + virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } + + // Returns the space available for the given origin + virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; } + + // Indexed Database ---------------------------------------------------- + + virtual WebIDBFactory* idbFactory() { return 0; } + virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebString& keyPath, WebVector<WebIDBKey>& keys) { } + virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebString& keyPath) { return WebSerializedScriptValue(); } + + + // Keygen -------------------------------------------------------------- + + // Handle the <keygen> tag for generating client certificates + // Returns a base64 encoded signed copy of a public key from a newly + // generated key pair and the supplied challenge string. keySizeindex + // specifies the strength of the key. + virtual WebString signedPublicKeyAndChallengeString(unsigned keySizeIndex, + const WebKit::WebString& challenge, + const WebKit::WebURL& url) { return WebString(); } + + + + // Memory -------------------------------------------------------------- + + // Returns the current space allocated for the pagefile, in MB. + // That is committed size for Windows and virtual memory size for POSIX + virtual size_t memoryUsageMB() { return 0; } + + // Same as above, but always returns actual value, without any caches. + virtual size_t actualMemoryUsageMB() { return 0; } + + // If memory usage is below this threshold, do not bother forcing GC. + virtual size_t lowMemoryUsageMB() { return 256; } + + // If memory usage is above this threshold, force GC more aggressively. + virtual size_t highMemoryUsageMB() { return 1024; } + + // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high. + virtual size_t highUsageDeltaMB() { return 128; } + + + // Threads ------------------------------------------------------- + + // Creates an embedder-defined thread. + virtual WebThread* createThread(const char* name) { return 0; } + + // Returns an interface to the current thread. This is owned by the + // embedder. + virtual WebThread* currentThread() { return 0; } + + + // Message Ports ------------------------------------------------------- + + // Creates a Message Port Channel. This can be called on any thread. + // The returned object should only be used on the thread it was created on. + virtual WebMessagePortChannel* createMessagePortChannel() { return 0; } + + + // Network ------------------------------------------------------------- + + // A suggestion to prefetch IP information for the given hostname. + virtual void prefetchHostName(const WebString&) { } + + // Returns a new WebURLLoader instance. + virtual WebURLLoader* createURLLoader() { return 0; } + + // Returns a new WebSocketStreamHandle instance. + virtual WebSocketStreamHandle* createSocketStreamHandle() { return 0; } + + // Returns the User-Agent string that should be used for the given URL. + virtual WebString userAgent(const WebURL&) { return WebString(); } + + // A suggestion to cache this metadata in association with this URL. + virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { } + + + // Plugins ------------------------------------------------------------- + + // If refresh is true, then cached information should not be used to + // satisfy this call. + virtual void getPluginList(bool refresh, WebPluginListBuilder*) { } + + + // Profiling ----------------------------------------------------------- + + virtual void decrementStatsCounter(const char* name) { } + virtual void incrementStatsCounter(const char* name) { } + + // An event is identified by the pair (name, id). The extra parameter + // specifies additional data to log with the event. + virtual bool isTraceEventEnabled() const { return true; } + virtual void traceEventBegin(const char* name, void* id, const char* extra) { } + virtual void traceEventEnd(const char* name, void* id, const char* extra) { } + + // Callbacks for reporting histogram data. + // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do. + virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { } + // Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value. + virtual void histogramEnumeration(const char* name, int sample, int boundaryValue) { } + + + // Resources ----------------------------------------------------------- + + // Returns a blob of data corresponding to the named resource. + virtual WebData loadResource(const char* name) { return WebData(); } + + // Decodes the in-memory audio file data and returns the linear PCM audio data in the destinationBus. + // A sample-rate conversion to sampleRate will occur if the file data is at a different sample-rate. + // Returns true on success. + virtual bool loadAudioResource(WebAudioBus* destinationBus, const char* audioFileData, size_t dataSize, double sampleRate) { return false; } + + // Returns a localized string resource (with substitution parameters). + virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); } + virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter) { return WebString(); } + virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter1, const WebString& parameter2) { return WebString(); } + + + // Sandbox ------------------------------------------------------------ + + // In some browsers, a "sandbox" restricts what operations a program + // is allowed to preform. Such operations are typically abstracted out + // via this API, but sometimes (like in HTML 5 database opening) WebKit + // needs to behave differently based on whether it's restricted or not. + // In these cases (and these cases only) you can call this function. + // It's OK for this value to be conservitive (i.e. true even if the + // sandbox isn't active). + virtual bool sandboxEnabled() { return false; } + + + // Shared Workers ------------------------------------------------------ + + virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } + + // Sudden Termination -------------------------------------------------- + + // Disable/Enable sudden termination. + virtual void suddenTerminationChanged(bool enabled) { } + + + // System -------------------------------------------------------------- + + // Returns a value such as "en-US". + virtual WebString defaultLocale() { return WebString(); } + + // Wall clock time in seconds since the epoch. + virtual double currentTime() { return 0; } + + // Monotonically increasing time in seconds from an arbitrary fixed point in the past. + // This function is expected to return at least millisecond-precision values. For this reason, + // it is recommended that the fixed point be no further in the past than the epoch. + virtual double monotonicallyIncreasingTime() { return 0; } + + // WebKit clients must implement this funcion if they use cryptographic randomness. + virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0; + + // Delayed work is driven by a shared timer. + typedef void (*SharedTimerFunction)(); + virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) { } + virtual void setSharedTimerFireInterval(double) { } + virtual void stopSharedTimer() { } + + // Callable from a background WebKit thread. + virtual void callOnMainThread(void (*func)(void*), void* context) { } + + // WebGL -------------------------------------------------------------- + + // May return null if WebGL is not supported. + // Returns newly allocated WebGraphicsContext3D instance. + virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } + + // Audio -------------------------------------------------------------- + + virtual double audioHardwareSampleRate() { return 0; } + virtual size_t audioHardwareBufferSize() { return 0; } + virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; } + + // FileSystem ---------------------------------------------------------- + + // Must return non-null. + virtual WebFileSystem* fileSystem() { return 0; } + + // WebRTC ---------------------------------------------------------- + + // May return null if WebRTC functionality is not avaliable or out of resources. + virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; } + + virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } + virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { } + +protected: + ~WebKitPlatformSupport() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebLayer.h b/Source/WebKit/chromium/public/platform/WebLayer.h new file mode 100644 index 000000000..3d919fa46 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayer.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebLayer_h +#define WebLayer_h + +#include "WebColor.h" +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +class SkMatrix44; +namespace WebCore { class LayerChromium; } + +namespace WebKit { +struct WebFloatPoint; +struct WebSize; + +class WebLayer { +public: + WEBKIT_EXPORT static WebLayer create(); + + WebLayer() { } + WebLayer(const WebLayer& layer) { assign(layer); } + virtual ~WebLayer() { reset(); } + WebLayer& operator=(const WebLayer& layer) + { + assign(layer); + return *this; + } + bool isNull() { return m_private.isNull(); } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebLayer&); + WEBKIT_EXPORT bool equals(const WebLayer&) const; + + WEBKIT_EXPORT WebLayer rootLayer() const; + WEBKIT_EXPORT WebLayer parent() const; + WEBKIT_EXPORT void addChild(const WebLayer&); + WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index); + WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer); + WEBKIT_EXPORT void removeFromParent(); + WEBKIT_EXPORT void removeAllChildren(); + + WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&); + WEBKIT_EXPORT WebFloatPoint anchorPoint() const; + + WEBKIT_EXPORT void setAnchorPointZ(float); + WEBKIT_EXPORT float anchorPointZ() const; + + WEBKIT_EXPORT void setBounds(const WebSize&); + WEBKIT_EXPORT WebSize bounds() const; + + WEBKIT_EXPORT void setMasksToBounds(bool); + WEBKIT_EXPORT bool masksToBounds() const; + + WEBKIT_EXPORT void setMaskLayer(const WebLayer&); + WEBKIT_EXPORT WebLayer maskLayer() const; + + WEBKIT_EXPORT void setOpacity(float); + WEBKIT_EXPORT float opacity() const; + + WEBKIT_EXPORT void setOpaque(bool); + WEBKIT_EXPORT bool opaque() const; + + WEBKIT_EXPORT void setPosition(const WebFloatPoint&); + WEBKIT_EXPORT WebFloatPoint position() const; + + WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&); + WEBKIT_EXPORT SkMatrix44 sublayerTransform() const; + + WEBKIT_EXPORT void setTransform(const SkMatrix44&); + WEBKIT_EXPORT SkMatrix44 transform() const; + + WEBKIT_EXPORT void setDebugBorderColor(const WebColor&); + WEBKIT_EXPORT void setDebugBorderWidth(float); + + template<typename T> T to() + { + T res; + res.WebLayer::assign(*this); + return res; + } + + template<typename T> const T toConst() const + { + T res; + res.WebLayer::assign(*this); + return res; + } + +#if WEBKIT_IMPLEMENTATION + WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&); + WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&); + operator WTF::PassRefPtr<WebCore::LayerChromium>() const; + template<typename T> T* unwrap() + { + return static_cast<T*>(m_private.get()); + } + + template<typename T> const T* constUnwrap() const + { + return static_cast<const T*>(m_private.get()); + } +#endif + +protected: + WebPrivatePtr<WebCore::LayerChromium> m_private; +}; + +inline bool operator==(const WebLayer& a, const WebLayer& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebLayer& a, const WebLayer& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif // WebLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeView.h b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h new file mode 100644 index 000000000..0263b3926 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebLayerTreeView_h +#define WebLayerTreeView_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class CCLayerTreeHost; +struct CCSettings; +} + +namespace WebKit { +class WebLayer; +class WebLayerTreeViewClient; +struct WebRect; +struct WebSize; + +class WebLayerTreeView { +public: + struct Settings { + Settings() + : acceleratePainting(false) + , compositeOffscreen(false) + , showFPSCounter(false) + , showPlatformLayerTree(false) + , refreshRate(0) + , partialSwapEnabled(false) { } + + bool acceleratePainting; + bool compositeOffscreen; + bool showFPSCounter; + bool showPlatformLayerTree; + double refreshRate; + bool partialSwapEnabled; +#if WEBKIT_IMPLEMENTATION + operator WebCore::CCSettings() const; +#endif + }; + + WEBKIT_EXPORT static WebLayerTreeView create(WebLayerTreeViewClient*, const WebLayer& root, const Settings&); + + WebLayerTreeView() { } + WebLayerTreeView(const WebLayerTreeView& layer) { assign(layer); } + ~WebLayerTreeView() { reset(); } + WebLayerTreeView& operator=(const WebLayerTreeView& layer) + { + assign(layer); + return *this; + } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebLayerTreeView&); + WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const; + + // Triggers a compositing pass. If the compositor thread was not + // enabled via WebCompositor::initialize, the compositing pass happens + // immediately. If it is enabled, the compositing pass will happen at a + // later time. Before the compositing pass happens (i.e. before composite() + // returns when the compositor thread is disabled), WebContentLayers will be + // asked to paint their dirty region, through + // WebContentLayerClient::paintContents. + WEBKIT_EXPORT void composite(); + + WEBKIT_EXPORT void setViewportSize(const WebSize&); + WEBKIT_EXPORT WebSize viewportSize() const; + + // Composites and attempts to read back the result into the provided + // buffer. If it wasn't possible, e.g. due to context lost, will return + // false. Pixel format is 32bit (RGBA), and the provided buffer must be + // large enough contain viewportSize().width() * viewportSize().height() + // pixels. The WebLayerTreeView does not assume ownership of the buffer. + // The buffer is not modified if the false is returned. + WEBKIT_EXPORT bool compositeAndReadback(void *pixels, const WebRect&); + + // Sets the root of the tree. The root is set by way of the constructor. + // This is typically used to explicitly set the root to null to break + // cycles. + WEBKIT_EXPORT void setRootLayer(WebLayer*); + +#if WEBKIT_IMPLEMENTATION + WebLayerTreeView(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); + WebLayerTreeView& operator=(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); + operator WTF::PassRefPtr<WebCore::CCLayerTreeHost>() const; +#endif + +protected: + WebPrivatePtr<WebCore::CCLayerTreeHost> m_private; +}; + +inline bool operator==(const WebLayerTreeView& a, const WebLayerTreeView& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebLayerTreeView& a, const WebLayerTreeView& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif // WebLayerTreeView_h diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h new file mode 100644 index 000000000..9c4dfb77b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +#ifndef WebLayerTreeViewClient_h +#define WebLayerTreeViewClient_h + +namespace WebKit { +class WebGraphicsContext3D; +struct WebSize; +class WebThread; + +class WebLayerTreeViewClient { +public: + // Updates animation and layout. These are called before the compositing + // pass so that layers can be updated at the given frame time. + virtual void updateAnimations(double frameBeginTime) = 0; + virtual void layout() = 0; + + // Applies a scroll delta to the root layer, which is bundled with a page + // scale factor that may apply a CSS transform on the whole document (used + // for mobile-device pinch zooming). This is triggered by events sent to the + // compositor thread through the WebCompositor interface. + virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0; + + // Creates a 3D context suitable for the compositing. This may be called + // more than once if the context gets lost. + virtual WebGraphicsContext3D* createContext3D() = 0; + + // Signals a successful rebinding of the 3D context (e.g. after a lost + // context event). + virtual void didRebindGraphicsContext(bool success) = 0; + + // Schedules a compositing pass, meaning the client should call + // WebLayerTreeView::composite at a later time. This is only called if the + // compositor thread is disabled; when enabled, the compositor will + // internally schedule a compositing pass when needed. + virtual void scheduleComposite() = 0; + +protected: + virtual ~WebLayerTreeViewClient() { } +}; + +} // namespace WebKit + +#endif // WebLayerTreeViewClient_h diff --git a/Source/WebKit/chromium/public/platform/WebLocalizedString.h b/Source/WebKit/chromium/public/platform/WebLocalizedString.h new file mode 100644 index 000000000..0483df90b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLocalizedString.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebLocalizedString_h +#define WebLocalizedString_h + +namespace WebKit { + +struct WebLocalizedString { + enum Name { + DetailsLabel, + SubmitButtonDefaultLabel, + InputElementAltText, + ResetButtonDefaultLabel, + FileButtonChooseFileLabel, + FileButtonChooseMultipleFilesLabel, + FileButtonNoFileSelectedLabel, + MultipleFileUploadText, + SearchableIndexIntroduction, + SearchMenuNoRecentSearchesText, + SearchMenuRecentSearchesText, + SearchMenuClearRecentSearchesText, + AXWebAreaText, + AXLinkText, + AXListMarkerText, + AXImageMapText, + AXHeadingText, + AXButtonActionVerb, + AXRadioButtonActionVerb, + AXTextFieldActionVerb, + AXCheckedCheckBoxActionVerb, + AXUncheckedCheckBoxActionVerb, + AXLinkActionVerb, + KeygenMenuHighGradeKeySize, + KeygenMenuMediumGradeKeySize, + ValidationValueMissing, + ValidationValueMissingForCheckbox, + ValidationValueMissingForFile, + ValidationValueMissingForMultipleFile, + ValidationValueMissingForRadio, + ValidationValueMissingForSelect, + ValidationTypeMismatch, + ValidationTypeMismatchForEmail, + ValidationTypeMismatchForMultipleEmail, + ValidationTypeMismatchForURL, + ValidationPatternMismatch, + ValidationTooLong, + ValidationRangeUnderflow, + ValidationRangeOverflow, + ValidationStepMismatch, + }; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h new file mode 100644 index 000000000..52c63d321 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google 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. + */ + +#ifndef WebMediaStreamDescriptor_h +#define WebMediaStreamDescriptor_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebPrivatePtr.h" +#include "WebVector.h" + +namespace WebCore { +class MediaStreamDescriptor; +} + +namespace WebKit { + +class WebMediaStreamSource; +class WebString; + +class WebMediaStreamDescriptor { +public: + WebMediaStreamDescriptor() { } + ~WebMediaStreamDescriptor() { reset(); } + + WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>&); + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebString label() const; + WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); + operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const; + operator WebCore::MediaStreamDescriptor*() const; + WebMediaStreamDescriptor& operator=(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamDescriptor> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamDescriptor_h diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h new file mode 100644 index 000000000..b65e996bd --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebMediaStreamSource_h +#define WebMediaStreamSource_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class MediaStreamSource; +} + +namespace WebKit { + +class WebString; + +class WebMediaStreamSource { +public: + enum Type { + TypeAudio, + TypeVideo + }; + + WebMediaStreamSource() { } + ~WebMediaStreamSource() { reset(); } + + WEBKIT_EXPORT void initialize(const WebString& id, Type, const WebString& name); + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebString id() const; + WEBKIT_EXPORT Type type() const; + WEBKIT_EXPORT WebString name() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&); + WebMediaStreamSource& operator=(WebCore::MediaStreamSource*); + operator WTF::PassRefPtr<WebCore::MediaStreamSource>() const; + operator WebCore::MediaStreamSource*() const; +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamSource> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamSource_h diff --git a/Source/WebKit/chromium/public/platform/WebMimeRegistry.h b/Source/WebKit/chromium/public/platform/WebMimeRegistry.h new file mode 100644 index 000000000..4137b0756 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMimeRegistry.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ + +// This is a temporary forwarding header to ease the Platform transition for downstream users of the WebKit API. +// See https://bugs.webkit.org/show_bug.cgi?id=74583 +// FIXME: Remove as soon as downstream clients are updated. +#include "../../../../Platform/chromium/public/WebMimeRegistry.h" diff --git a/Source/WebKit/chromium/public/platform/WebNonCopyable.h b/Source/WebKit/chromium/public/platform/WebNonCopyable.h new file mode 100644 index 000000000..b0bd4565c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebNonCopyable.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebNonCopyable_h +#define WebNonCopyable_h + +namespace WebKit { + +// A base class to extend from if you do not support copying. +class WebNonCopyable { +protected: + WebNonCopyable() { } + ~WebNonCopyable() { } + +private: + WebNonCopyable(const WebNonCopyable&); + WebNonCopyable& operator=(const WebNonCopyable&); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h new file mode 100644 index 000000000..7586abc03 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPeerConnectionHandler_h +#define WebPeerConnectionHandler_h + +#include "../WebSecurityOrigin.h" // FIXME: This is a layering violation. +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +class WebMediaStreamDescriptor; +class WebPeerConnectionHandlerClient; + +// Note: +// SDP stands for Session Description Protocol, which is intended for describing +// multimedia sessions for the purposes of session announcement, session +// invitation, and other forms of multimedia session initiation. +// +// More information can be found here: +// http://tools.ietf.org/html/rfc4566 +// http://en.wikipedia.org/wiki/Session_Description_Protocol + + +class WebPeerConnectionHandler { +public: + virtual ~WebPeerConnectionHandler() { } + + virtual void initialize(const WebString& serverConfiguration, const WebSecurityOrigin&) = 0; + + virtual void produceInitialOffer(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams) = 0; + virtual void handleInitialOffer(const WebString& sdp) = 0; + virtual void processSDP(const WebString& sdp) = 0; + virtual void processPendingStreams(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams, const WebVector<WebMediaStreamDescriptor>& pendingRemoveStreams) = 0; + virtual void sendDataStreamMessage(const char* data, size_t length) = 0; + + virtual void stop() = 0; +}; + +} // namespace WebKit + +#endif // WebPeerConnectionHandler_h diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h new file mode 100644 index 000000000..f2b1d3297 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPeerConnectionHandlerClient_h +#define WebPeerConnectionHandlerClient_h + +namespace WebKit { + +class WebMediaStreamDescriptor; +class WebString; + +class WebPeerConnectionHandlerClient { +public: + virtual ~WebPeerConnectionHandlerClient() { } + + virtual void didCompleteICEProcessing() = 0; + virtual void didGenerateSDP(const WebString& sdp) = 0; + virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0; + virtual void didAddRemoteStream(const WebMediaStreamDescriptor&) = 0; + virtual void didRemoveRemoteStream(const WebMediaStreamDescriptor&) = 0; +}; + +} // namespace WebKit + +#endif // WebPeerConnectionHandlerClient_h diff --git a/Source/WebKit/chromium/public/platform/WebPoint.h b/Source/WebKit/chromium/public/platform/WebPoint.h new file mode 100644 index 000000000..766236398 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPoint.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPoint_h +#define WebPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#else +#include <ui/gfx/point.h> +#endif + +namespace WebKit { + +struct WebPoint { + int x; + int y; + + WebPoint() + : x(0) + , y(0) + { + } + + WebPoint(int x, int y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebPoint(const WebCore::IntPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const WebCore::IntPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::IntPoint() const + { + return WebCore::IntPoint(x, y); + } +#else + WebPoint(const gfx::Point& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const gfx::Point& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator gfx::Point() const + { + return gfx::Point(x, y); + } +#endif +}; + +inline bool operator==(const WebPoint& a, const WebPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebPoint& a, const WebPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h new file mode 100644 index 000000000..4bcabcfe6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google 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 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 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. + */ + +#ifndef WebPrivateOwnPtr_h +#define WebPrivateOwnPtr_h + +#include "WebCommon.h" + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a pointer to a WebCore class. It's similar to WebPrivatePtr, but it +// wraps a naked pointer rather than a reference counted. +// Note: you must call reset(0) on the implementation side in order to delete +// the WebCore pointer. +template <typename T> +class WebPrivateOwnPtr { +public: + WebPrivateOwnPtr() : m_ptr(0) {} + ~WebPrivateOwnPtr() { WEBKIT_ASSERT(!m_ptr); } + +#if WEBKIT_IMPLEMENTATION + explicit WebPrivateOwnPtr(T* ptr) + : m_ptr(ptr) + { + } + + void reset(T* ptr) + { + delete m_ptr; + m_ptr = ptr; + } + + T* get() const { return m_ptr; } + + T* operator->() const + { + WEBKIT_ASSERT(m_ptr); + return m_ptr; + } +#endif // WEBKIT_IMPLEMENTATION + +private: + T* m_ptr; + + WebPrivateOwnPtr(const WebPrivateOwnPtr&); + void operator=(const WebPrivateOwnPtr&); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPrivatePtr.h b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h new file mode 100644 index 000000000..31d09a90b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebPrivatePtr_h +#define WebPrivatePtr_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a reference counted WebCore class. +template <typename T> +class WebPrivatePtr { +public: + WebPrivatePtr() : m_ptr(0) { } + ~WebPrivatePtr() { WEBKIT_ASSERT(!m_ptr); } + + bool isNull() const { return !m_ptr; } + +#if WEBKIT_IMPLEMENTATION + WebPrivatePtr(const PassRefPtr<T>& prp) + : m_ptr(prp.leakRef()) + { + } + + void reset() + { + assign(0); + } + + WebPrivatePtr<T>& operator=(const WebPrivatePtr<T>& other) + { + T* p = other.m_ptr; + if (p) + p->ref(); + assign(p); + return *this; + } + + WebPrivatePtr<T>& operator=(const PassRefPtr<T>& prp) + { + assign(prp.leakRef()); + return *this; + } + + T* get() const + { + return m_ptr; + } + + T* operator->() const + { + ASSERT(m_ptr); + return m_ptr; + } +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(T* p) + { + // p is already ref'd for us by the caller + if (m_ptr) + m_ptr->deref(); + m_ptr = p; + } +#endif + + T* m_ptr; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebRect.h b/Source/WebKit/chromium/public/platform/WebRect.h new file mode 100644 index 000000000..045b7a8eb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebRect.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebRect_h +#define WebRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#else +#include <ui/gfx/rect.h> +#endif + +namespace WebKit { + +struct WebRect { + int x; + int y; + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebRect() + : x(0) + , y(0) + , width(0) + , height(0) + { + } + + WebRect(int x, int y, int width, int height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebRect(const WebCore::IntRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const WebCore::IntRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::IntRect() const + { + return WebCore::IntRect(x, y, width, height); + } +#else + WebRect(const gfx::Rect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const gfx::Rect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::Rect() const + { + return gfx::Rect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebRect& a, const WebRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebRect& a, const WebRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h b/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h new file mode 100644 index 000000000..8501633bc --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSerializedScriptValue_h +#define WebSerializedScriptValue_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class SerializedScriptValue; } + +#if WEBKIT_USING_V8 +namespace v8 { +class Value; +template <class T> class Handle; +} +#endif + +namespace WebKit { +class WebString; + +// FIXME: Should this class be in platform? +class WebSerializedScriptValue { +public: + ~WebSerializedScriptValue() { reset(); } + + WebSerializedScriptValue() { } + WebSerializedScriptValue(const WebSerializedScriptValue& d) { assign(d); } + WebSerializedScriptValue& operator=(const WebSerializedScriptValue& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT static WebSerializedScriptValue fromString(const WebString&); + +#if WEBKIT_USING_V8 + WEBKIT_EXPORT static WebSerializedScriptValue serialize(v8::Handle<v8::Value>); +#endif + + // Create a WebSerializedScriptValue that represents a serialization error. + WEBKIT_EXPORT static WebSerializedScriptValue createInvalid(); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebSerializedScriptValue&); + + bool isNull() const { return m_private.isNull(); } + + // Returns a string representation of the WebSerializedScriptValue. + WEBKIT_EXPORT WebString toString() const; + +#if WEBKIT_USING_V8 + // Convert the serialized value to a parsed v8 value. + WEBKIT_EXPORT v8::Handle<v8::Value> deserialize(); +#endif + +#if WEBKIT_IMPLEMENTATION + WebSerializedScriptValue(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + WebSerializedScriptValue& operator=(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + operator WTF::PassRefPtr<WebCore::SerializedScriptValue>() const; +#endif + +private: + WebPrivatePtr<WebCore::SerializedScriptValue> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSize.h b/Source/WebKit/chromium/public/platform/WebSize.h new file mode 100644 index 000000000..94a53654d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSize.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSize_h +#define WebSize_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntSize.h" +#else +#include <ui/gfx/size.h> +#endif + +namespace WebKit { + +struct WebSize { + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebSize() + : width(0) + , height(0) + { + } + + WebSize(int width, int height) + : width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebSize(const WebCore::IntSize& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const WebCore::IntSize& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator WebCore::IntSize() const + { + return WebCore::IntSize(width, height); + } +#else + WebSize(const gfx::Size& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const gfx::Size& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator gfx::Size() const + { + return gfx::Size(width, height); + } +#endif +}; + +inline bool operator==(const WebSize& a, const WebSize& b) +{ + return a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebSize& a, const WebSize& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamError.h b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h new file mode 100644 index 000000000..f52869b3b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSocketStreamError_h +#define WebSocketStreamError_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebSocketStreamError { +public: + // FIXME: Define SocketStream Error codes and accessor methods. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h new file mode 100644 index 000000000..ededa0e43 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSocketStreamHandle_h +#define WebSocketStreamHandle_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebSocketStreamHandleClient; +class WebURL; + +class WebSocketStreamHandle { +public: + virtual ~WebSocketStreamHandle() { } + + // Connect new socket stream asynchronously. + virtual void connect(const WebURL&, WebSocketStreamHandleClient*) = 0; + + // Send web socket frame data on the socket stream. + virtual bool send(const WebData&) = 0; + + // Close the socket stream. + virtual void close() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h new file mode 100644 index 000000000..82f328c6e --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSocketStreamHandleClient_h +#define WebSocketStreamHandleClient_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebSocketStreamError; +class WebSocketStreamHandle; +class WebURL; + +class WebSocketStreamHandleClient { +public: + + // Called when Socket Stream is opened. + virtual void didOpenStream(WebSocketStreamHandle*, int /* maxPendingSendAllowed */) = 0; + + // Called when |amountSent| bytes are sent. + virtual void didSendData(WebSocketStreamHandle*, int /* amountSent */) = 0; + + // Called when data are received. + virtual void didReceiveData(WebSocketStreamHandle*, const WebData&) = 0; + + // Called when Socket Stream is closed. + virtual void didClose(WebSocketStreamHandle*) = 0; + + // Called when Socket Stream has an error. + virtual void didFail(WebSocketStreamHandle*, const WebSocketStreamError&) = 0; + + // FIXME: auth challenge for proxy +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebString.h b/Source/WebKit/chromium/public/platform/WebString.h new file mode 100644 index 000000000..d8f4fe21a --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebString.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#include "../../../../Platform/chromium/public/WebString.h" + diff --git a/Source/WebKit/chromium/public/platform/WebThread.h b/Source/WebKit/chromium/public/platform/WebThread.h new file mode 100644 index 000000000..a7b372fee --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebThread.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011 Google 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 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 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. + */ +#ifndef WebThread_h +#define WebThread_h + +#include "WebCommon.h" + +namespace WebKit { + +#define WEBTHREAD_HAS_LONGLONG_CHANGE + +// Provides an interface to an embedder-defined thread implementation. +// +// Deleting the thread blocks until all pending, non-delayed tasks have been +// run. +class WebThread { +public: + class Task { + public: + virtual ~Task() { } + virtual void run() = 0; + }; + + class TaskObserver { + public: + virtual ~TaskObserver() { } + virtual void didProcessTask() = 0; + }; + + virtual void postTask(Task*) = 0; + virtual void postDelayedTask(Task*, long long delayMs) = 0; + virtual void addTaskObserver(TaskObserver*) { } + virtual void removeTaskObserver(TaskObserver*) { } + + virtual ~WebThread() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebThreadSafeData.h b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h new file mode 100644 index 000000000..19af4df2b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebThreadSafeData_h +#define WebThreadSafeData_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +#if !WEBKIT_IMPLEMENTATION +#include <string> +#endif + +namespace WebCore { class RawData; } + +namespace WebKit { + +// A container for raw bytes. It is inexpensive to copy a WebThreadSafeData object. +// It is safe to pass a WebThreadSafeData across threads!!! +class WebThreadSafeData { +public: + WebThreadSafeData() { } + ~WebThreadSafeData() { reset(); } + + WEBKIT_EXPORT void assign(const WebThreadSafeData&); + WEBKIT_EXPORT void reset(); + + WEBKIT_EXPORT size_t size() const; + WEBKIT_EXPORT const char* data() const; + + bool isEmpty() const { return !size(); } + +#if WEBKIT_IMPLEMENTATION + WebThreadSafeData(const WTF::PassRefPtr<WebCore::RawData>&); + WebThreadSafeData& operator=(const WTF::PassRefPtr<WebCore::RawData>&); +#else + operator std::string() const + { + size_t len = size(); + return len ? std::string(data(), len) : std::string(); + } +#endif + +private: + WebPrivatePtr<WebCore::RawData> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURL.h b/Source/WebKit/chromium/public/platform/WebURL.h new file mode 100644 index 000000000..707ba0896 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURL.h @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURL_h +#define WebURL_h + +#include "WebCString.h" +#include <googleurl/src/url_parse.h> + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class KURL; } +#else +#include <googleurl/src/gurl.h> +#endif + +namespace WebKit { + +class WebURL { +public: + ~WebURL() + { + } + + WebURL() : m_isValid(false) + { + } + + WebURL(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + : m_spec(spec) + , m_parsed(parsed) + , m_isValid(isValid) + { + } + + WebURL(const WebURL& s) + : m_spec(s.m_spec) + , m_parsed(s.m_parsed) + , m_isValid(s.m_isValid) + { + } + + WebURL& operator=(const WebURL& s) + { + m_spec = s.m_spec; + m_parsed = s.m_parsed; + m_isValid = s.m_isValid; + return *this; + } + + void assign(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + { + m_spec = spec; + m_parsed = parsed; + m_isValid = isValid; + } + + const WebCString& spec() const + { + return m_spec; + } + + const url_parse::Parsed& parsed() const + { + return m_parsed; + } + + bool isValid() const + { + return m_isValid; + } + + bool isEmpty() const + { + return m_spec.isEmpty(); + } + + bool isNull() const + { + return m_spec.isEmpty(); + } + +#if WEBKIT_IMPLEMENTATION + WebURL(const WebCore::KURL&); + WebURL& operator=(const WebCore::KURL&); + operator WebCore::KURL() const; +#else + WebURL(const GURL& g) + : m_spec(g.possibly_invalid_spec()) + , m_parsed(g.parsed_for_possibly_invalid_spec()) + , m_isValid(g.is_valid()) + { + } + + WebURL& operator=(const GURL& g) + { + m_spec = g.possibly_invalid_spec(); + m_parsed = g.parsed_for_possibly_invalid_spec(); + m_isValid = g.is_valid(); + return *this; + } + + operator GURL() const + { + return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); + } +#endif + +private: + WebCString m_spec; // UTF-8 encoded + url_parse::Parsed m_parsed; + bool m_isValid; +}; + +inline bool operator<(const WebURL& a, const WebURL& b) +{ + return a.spec() < b.spec(); +} + +inline bool operator==(const WebURL& a, const WebURL& b) +{ + return !a.spec().compare(b.spec()); +} + +inline bool operator!=(const WebURL& a, const WebURL& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLError.h b/Source/WebKit/chromium/public/platform/WebURLError.h new file mode 100644 index 000000000..862dbeaa3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLError.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLError_h +#define WebURLError_h + +#include "WebString.h" +#include "WebURL.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceError; } +#endif + +namespace WebKit { + +struct WebURLError { + // A namespace for "reason" to support various layers generating + // resource errors. WebKit does not care about the value of this + // string as it will just be passed via callbacks to the consumer. + WebString domain; + + // A numeric error code detailing the reason for this error. A value + // of 0 means no error. WebKit does not interpret the meaning of other + // values and normally just forwards this error information back to the + // embedder (see for example WebFrameClient). + int reason; + + // A flag showing whether this error should be treated as a cancellation, + // e.g. we do not show console errors for cancellations. + bool isCancellation; + + // The url that failed to load. + WebURL unreachableURL; + + WebURLError() : reason(0), isCancellation(false) { } + +#if defined(WEBKIT_IMPLEMENTATION) + WebURLError(const WebCore::ResourceError&); + WebURLError& operator=(const WebCore::ResourceError&); + operator WebCore::ResourceError() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h new file mode 100644 index 000000000..839276bfb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLLoadTiming_h +#define WebURLLoadTiming_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class ResourceLoadTiming; } + +namespace WebKit { +class WebString; + +class WebURLLoadTiming { +public: + ~WebURLLoadTiming() { reset(); } + + WebURLLoadTiming() { } + WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); } + WebURLLoadTiming& operator=(const WebURLLoadTiming& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLLoadTiming&); + + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT double requestTime() const; + WEBKIT_EXPORT void setRequestTime(double); + + WEBKIT_EXPORT int proxyStart() const; + WEBKIT_EXPORT void setProxyStart(int); + + WEBKIT_EXPORT int proxyEnd() const; + WEBKIT_EXPORT void setProxyEnd(int); + + WEBKIT_EXPORT int dnsStart() const; + WEBKIT_EXPORT void setDNSStart(int); + + WEBKIT_EXPORT int dnsEnd() const; + WEBKIT_EXPORT void setDNSEnd(int); + + WEBKIT_EXPORT int connectStart() const; + WEBKIT_EXPORT void setConnectStart(int); + + WEBKIT_EXPORT int connectEnd() const; + WEBKIT_EXPORT void setConnectEnd(int); + + WEBKIT_EXPORT int sendStart() const; + WEBKIT_EXPORT void setSendStart(int); + + WEBKIT_EXPORT int sendEnd() const; + WEBKIT_EXPORT void setSendEnd(int); + + WEBKIT_EXPORT int receiveHeadersEnd() const; + WEBKIT_EXPORT void setReceiveHeadersEnd(int); + + WEBKIT_EXPORT int sslStart() const; + WEBKIT_EXPORT void setSSLStart(int); + + WEBKIT_EXPORT int sslEnd() const; + WEBKIT_EXPORT void setSSLEnd(int); + +#if WEBKIT_IMPLEMENTATION + WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadTiming> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoader.h b/Source/WebKit/chromium/public/platform/WebURLLoader.h new file mode 100644 index 000000000..a47b986b9 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoader.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009, 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLLoader_h +#define WebURLLoader_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebURLLoaderClient; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +class WebURLLoader { +public: + // The WebURLLoader may be deleted in a call to its client. + virtual ~WebURLLoader() {} + + // Load the request synchronously, returning results directly to the + // caller upon completion. There is no mechanism to interrupt a + // synchronous load!! + virtual void loadSynchronously(const WebURLRequest&, + WebURLResponse&, WebURLError&, WebData& data) = 0; + + // Load the request asynchronously, sending notifications to the given + // client. The client will receive no further notifications if the + // loader is disposed before it completes its work. + virtual void loadAsynchronously(const WebURLRequest&, + WebURLLoaderClient*) = 0; + + // Cancels an asynchronous load. This will appear as a load error to + // the client. + virtual void cancel() = 0; + + // Suspends/resumes an asynchronous load. + virtual void setDefersLoading(bool) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h new file mode 100644 index 000000000..3313a9c03 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLLoaderClient_h +#define WebURLLoaderClient_h + +namespace WebKit { + +class WebURLLoader; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +class WebURLLoaderClient { +public: + // Called when following a redirect. |newRequest| contains the request + // generated by the redirect. The client may modify |newRequest|. + virtual void willSendRequest( + WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { } + + // Called to report upload progress. The bytes reported correspond to + // the HTTP message body. + virtual void didSendData( + WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { } + + // Called when response headers are received. + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } + + // Called when a chunk of response data is downloaded. This is only called + // if WebURLRequest's downloadToFile flag was set to true. + virtual void didDownloadData(WebURLLoader*, int dataLength) { } + + // Called when a chunk of response data is received. + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { } + + // Called when a chunk of renderer-generated metadata is received from the cache. + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } + + // Called when the load completes successfully. + virtual void didFinishLoading(WebURLLoader*, double finishTime) { } + + // Called when the load completes with an error. + virtual void didFail(WebURLLoader*, const WebURLError&) { } + +protected: + virtual ~WebURLLoaderClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLRequest.h b/Source/WebKit/chromium/public/platform/WebURLRequest.h new file mode 100644 index 000000000..adf2f2e23 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLRequest.h @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLRequest_h +#define WebURLRequest_h + +#include "WebCommon.h" +#include "WebHTTPBody.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceRequest; } +#endif + +namespace WebKit { + +class WebCString; +class WebHTTPBody; +class WebHTTPHeaderVisitor; +class WebString; +class WebURL; +class WebURLRequestPrivate; + +class WebURLRequest { +public: + enum CachePolicy { + UseProtocolCachePolicy, // normal load + ReloadIgnoringCacheData, // reload + ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data + ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache + }; + + enum TargetType { + TargetIsMainFrame = 0, + TargetIsSubframe = 1, + TargetIsSubresource = 2, + TargetIsStyleSheet = 3, + TargetIsScript = 4, + TargetIsFontResource = 5, + TargetIsImage = 6, + TargetIsObject = 7, + TargetIsMedia = 8, + TargetIsWorker = 9, + TargetIsSharedWorker = 10, + TargetIsPrefetch = 11, + TargetIsPrerender = 12, + TargetIsFavicon = 13, + TargetIsXHR = 14, + TargetIsTextTrack = 15, + TargetIsUnspecified = 16, + }; + + class ExtraData { + public: + virtual ~ExtraData() { } + }; + + ~WebURLRequest() { reset(); } + + WebURLRequest() : m_private(0) { } + WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); } + WebURLRequest& operator=(const WebURLRequest& r) + { + assign(r); + return *this; + } + + explicit WebURLRequest(const WebURL& url) : m_private(0) + { + initialize(); + setURL(url); + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLRequest&); + + WEBKIT_EXPORT bool isNull() const; + + WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + // Used to implement third-party cookie blocking. + WEBKIT_EXPORT WebURL firstPartyForCookies() const; + WEBKIT_EXPORT void setFirstPartyForCookies(const WebURL&); + + WEBKIT_EXPORT bool allowCookies() const; + WEBKIT_EXPORT void setAllowCookies(bool); + + // Controls whether user name, password, and cookies may be sent with the + // request. (If false, this overrides allowCookies.) + WEBKIT_EXPORT bool allowStoredCredentials() const; + WEBKIT_EXPORT void setAllowStoredCredentials(bool); + + WEBKIT_EXPORT CachePolicy cachePolicy() const; + WEBKIT_EXPORT void setCachePolicy(CachePolicy); + + WEBKIT_EXPORT WebString httpMethod() const; + WEBKIT_EXPORT void setHTTPMethod(const WebString&); + + WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const; + WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name); + WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_EXPORT WebHTTPBody httpBody() const; + WEBKIT_EXPORT void setHTTPBody(const WebHTTPBody&); + + // Controls whether upload progress events are generated when a request + // has a body. + WEBKIT_EXPORT bool reportUploadProgress() const; + WEBKIT_EXPORT void setReportUploadProgress(bool); + + // Controls whether load timing info is collected for the request. + WEBKIT_EXPORT bool reportLoadTiming() const; + WEBKIT_EXPORT void setReportLoadTiming(bool); + + // Controls whether actual headers sent and received for request are + // collected and reported. + WEBKIT_EXPORT bool reportRawHeaders() const; + WEBKIT_EXPORT void setReportRawHeaders(bool); + + WEBKIT_EXPORT TargetType targetType() const; + WEBKIT_EXPORT void setTargetType(TargetType); + + // True if the request was user initiated. + WEBKIT_EXPORT bool hasUserGesture() const; + WEBKIT_EXPORT void setHasUserGesture(bool); + + // A consumer controlled value intended to be used to identify the + // requestor. + WEBKIT_EXPORT int requestorID() const; + WEBKIT_EXPORT void setRequestorID(int); + + // A consumer controlled value intended to be used to identify the + // process of the requestor. + WEBKIT_EXPORT int requestorProcessID() const; + WEBKIT_EXPORT void setRequestorProcessID(int); + + // Allows the request to be matched up with its app cache host. + WEBKIT_EXPORT int appCacheHostID() const; + WEBKIT_EXPORT void setAppCacheHostID(int); + + // If true, the response body will be downloaded to a file managed by the + // WebURLLoader. See WebURLResponse::downloadedFilePath. + WEBKIT_EXPORT bool downloadToFile() const; + WEBKIT_EXPORT void setDownloadToFile(bool); + + // Extra data associated with the underlying resource request. Resource + // requests can be copied. If non-null, each copy of a resource requests + // holds a pointer to the extra data, and the extra data pointer will be + // deleted when the last resource request is destroyed. Setting the extra + // data pointer will cause the underlying resource request to be + // dissociated from any existing non-null extra data pointer. + WEBKIT_EXPORT ExtraData* extraData() const; + WEBKIT_EXPORT void setExtraData(ExtraData*); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceRequest& toMutableResourceRequest(); + const WebCore::ResourceRequest& toResourceRequest() const; +#endif + +protected: + void assign(WebURLRequestPrivate*); + +private: + WebURLRequestPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLResponse.h b/Source/WebKit/chromium/public/platform/WebURLResponse.h new file mode 100644 index 000000000..8629b849c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLResponse.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebURLResponse_h +#define WebURLResponse_h + +#include "WebCommon.h" +#include "WebPrivateOwnPtr.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceResponse; } +#endif + +namespace WebKit { + +class WebCString; +class WebHTTPHeaderVisitor; +class WebHTTPLoadInfo; +class WebString; +class WebURL; +class WebURLLoadTiming; +class WebURLResponsePrivate; + +class WebURLResponse { +public: + ~WebURLResponse() { reset(); } + + WebURLResponse() : m_private(0) { } + WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); } + WebURLResponse& operator=(const WebURLResponse& r) + { + assign(r); + return *this; + } + + explicit WebURLResponse(const WebURL& url) : m_private(0) + { + initialize(); + setURL(url); + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLResponse&); + + WEBKIT_EXPORT bool isNull() const; + + WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + WEBKIT_EXPORT unsigned connectionID() const; + WEBKIT_EXPORT void setConnectionID(unsigned); + + WEBKIT_EXPORT bool connectionReused() const; + WEBKIT_EXPORT void setConnectionReused(bool); + + WEBKIT_EXPORT WebURLLoadTiming loadTiming(); + WEBKIT_EXPORT void setLoadTiming(const WebURLLoadTiming&); + + WEBKIT_EXPORT WebHTTPLoadInfo httpLoadInfo(); + WEBKIT_EXPORT void setHTTPLoadInfo(const WebHTTPLoadInfo&); + + WEBKIT_EXPORT double responseTime() const; + WEBKIT_EXPORT void setResponseTime(double); + + WEBKIT_EXPORT WebString mimeType() const; + WEBKIT_EXPORT void setMIMEType(const WebString&); + + WEBKIT_EXPORT long long expectedContentLength() const; + WEBKIT_EXPORT void setExpectedContentLength(long long); + + WEBKIT_EXPORT WebString textEncodingName() const; + WEBKIT_EXPORT void setTextEncodingName(const WebString&); + + WEBKIT_EXPORT WebString suggestedFileName() const; + WEBKIT_EXPORT void setSuggestedFileName(const WebString&); + + WEBKIT_EXPORT int httpStatusCode() const; + WEBKIT_EXPORT void setHTTPStatusCode(int); + + WEBKIT_EXPORT WebString httpStatusText() const; + WEBKIT_EXPORT void setHTTPStatusText(const WebString&); + + WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const; + WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name); + WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_EXPORT double lastModifiedDate() const; + WEBKIT_EXPORT void setLastModifiedDate(double); + + WEBKIT_EXPORT long long appCacheID() const; + WEBKIT_EXPORT void setAppCacheID(long long); + + WEBKIT_EXPORT WebURL appCacheManifestURL() const; + WEBKIT_EXPORT void setAppCacheManifestURL(const WebURL&); + + // A consumer controlled value intended to be used to record opaque + // security info related to this request. + WEBKIT_EXPORT WebCString securityInfo() const; + WEBKIT_EXPORT void setSecurityInfo(const WebCString&); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceResponse& toMutableResourceResponse(); + const WebCore::ResourceResponse& toResourceResponse() const; +#endif + + // Flag whether this request was served from the disk cache entry. + WEBKIT_EXPORT bool wasCached() const; + WEBKIT_EXPORT void setWasCached(bool); + + // Flag whether this request was loaded via the SPDY protocol or not. + // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy + WEBKIT_EXPORT bool wasFetchedViaSPDY() const; + WEBKIT_EXPORT void setWasFetchedViaSPDY(bool); + + // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiation was used. + // This is related to SPDY. + WEBKIT_EXPORT bool wasNpnNegotiated() const; + WEBKIT_EXPORT void setWasNpnNegotiated(bool); + + // Flag whether this request was made when "Alternate-Protocol: xxx" + // is present in server's response. + WEBKIT_EXPORT bool wasAlternateProtocolAvailable() const; + WEBKIT_EXPORT void setWasAlternateProtocolAvailable(bool); + + // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc). + WEBKIT_EXPORT bool wasFetchedViaProxy() const; + WEBKIT_EXPORT void setWasFetchedViaProxy(bool); + + // Flag whether this request is part of a multipart response. + WEBKIT_EXPORT bool isMultipartPayload() const; + WEBKIT_EXPORT void setIsMultipartPayload(bool); + + // This indicates the location of a downloaded response if the + // WebURLRequest had the downloadToFile flag set to true. This file path + // remains valid for the lifetime of the WebURLLoader used to create it. + WEBKIT_EXPORT WebString downloadFilePath() const; + WEBKIT_EXPORT void setDownloadFilePath(const WebString&); + + // Remote IP address of the socket which fetched this resource. + WEBKIT_EXPORT WebString remoteIPAddress() const; + WEBKIT_EXPORT void setRemoteIPAddress(const WebString&); + + // Remote port number of the socket which fetched this resource. + WEBKIT_EXPORT unsigned short remotePort() const; + WEBKIT_EXPORT void setRemotePort(unsigned short); + +protected: + void assign(WebURLResponsePrivate*); + +private: + WebURLResponsePrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebVector.h b/Source/WebKit/chromium/public/platform/WebVector.h new file mode 100644 index 000000000..bb02abcdf --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebVector.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebVector_h +#define WebVector_h + +#include "WebCommon.h" + +#include <algorithm> + +namespace WebKit { + +// A simple vector class. +// +// Sample usage: +// +// void Foo(WebVector<int>& result) +// { +// WebVector<int> data(10); +// for (size_t i = 0; i < data.size(); ++i) +// data[i] = ... +// result.swap(data); +// } +// +// It is also possible to assign from other types of random access +// containers: +// +// void Foo(const std::vector<std::string>& input) +// { +// WebVector<WebCString> cstrings = input; +// ... +// } +// +template <typename T> +class WebVector { +public: + typedef T ValueType; + + ~WebVector() + { + destroy(); + } + + explicit WebVector(size_t size = 0) + { + initialize(size); + } + + WebVector(const WebVector<T>& other) + { + initializeFrom(other.m_ptr, other.m_size); + } + + template <typename C> + WebVector(const C& other) + { + initializeFrom(other.size() ? &other[0] : 0, other.size()); + } + + WebVector& operator=(const WebVector& other) + { + if (this != &other) + assign(other); + return *this; + } + + template <typename C> + WebVector<T>& operator=(const C& other) + { + if (this != reinterpret_cast<const WebVector<T>*>(&other)) + assign(other); + return *this; + } + + template <typename C> + void assign(const C& other) + { + assign(other.size() ? &other[0] : 0, other.size()); + } + + template <typename U> + void assign(const U* values, size_t size) + { + destroy(); + initializeFrom(values, size); + } + + size_t size() const { return m_size; } + bool isEmpty() const { return !m_size; } + + T& operator[](size_t i) + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } + const T& operator[](size_t i) const + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } + + bool contains(const T& value) const + { + for (size_t i = 0; i < m_size; i++) { + if (m_ptr[i] == value) + return true; + } + return false; + } + + T* data() { return m_ptr; } + const T* data() const { return m_ptr; } + + void swap(WebVector<T>& other) + { + std::swap(m_ptr, other.m_ptr); + std::swap(m_size, other.m_size); + } + +private: + void initialize(size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(); + } + } + + template <typename U> + void initializeFrom(const U* values, size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(values[i]); + } + } + + void destroy() + { + for (size_t i = 0; i < m_size; ++i) + m_ptr[i].~T(); + ::operator delete(m_ptr); + } + + T* m_ptr; + size_t m_size; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h new file mode 100644 index 000000000..3f39f195d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +namespace WebKit { + +// Empty class, as we need it to compile. +class WebSandboxSupport { +public: +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h new file mode 100644 index 000000000..35dd82e8d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + // The UI part which is being accessed. + enum Part { + // ScrollbarTheme parts + PartScrollbarDownArrow, + PartScrollbarLeftArrow, + PartScrollbarRightArrow, + PartScrollbarUpArrow, + PartScrollbarHorizontalThumb, + PartScrollbarVerticalThumb, + PartScrollbarHorizontalTrack, + PartScrollbarVerticalTrack, + + // RenderTheme parts + PartCheckbox, + PartRadio, + PartButton, + PartTextField, + PartMenuList, + PartSliderTrack, + PartSliderThumb, + PartInnerSpinButton, + PartProgressBar + }; + + // The current state of the associated Part. + enum State { + StateDisabled, + StateHover, + StateNormal, + StatePressed, + }; + + // Extra parameters for drawing the PartScrollbarHorizontalTrack and + // PartScrollbarVerticalTrack. + struct ScrollbarTrackExtraParams { + // The bounds of the entire track, as opposed to the part being painted. + int trackX; + int trackY; + int trackWidth; + int trackHeight; + }; + + // Extra parameters for PartCheckbox, PartPushButton and PartRadio. + struct ButtonExtraParams { + bool checked; + bool indeterminate; // Whether the button state is indeterminate. + bool isDefault; // Whether the button is default button. + bool hasBorder; + WebColor backgroundColor; + }; + + // Extra parameters for PartTextField + struct TextFieldExtraParams { + bool isTextArea; + bool isListbox; + WebColor backgroundColor; + }; + + // Extra parameters for PartMenuList + struct MenuListExtraParams { + bool hasBorder; + bool hasBorderRadius; + int arrowX; + int arrowY; + WebColor backgroundColor; + }; + + // Extra parameters for PartSliderTrack and PartSliderThumb + struct SliderExtraParams { + bool vertical; + bool inDrag; + }; + + // Extra parameters for PartInnerSpinButton + struct InnerSpinButtonExtraParams { + bool spinUp; + bool readOnly; + }; + + // Extra parameters for PartProgressBar + struct ProgressBarExtraParams { + bool determinate; + int valueRectX; + int valueRectY; + int valueRectWidth; + int valueRectHeight; + }; + + union ExtraParams { + ScrollbarTrackExtraParams scrollbarTrack; + ButtonExtraParams button; + TextFieldExtraParams textField; + MenuListExtraParams menuList; + SliderExtraParams slider; + InnerSpinButtonExtraParams innerSpin; + ProgressBarExtraParams progressBar; + }; + + // Gets the size of the given theme part. For variable sized items + // like vertical scrollbar thumbs, the width will be the required width of + // the track while the height will be the minimum height. + virtual WebSize getSize(Part) { return WebSize(); } + // Paint the given the given theme part. + virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h new file mode 100644 index 000000000..47f037882 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebFontFamily_h +#define WebFontFamily_h + +#include "../WebCString.h" +#include "../WebCommon.h" + +namespace WebKit { + +struct WebFontFamily { + WebCString name; + bool isBold; + bool isItalic; +}; + +} // namespace WebKit + +#endif // WebFontFamily_h diff --git a/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h new file mode 100644 index 000000000..154505662 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +#include "../WebCommon.h" +#include "../WebString.h" +#include "WebFontFamily.h" + +namespace WebKit { + +struct WebFontRenderStyle; + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Fonts --------------------------------------------------------------- + + // Get a font family which contains glyphs for the given Unicode + // code-points. + // characters: a UTF-16 encoded string + // numCharacters: the number of 16-bit words in |characters| + // preferredLocale: preferred locale identifier for the |characters| + // (e.g. "en", "ja", "zh-CN") + // + // Returns a string with the font family on an empty string if the + // request cannot be satisfied. + // Returns a WebFontFamily instance with the font name. The instance has empty font name if the request cannot be satisfied. + // FIXME: Make this to be a pure virtual function after transition. + virtual void getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*) = 0; + + virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h new file mode 100644 index 000000000..f84f292d7 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + // The UI part which is being accessed. + enum Part { + // ScrollbarTheme parts + PartScrollbarDownArrow, + PartScrollbarLeftArrow, + PartScrollbarRightArrow, + PartScrollbarUpArrow, + PartScrollbarHorizontalThumb, + PartScrollbarVerticalThumb, + PartScrollbarHorizontalTrack, + PartScrollbarVerticalTrack, + + // RenderTheme parts + PartCheckbox, + PartRadio, + PartButton, + PartTextField, + PartMenuList, + PartSliderTrack, + PartSliderThumb, + PartInnerSpinButton, + PartProgressBar + }; + + // The current state of the associated Part. + enum State { + StateDisabled, + StateHover, + StateNormal, + StatePressed, + }; + + // Extra parameters for drawing the PartScrollbarHorizontalTrack and + // PartScrollbarVerticalTrack. + struct ScrollbarTrackExtraParams { + // The bounds of the entire track, as opposed to the part being painted. + int trackX; + int trackY; + int trackWidth; + int trackHeight; + }; + + // Extra parameters for PartCheckbox, PartPushButton and PartRadio. + struct ButtonExtraParams { + bool checked; + bool indeterminate; // Whether the button state is indeterminate. + bool isDefault; // Whether the button is default button. + bool hasBorder; + WebColor backgroundColor; + }; + + // Extra parameters for PartTextField + struct TextFieldExtraParams { + bool isTextArea; + bool isListbox; + WebColor backgroundColor; + }; + + // Extra parameters for PartMenuList + struct MenuListExtraParams { + bool hasBorder; + bool hasBorderRadius; + int arrowX; + int arrowY; + WebColor backgroundColor; + }; + + // Extra parameters for PartSliderTrack and PartSliderThumb + struct SliderExtraParams { + bool vertical; + bool inDrag; + }; + + // Extra parameters for PartInnerSpinButton + struct InnerSpinButtonExtraParams { + bool spinUp; + bool readOnly; + }; + + // Extra parameters for PartProgressBar + struct ProgressBarExtraParams { + bool determinate; + int valueRectX; + int valueRectY; + int valueRectWidth; + int valueRectHeight; + }; + + union ExtraParams { + ScrollbarTrackExtraParams scrollbarTrack; + ButtonExtraParams button; + TextFieldExtraParams textField; + MenuListExtraParams menuList; + SliderExtraParams slider; + InnerSpinButtonExtraParams innerSpin; + ProgressBarExtraParams progressBar; + }; + + // Gets the size of the given theme part. For variable sized items + // like vertical scrollbar thumbs, the width will be the required width of + // the track while the height will be the minimum height. + virtual WebSize getSize(Part) { return WebSize(); } + // Paint the given the given theme part. + virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h new file mode 100644 index 000000000..34280c6eb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct CGFont* CGFontRef; + +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Given an input font - |srcFont| [which can't be loaded due to sandbox + // restrictions]. Return a font belonging to an equivalent font file + // that can be used to access the font and a unique identifier corresponding + // to the on-disk font file. + // + // If this function succeeds, the caller assumes ownership of the |out| + // parameter and must call CGFontRelease() to unload it when done. + // + // Returns: true on success, false on error. + virtual bool loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h new file mode 100644 index 000000000..c7857022f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + enum State { + StateDisabled, + StateInactive, + StateActive, + StatePressed, + }; + + enum Size { + SizeRegular, + SizeSmall, + }; + + enum ScrollbarOrientation { + ScrollbarOrientationHorizontal, + ScrollbarOrientationVertical, + }; + + enum ScrollbarParent { + ScrollbarParentScrollView, + ScrollbarParentRenderLayer, + }; + + struct ScrollbarInfo { + ScrollbarOrientation orientation; + ScrollbarParent parent; + int maxValue; + int currentValue; + int visibleSize; + int totalSize; + }; + + virtual void paintScrollbarThumb(WebCanvas*, State, Size, const WebRect&, const ScrollbarInfo&) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h new file mode 100644 index 000000000..3522c7284 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct HFONT__* HFONT; + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Sometimes a Win32 API call will fail because a font is not loaded, + // and due to sandbox restrictions, the current process may be unable + // to access the filesystem to load the font. So, this call serves as + // a failover to ask the embedder to try some other way to load the + // font (usually by delegating to an empowered process to have it load + // the font). Returns true if the font was successfully loaded. + virtual bool ensureFontLoaded(HFONT) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h new file mode 100644 index 000000000..1890db6ea --- /dev/null +++ b/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2010 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; +struct WebSize; + +class WebThemeEngine { +public: +// The part and state parameters correspond to values defined by the +// Windows Theme API (see +// http://msdn.microsoft.com/en-us/library/bb773187(VS.85).aspx ). +// The classicState parameter corresponds to the uState +// parameter of the Windows DrawFrameControl() function. +// See the definitions in <vsstyle.h> and <winuser.h>. + virtual void paintButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintMenuList( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarArrow( + WebCanvas*, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarThumb( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarTrack( + WebCanvas*, int part, int state, int classicState, + const WebRect&, const WebRect& alignRect) = 0; + + virtual void paintSpinButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) {} + + virtual void paintTextField( + WebCanvas*, int part, int state, int classicState, + const WebRect&, WebColor, bool fillContentArea, bool drawEdges) = 0; + + virtual void paintTrackbar( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintProgressBar( + WebCanvas*, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/win/WebInputEventFactory.h b/Source/WebKit/chromium/public/win/WebInputEventFactory.h new file mode 100644 index 000000000..65a46d581 --- /dev/null +++ b/Source/WebKit/chromium/public/win/WebInputEventFactory.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebInputEventFactory_h +#define WebInputEventFactory_h + +#include "../platform/WebCommon.h" + +#include <windows.h> + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebMouseWheelEvent; + +class WebInputEventFactory { +public: + WEBKIT_EXPORT static WebKeyboardEvent keyboardEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_EXPORT static WebMouseEvent mouseEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_EXPORT static WebMouseWheelEvent mouseWheelEvent(HWND, UINT, WPARAM, LPARAM); + + // Windows only provides information on whether a click was a single or + // double click, while we need to know the click count past two. The + // WebInputEventFactory keeps internal state to allow it to synthesize + // that information. In some cases, like fast-running tests, that + // information is known to be stale and needs to be reset; that is the + // function of resetLastClickState(). + WEBKIT_EXPORT static void resetLastClickState(); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/win/WebSandboxSupport.h b/Source/WebKit/chromium/public/win/WebSandboxSupport.h new file mode 100644 index 000000000..ff795cb38 --- /dev/null +++ b/Source/WebKit/chromium/public/win/WebSandboxSupport.h @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WEBKIT_MIGRATE_HEADERS_TO_PLATFORM +#include "../platform/win/WebSandboxSupport.h" +#endif diff --git a/Source/WebKit/chromium/public/win/WebScreenInfoFactory.h b/Source/WebKit/chromium/public/win/WebScreenInfoFactory.h new file mode 100644 index 000000000..f688895f8 --- /dev/null +++ b/Source/WebKit/chromium/public/win/WebScreenInfoFactory.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../platform/WebCommon.h" + +typedef struct HWND__* HWND; + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_EXPORT static WebScreenInfo screenInfo(HWND); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h b/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h new file mode 100644 index 000000000..7c9306cab --- /dev/null +++ b/Source/WebKit/chromium/public/x11/WebScreenInfoFactory.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2011 Google 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: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * 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. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT + * OWNER OR 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. + */ + +#ifndef WebScreenInfoFactory_h +#define WebScreenInfoFactory_h + +#include "../platform/WebCommon.h" + +typedef struct _XDisplay Display; + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_EXPORT static WebScreenInfo screenInfo(Display*, int screenNumber); +}; + +} // namespace WebKit + +#endif |
