diff options
author | Steve Block <steveblock@google.com> | 2009-12-15 10:12:09 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-12-17 17:41:10 +0000 |
commit | 643ca7872b450ea4efacab6188849e5aac2ba161 (patch) | |
tree | 6982576c228bcd1a7efe98afed544d840751094c /WebKit/chromium/public | |
parent | d026980fde6eb3b01c1fe49441174e89cd1be298 (diff) | |
download | external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.zip external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.gz external_webkit-643ca7872b450ea4efacab6188849e5aac2ba161.tar.bz2 |
Merge webkit.org at r51976 : Initial merge by git.
Change-Id: Ib0e7e2f0fb4bee5a186610272edf3186f0986b43
Diffstat (limited to 'WebKit/chromium/public')
120 files changed, 10590 insertions, 0 deletions
diff --git a/WebKit/chromium/public/WebAccessibilityCache.h b/WebKit/chromium/public/WebAccessibilityCache.h new file mode 100644 index 0000000..94704a0 --- /dev/null +++ b/WebKit/chromium/public/WebAccessibilityCache.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 WebAccessibilityCache_h +#define WebAccessibilityCache_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebView; +class WebAccessibilityObject; + +class WebAccessibilityCache { +public: + WebAccessibilityCache() {} + virtual ~WebAccessibilityCache() {} + + static WebAccessibilityCache* create(); + static void enableAccessibility(); + + virtual void initialize(WebView* view) = 0; + virtual bool isInitialized() const = 0; + + virtual WebAccessibilityObject getObjectById(int) = 0; + virtual bool isValidId(int) const = 0; + virtual int addOrGetId(const WebAccessibilityObject& object) = 0; + + virtual void remove(int) = 0; + virtual void clear() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebAccessibilityObject.h b/WebKit/chromium/public/WebAccessibilityObject.h new file mode 100644 index 0000000..d32c548 --- /dev/null +++ b/WebKit/chromium/public/WebAccessibilityObject.h @@ -0,0 +1,117 @@ +/* + * 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 "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class AccessibilityObject; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebAccessibilityObjectPrivate; +class WebString; +struct WebPoint; +struct WebRect; + +// A container for passing around a reference to AccessibilityObject. +class WebAccessibilityObject { +public: + ~WebAccessibilityObject() { reset(); } + + WebAccessibilityObject() : m_private(0) { } + WebAccessibilityObject(const WebAccessibilityObject& o) : m_private(0) { assign(o); } + WebAccessibilityObject& operator=(const WebAccessibilityObject& o) + { + assign(o); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebAccessibilityObject&); + + bool isNull() const { return !m_private; } + + WebString accessibilityDescription() const; + WebString actionVerb() const; + bool canSetFocusAttribute() const; + bool canSetValueAttribute() const; + + unsigned childCount() const; + + WebAccessibilityObject childAt(unsigned) const; + WebAccessibilityObject firstChild() const; + WebAccessibilityObject focusedChild() const; + WebAccessibilityObject lastChild() const; + WebAccessibilityObject nextSibling() const; + WebAccessibilityObject parentObject() const; + WebAccessibilityObject previousSibling() const; + + bool isAnchor() const; + bool isChecked() const; + bool isFocused() const; + bool isEnabled() const; + bool isHovered() const; + bool isIndeterminate() const; + bool isMultiSelect() const; + bool isOffScreen() const; + bool isPasswordField() const; + bool isPressed() const; + bool isReadOnly() const; + bool isVisited() const; + + WebRect boundingBoxRect() const; + WebString helpText() const; + WebAccessibilityObject hitTest(const WebPoint&) const; + WebString keyboardShortcut() const; + bool performDefaultAction() const; + WebAccessibilityRole roleValue() const; + WebString stringValue() const; + WebString title() 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: + void assign(WebAccessibilityObjectPrivate*); + WebAccessibilityObjectPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebAccessibilityRole.h b/WebKit/chromium/public/WebAccessibilityRole.h new file mode 100644 index 0000000..e836c56 --- /dev/null +++ b/WebKit/chromium/public/WebAccessibilityRole.h @@ -0,0 +1,139 @@ +/* + * 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 "WebCommon.h" + +namespace WebKit { + +// These values must match WebCore::AccessibilityRole values +enum WebAccessibilityRole { + WebAccessibilityRoleUnknown = 1, + WebAccessibilityRoleButton, + WebAccessibilityRoleRadioButton, + WebAccessibilityRoleCheckBox, + WebAccessibilityRoleSlider, + WebAccessibilityRoleTabGroup, + WebAccessibilityRoleTextField, + WebAccessibilityRoleStaticText, + WebAccessibilityRoleTextArea, + WebAccessibilityRoleScrollArea, + WebAccessibilityRolePopUpButton, + WebAccessibilityRoleMenuButton, + WebAccessibilityRoleTable, + WebAccessibilityRoleApplication, + WebAccessibilityRoleGroup, + WebAccessibilityRoleRadioGroup, + WebAccessibilityRoleList, + WebAccessibilityRoleScrollBar, + WebAccessibilityRoleValueIndicator, + WebAccessibilityRoleImage, + WebAccessibilityRoleMenuBar, + WebAccessibilityRoleMenu, + WebAccessibilityRoleMenuItem, + WebAccessibilityRoleColumn, + WebAccessibilityRoleRow, + WebAccessibilityRoleToolbar, + WebAccessibilityRoleBusyIndicator, + WebAccessibilityRoleProgressIndicator, + WebAccessibilityRoleWindow, + WebAccessibilityRoleDrawer, + WebAccessibilityRoleSystemWide, + WebAccessibilityRoleOutline, + WebAccessibilityRoleIncrementor, + WebAccessibilityRoleBrowser, + WebAccessibilityRoleComboBox, + WebAccessibilityRoleSplitGroup, + WebAccessibilityRoleSplitter, + WebAccessibilityRoleColorWell, + WebAccessibilityRoleGrowArea, + WebAccessibilityRoleSheet, + WebAccessibilityRoleHelpTag, + WebAccessibilityRoleMatte, + WebAccessibilityRoleRuler, + WebAccessibilityRoleRulerMarker, + WebAccessibilityRoleLink, + WebAccessibilityRoleDisclosureTriangle, + WebAccessibilityRoleGrid, + WebAccessibilityRoleCell, + WebAccessibilityRoleColumnHeader, + WebAccessibilityRoleRowHeader, + + WebAccessibilityRoleWebCoreLink, + WebAccessibilityRoleImageMapLink, + WebAccessibilityRoleImageMap, + WebAccessibilityRoleListMarker, + WebAccessibilityRoleWebArea, + WebAccessibilityRoleHeading, + WebAccessibilityRoleListBox, + WebAccessibilityRoleListBoxOption, + WebAccessibilityRoleTableHeaderContainer, + WebAccessibilityRoleDefinitionListTerm, + WebAccessibilityRoleDefinitionListDefinition, + WebAccessibilityRoleAnnotation, + WebAccessibilityRoleSliderThumb, + WebAccessibilityRoleIgnored, + WebAccessibilityRoleTab, + WebAccessibilityRoleTabList, + WebAccessibilityRoleTabPanel, + WebAccessibilityRoleTreeRole, + WebAccessibilityRoleTreeItemRole, + WebAccessibilityRoleDirectory, + + WebAccessibilityRoleLandmarkApplication, + WebAccessibilityRoleLandmarkBanner, + WebAccessibilityRoleLandmarkComplementary, + WebAccessibilityRoleLandmarkContentInfo, + WebAccessibilityRoleLandmarkMain, + WebAccessibilityRoleLandmarkNavigation, + WebAccessibilityRoleLandmarkSearch, + + WebAccessibilityRoleApplicationAlert, + WebAccessibilityRoleApplicationAlertDialog, + WebAccessibilityRoleApplicationDialog, + WebAccessibilityRoleApplicationLog, + WebAccessibilityRoleApplicationMarquee, + WebAccessibilityRoleApplicationStatus, + WebAccessibilityRoleApplicationTimer, + + WebAccessibilityRoleDocument, + WebAccessibilityRoleDocumentArticle, + WebAccessibilityRoleDocumentMath, + WebAccessibilityRoleDocumentNote, + WebAccessibilityRoleDocumentRegion, + + WebAccessibilityRoleUserInterfaceTooltip +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebApplicationCacheHost.h b/WebKit/chromium/public/WebApplicationCacheHost.h new file mode 100644 index 0000000..7c5dafe --- /dev/null +++ b/WebKit/chromium/public/WebApplicationCacheHost.h @@ -0,0 +1,97 @@ +/* + * 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 WebApplicationCacheHost_h +#define WebApplicationCacheHost_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebApplicationCacheHostClient; +class WebURL; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +// This interface is used by webkit to call out to the embedder. Webkit uses +// the WebKitClient::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&) = 0; + virtual void willStartSubResourceRequest(WebURLRequest&) = 0; + + // 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() = 0; + virtual bool selectCacheWithManifest(const WebURL& manifestURL) = 0; + + // Called as the main resource is retrieved. + virtual void didReceiveResponseForMainResource(const WebURLResponse&) = 0; + virtual void didReceiveDataForMainResource(const char* data, int len) = 0; + virtual void didFinishLoadingMainResource(bool success) = 0; + + // Called on behalf of the scriptable interface. + virtual Status status() = 0; + virtual bool startUpdate() = 0; + virtual bool swapCache() = 0; +}; + +} // namespace WebKit + +#endif // WebApplicationCacheHost_h + diff --git a/WebKit/chromium/public/WebApplicationCacheHostClient.h b/WebKit/chromium/public/WebApplicationCacheHostClient.h new file mode 100644 index 0000000..4e830e3 --- /dev/null +++ b/WebKit/chromium/public/WebApplicationCacheHostClient.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 WebApplicationCacheHostClient_h +#define WebApplicationCacheHostClient_h + +#include "WebApplicationCacheHost.h" +#include "WebCommon.h" + +namespace WebKit { + +// This interface is used by the embedder to call into webkit. +class WebApplicationCacheHostClient { +public: + // Called to fire the event in the scriptable interface. + virtual void notifyEventListener(WebApplicationCacheHost::EventID) = 0; + +protected: + // Should not be deleted by the embedder. + virtual ~WebApplicationCacheHostClient() { } +}; + +} // namespace WebKit + +#endif // WebApplicationCacheHostClient_h + diff --git a/WebKit/chromium/public/WebBindings.h b/WebKit/chromium/public/WebBindings.h new file mode 100644 index 0000000..4e66a8f --- /dev/null +++ b/WebKit/chromium/public/WebBindings.h @@ -0,0 +1,145 @@ +/* + * 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 "WebCommon.h" +#include <bindings/npruntime.h> + +namespace WebKit { + +class WebDragData; +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_API static bool construct(NPP, NPObject*, const NPVariant* args, uint32_t argCount, NPVariant* result); + + // NPN_CreateObject + WEBKIT_API static NPObject* createObject(NPP, NPClass*); + + // NPN_Enumerate + WEBKIT_API static bool enumerate(NPP, NPObject*, NPIdentifier**, uint32_t* count); + + // NPN_Evaluate + WEBKIT_API static bool evaluate(NPP, NPObject*, NPString* script, NPVariant* result); + + // NPN_EvaluateHelper + WEBKIT_API static bool evaluateHelper(NPP, bool popupsAllowed, NPObject*, NPString* script, NPVariant* result); + + // NPN_GetIntIdentifier + WEBKIT_API static NPIdentifier getIntIdentifier(int32_t number); + + // NPN_GetProperty + WEBKIT_API static bool getProperty(NPP, NPObject*, NPIdentifier propertyName, NPVariant *result); + + // NPN_GetStringIdentifier + WEBKIT_API static NPIdentifier getStringIdentifier(const NPUTF8* string); + + // NPN_GetStringIdentifiers + WEBKIT_API static void getStringIdentifiers(const NPUTF8** names, int32_t nameCount, NPIdentifier*); + + // NPN_HasMethod + WEBKIT_API static bool hasMethod(NPP, NPObject*, NPIdentifier methodName); + + // NPN_HasProperty + WEBKIT_API static bool hasProperty(NPP, NPObject*, NPIdentifier propertyName); + + // NPN_IdentifierIsString + WEBKIT_API static bool identifierIsString(NPIdentifier); + + // NPN_InitializeVariantWithStringCopy (though sometimes prefixed with an underscore) + WEBKIT_API static void initializeVariantWithStringCopy(NPVariant*, const NPString*); + + // NPN_IntFromIdentifier + WEBKIT_API static int32_t intFromIdentifier(NPIdentifier); + + // NPN_Invoke + WEBKIT_API static bool invoke(NPP, NPObject*, NPIdentifier methodName, const NPVariant* args, uint32_t count, NPVariant* result); + + // NPN_InvokeDefault + WEBKIT_API static bool invokeDefault(NPP, NPObject*, const NPVariant* args, uint32_t count, NPVariant* result); + + // NPN_ReleaseObject + WEBKIT_API static void releaseObject(NPObject*); + + // NPN_ReleaseVariantValue + WEBKIT_API static void releaseVariantValue(NPVariant*); + + // NPN_RemoveProperty + WEBKIT_API static bool removeProperty(NPP, NPObject*, NPIdentifier); + + // NPN_RetainObject + WEBKIT_API static NPObject* retainObject(NPObject*); + + // NPN_SetException + WEBKIT_API static void setException(NPObject*, const NPUTF8* message); + + // NPN_SetProperty + WEBKIT_API static bool setProperty(NPP, NPObject*, NPIdentifier, const NPVariant*); + + // _NPN_UnregisterObject + WEBKIT_API static void unregisterObject(NPObject*); + + // NPN_UTF8FromIdentifier + WEBKIT_API 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_API static void extractIdentifierData(const NPIdentifier&, const NPUTF8*& string, int32_t& number, bool& isString); + + // Return true (success) if the given npobj is the current drag event in browser dispatch, + // and is accessible based on context execution frames and their security origins and + // WebKit clipboard access policy. If so, return the event id and the clipboard data (WebDragData). + // This only works with V8. If compiled without V8, it'll always return false. + WEBKIT_API static bool getDragData(NPObject* event, int* eventId, WebDragData*); + + // Invoke the event access policy checks listed above with GetDragData(). No need for clipboard + // data or event_id outputs, just confirm the given npobj is the current & accessible drag event. + // This only works with V8. If compiled without V8, it'll always return false. + WEBKIT_API static bool isDragEvent(NPObject* event); + + // Return true (success) if the given npobj is a range object. + // If so, return that range as a WebRange object. + WEBKIT_API static bool getRange(NPObject* range, WebRange*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCString.h b/WebKit/chromium/public/WebCString.h new file mode 100644 index 0000000..434cb06 --- /dev/null +++ b/WebKit/chromium/public/WebCString.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 WebCString_h +#define WebCString_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class CString; } +#else +#include <string> +#endif + +namespace WebKit { + +class WebCStringPrivate; +class WebString; + +// A single-byte string container with unspecified encoding. It is +// inexpensive to copy a WebCString object. +// +// WARNING: It is not safe to pass a WebCString across threads!!! +// +class WebCString { +public: + ~WebCString() { reset(); } + + WebCString() : m_private(0) { } + + WebCString(const char* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebCString(const WebCString& s) : m_private(0) { assign(s); } + + WebCString& operator=(const WebCString& s) + { + assign(s); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebCString&); + WEBKIT_API void assign(const char* data, size_t len); + + WEBKIT_API size_t length() const; + WEBKIT_API const char* data() const; + + bool isEmpty() const { return !length(); } + bool isNull() const { return !m_private; } + + WEBKIT_API WebString utf16() const; + + WEBKIT_API static WebCString fromUTF16(const WebUChar* data, size_t length); + WEBKIT_API static WebCString fromUTF16(const WebUChar* data); + +#if WEBKIT_IMPLEMENTATION + WebCString(const WebCore::CString&); + WebCString& operator=(const WebCore::CString&); + operator WebCore::CString() const; +#else + WebCString(const std::string& s) : m_private(0) + { + assign(s.data(), s.length()); + } + + WebCString& operator=(const std::string& s) + { + assign(s.data(), s.length()); + return *this; + } + + operator std::string() const + { + size_t len = length(); + return len ? std::string(data(), len) : std::string(); + } + + template <class UTF16String> + static WebCString fromUTF16(const UTF16String& s) + { + return fromUTF16(s.data(), s.length()); + } +#endif + +private: + void assign(WebCStringPrivate*); + WebCStringPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCache.h b/WebKit/chromium/public/WebCache.h new file mode 100644 index 0000000..433eb1a --- /dev/null +++ b/WebKit/chromium/public/WebCache.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 WebCache_h +#define WebCache_h + +#include "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::Cache::TypeStatistic. + struct ResourceTypeStat { + size_t count; + size_t size; + size_t liveSize; + size_t decodedSize; + }; + + // A struct mirroring WebCore::Cache::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_API 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). + WEBKIT_API static void clear(); + + // Gets the usage statistics from the resource cache. + WEBKIT_API static void getUsageStats(UsageStats*); + + // Get usage stats about the resource cache. + WEBKIT_API static void getResourceTypeStats(ResourceTypeStats*); + +private: + WebCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCanvas.h b/WebKit/chromium/public/WebCanvas.h new file mode 100644 index 0000000..4675487 --- /dev/null +++ b/WebKit/chromium/public/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 +namespace skia { class PlatformCanvas; } +#elif WEBKIT_USING_CG +struct CGContext; +#endif + +namespace WebKit { + +#if WEBKIT_USING_SKIA +typedef skia::PlatformCanvas WebCanvas; +#elif WEBKIT_USING_CG +typedef struct CGContext WebCanvas; +#else +#error "Need to define WebCanvas" +#endif + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebClipboard.h b/WebKit/chromium/public/WebClipboard.h new file mode 100644 index 0000000..68e22b5 --- /dev/null +++ b/WebKit/chromium/public/WebClipboard.h @@ -0,0 +1,77 @@ +/* + * 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" + +namespace WebKit { + +class WebImage; +class WebString; +class WebURL; + +class WebClipboard { +public: + enum Format { + FormatHTML, + FormatBookmark, + FormatSmartPaste + }; + + enum Buffer { + BufferStandard, + // Used on platforms like the X Window System that treat selection + // as a type of clipboard. + BufferSelection + }; + + virtual bool isFormatAvailable(Format, Buffer) = 0; + + virtual WebString readPlainText(Buffer) = 0; + virtual WebString readHTML(Buffer, WebURL*) = 0; + + virtual void writePlainText(const WebString&) = 0; + virtual void writeHTML( + const WebString& htmlText, const WebURL&, + const WebString& plainText, bool writeSmartPaste) = 0; + virtual void writeURL( + const WebURL&, const WebString& title) = 0; + virtual void writeImage( + const WebImage&, const WebURL&, const WebString& title) = 0; + +protected: + ~WebClipboard() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebColor.h b/WebKit/chromium/public/WebColor.h new file mode 100644 index 0000000..034f8db --- /dev/null +++ b/WebKit/chromium/public/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_API void setNamedColors(const WebColorName*, const WebColor*, size_t length); + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebColorName.h b/WebKit/chromium/public/WebColorName.h new file mode 100644 index 0000000..f97ed26 --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebCommon.h b/WebKit/chromium/public/WebCommon.h new file mode 100644 index 0000000..d347ea6 --- /dev/null +++ b/WebKit/chromium/public/WebCommon.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 WebCommon_h +#define WebCommon_h + +// ----------------------------------------------------------------------------- +// Default configuration + +#if !defined(WEBKIT_IMPLEMENTATION) + #define WEBKIT_IMPLEMENTATION 0 +#endif + +#if !defined(WEBKIT_USING_SKIA) + #if !defined(__APPLE__) + #define WEBKIT_USING_SKIA 1 + #else + #define WEBKIT_USING_SKIA 0 + #endif +#endif + +#if !defined(WEBKIT_USING_CG) + #if defined(__APPLE__) + #define WEBKIT_USING_CG 1 + #else + #define WEBKIT_USING_CG 0 + #endif +#endif + +#if !defined(WEBKIT_USING_V8) + #define WEBKIT_USING_V8 1 +#endif + +#if !defined(WEBKIT_USING_JSC) + #define WEBKIT_USING_JSC 0 +#endif + +// ----------------------------------------------------------------------------- +// Exported symbols need to be annotated with WEBKIT_API + +#if defined(WIN32) && defined(WEBKIT_DLL) + #if defined(WEBKIT_IMPLEMENTATION) + #define WEBKIT_API __declspec(dllexport) + #else + #define WEBKIT_API __declspec(dllimport) + #endif +#else + #define WEBKIT_API +#endif + +// ----------------------------------------------------------------------------- +// Basic types + +#include <stddef.h> // For size_t + +namespace WebKit { + + // UTF-16 character type +#if defined(WIN32) +typedef wchar_t WebUChar; +#else +typedef unsigned short WebUChar; +#endif + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCommonWorkerClient.h b/WebKit/chromium/public/WebCommonWorkerClient.h new file mode 100644 index 0000000..771ffff --- /dev/null +++ b/WebKit/chromium/public/WebCommonWorkerClient.h @@ -0,0 +1,79 @@ +/* + * 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 + +namespace WebKit { + +class WebNotificationPresenter; +class WebString; +class WebWorker; +class WebWorkerClient; + +// Provides an interface back to the in-page script object for a worker. +// This interface contains common APIs used by both shared and dedicated +// workers. +// All functions are expected to be called back on the thread that created +// the Worker object, unless noted. +class WebCommonWorkerClient { +public: + virtual void postExceptionToWorkerObject( + const WebString& errorString, int lineNumber, + const WebString& sourceURL) = 0; + + virtual void postConsoleMessageToWorkerObject( + int destinationIdentifier, + int sourceIdentifier, + int messageType, + int messageLevel, + const WebString& message, + int lineNumber, + const WebString& sourceURL) = 0; + + 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(WebWorkerClient* client) = 0; + +protected: + ~WebCommonWorkerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCompositionCommand.h b/WebKit/chromium/public/WebCompositionCommand.h new file mode 100644 index 0000000..fa89529 --- /dev/null +++ b/WebKit/chromium/public/WebCompositionCommand.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 WebCompositionCommand_h +#define WebCompositionCommand_h + +namespace WebKit { + +enum WebCompositionCommand { + WebCompositionCommandDiscard, + WebCompositionCommandSet, + WebCompositionCommandConfirm, +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebConsoleMessage.h b/WebKit/chromium/public/WebConsoleMessage.h new file mode 100644 index 0000000..d7a0ead --- /dev/null +++ b/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 "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(LevelLog) + , text(text) { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebContextMenuData.h b/WebKit/chromium/public/WebContextMenuData.h new file mode 100644 index 0000000..b4acb1c --- /dev/null +++ b/WebKit/chromium/public/WebContextMenuData.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 WebContextMenuData_h +#define WebContextMenuData_h + +#include "WebMenuItemInfo.h" +#include "WebPoint.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +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, + }; + // 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; + + // The absolute URL of the page in context. + WebURL pageURL; + + // The absolute URL of the subframe in context. + WebURL frameURL; + + // The encoding for the frame in context. + WebString frameEncoding; + + enum MediaFlags { + MediaNone = 0x0, + MediaInError = 0x1, + MediaPaused = 0x2, + MediaMuted = 0x4, + MediaLoop = 0x8, + MediaCanSave = 0x10, + MediaHasAudio = 0x20, + }; + + // Extra attributes describing media elements. + int mediaFlags; + + // The raw text of the selection in context. + WebString selectedText; + + // Whether spell checking is enabled. + bool isSpellCheckingEnabled; + + // The editable (possibily) misspelled word. + WebString misspelledWord; + + // Whether context is editable. + bool isEditable; + + enum EditFlags { + CanDoNone = 0x0, + CanUndo = 0x1, + CanRedo = 0x2, + CanCut = 0x4, + CanCopy = 0x8, + CanPaste = 0x10, + CanDelete = 0x20, + CanSelectAll = 0x40, + }; + + // Which edit operations are available in the context. + int editFlags; + + // Security information for the context. + WebCString securityInfo; + + // Custom context menu items provided by the WebCore internals. + WebVector<WebMenuItemInfo> customItems; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCookie.h b/WebKit/chromium/public/WebCookie.h new file mode 100644 index 0000000..81cb361 --- /dev/null +++ b/WebKit/chromium/public/WebCookie.h @@ -0,0 +1,77 @@ +/* + * 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 { + +class WebString; + +// 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/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h b/WebKit/chromium/public/WebCrossOriginPreflightResultCache.h new file mode 100644 index 0000000..62827f7 --- /dev/null +++ b/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 "WebCommon.h" + +namespace WebKit { + +// An interface to configure WebKit's cross-origin preflight result cache. +class WebCrossOriginPreflightResultCache { +public: + // Clears the cache. + WEBKIT_API static void clear(); + +private: + WebCrossOriginPreflightResultCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebCursorInfo.h b/WebKit/chromium/public/WebCursorInfo.h new file mode 100644 index 0000000..8926e5c --- /dev/null +++ b/WebKit/chromium/public/WebCursorInfo.h @@ -0,0 +1,121 @@ +/* + * 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 "WebImage.h" +#include "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, + 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/WebKit/chromium/public/WebData.h b/WebKit/chromium/public/WebData.h new file mode 100644 index 0000000..5874bed --- /dev/null +++ b/WebKit/chromium/public/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_API void reset(); + WEBKIT_API void assign(const WebData&); + WEBKIT_API void assign(const char* data, size_t size); + + WEBKIT_API size_t size() const; + WEBKIT_API 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/WebKit/chromium/public/WebDataSource.h b/WebKit/chromium/public/WebDataSource.h new file mode 100644 index 0000000..3a83341 --- /dev/null +++ b/WebKit/chromium/public/WebDataSource.h @@ -0,0 +1,100 @@ +/* + * 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 "WebCommon.h" +#include "WebNavigationType.h" + +namespace WebKit { + +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; + + // 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; + +protected: + ~WebDataSource() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDatabase.h b/WebKit/chromium/public/WebDatabase.h new file mode 100644 index 0000000..179e828 --- /dev/null +++ b/WebKit/chromium/public/WebDatabase.h @@ -0,0 +1,90 @@ +/* + * 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 "WebCommon.h" +#include "WebSecurityOrigin.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Database; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDatabaseObserver; +class WebDatabasePrivate; +class WebString; + +class WebDatabase { +public: + WebDatabase() : m_private(0) { } + WebDatabase(const WebDatabase& d) : m_private(0) { assign(d); } + ~WebDatabase() { reset(); } + + WebDatabase& operator=(const WebDatabase& d) + { + assign(d); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebDatabase&); + bool isNull() const { return !m_private; } + + WEBKIT_API WebString name() const; + WEBKIT_API WebString displayName() const; + WEBKIT_API unsigned long estimatedSize() const; + WEBKIT_API WebSecurityOrigin securityOrigin() const; + + WEBKIT_API static void setObserver(WebDatabaseObserver*); + WEBKIT_API static WebDatabaseObserver* observer(); + + WEBKIT_API static void updateDatabaseSize( + const WebString& originIdentifier, const WebString& databaseName, + unsigned long long databaseSize, unsigned long long spaceAvailable); + +#if WEBKIT_IMPLEMENTATION + WebDatabase(const WTF::PassRefPtr<WebCore::Database>&); + WebDatabase& operator=(const WTF::PassRefPtr<WebCore::Database>&); + operator WTF::PassRefPtr<WebCore::Database>() const; +#endif + +private: + void assign(WebDatabasePrivate*); + + WebDatabasePrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDatabaseObserver.h b/WebKit/chromium/public/WebDatabaseObserver.h new file mode 100644 index 0000000..da85c93 --- /dev/null +++ b/WebKit/chromium/public/WebDatabaseObserver.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 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; +protected: + ~WebDatabaseObserver() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDevToolsAgent.h b/WebKit/chromium/public/WebDevToolsAgent.h new file mode 100644 index 0000000..9c27628 --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsAgent.h @@ -0,0 +1,106 @@ +/* + * 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 "WebCommon.h" + +namespace WebKit { +class WebDevToolsAgentClient; +class WebFrame; +class WebString; +class WebURLRequest; +class WebURLResponse; +class WebView; +struct WebDevToolsMessageData; +struct WebPoint; +struct WebURLError; + +class WebDevToolsAgent { +public: + WEBKIT_API static WebDevToolsAgent* create(WebView*, WebDevToolsAgentClient*); + + virtual ~WebDevToolsAgent() {} + + virtual void attach() = 0; + virtual void detach() = 0; + + virtual void didNavigate() = 0; + + // TODO(32320): remove this method from API. + virtual void dispatchMessageFromFrontend(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3) = 0; + virtual void dispatchMessageFromFrontend(const WebDevToolsMessageData&) = 0; + + virtual void inspectElementAt(const WebPoint&) = 0; + + virtual void setRuntimeFeatureEnabled(const WebString& feature, bool enabled) = 0; + + // Exposed for LayoutTestController. + virtual void evaluateInWebInspector(long callId, const WebString& script) = 0; + virtual void setTimelineProfilingEnabled(bool enabled) = 0; + + // Asynchronously executes debugger command in the render thread. + // |callerIdentifier| will be used for sending response. + WEBKIT_API static void executeDebuggerCommand( + const WebString& command, int callerIdentifier); + + // Asynchronously request debugger to pause immediately. + WEBKIT_API static void debuggerPauseScript(); + + // TODO(32320): remove this method from API. + WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3); + WEBKIT_API static bool dispatchMessageFromFrontendOnIOThread(const WebDevToolsMessageData&); + + typedef void (*MessageLoopDispatchHandler)(); + + // Installs dispatch handle that is going to be called periodically + // while on a breakpoint. + WEBKIT_API static void setMessageLoopDispatchHandler(MessageLoopDispatchHandler); + + virtual void identifierForInitialRequest(unsigned long resourceId, WebFrame*, const WebURLRequest&) = 0; + virtual void willSendRequest(unsigned long resourceId, const WebURLRequest&) = 0; + virtual void didReceiveData(unsigned long resourceId, int length) = 0; + virtual void didReceiveResponse(unsigned long resourceId, const WebURLResponse&) = 0; + virtual void didFinishLoading(unsigned long resourceId) = 0; + virtual void didFailLoading(unsigned long resourceId, const WebURLError&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDevToolsAgentClient.h b/WebKit/chromium/public/WebDevToolsAgentClient.h new file mode 100644 index 0000000..ec51654 --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsAgentClient.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 WebDevToolsAgentClient_h +#define WebDevToolsAgentClient_h + +#include "WebCommon.h" + +namespace WebKit { +class WebString; +struct WebDevToolsMessageData; + +class WebDevToolsAgentClient { +public: + // TODO(32320): remove this method from API. + virtual void sendMessageToFrontend(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3) {} + virtual void sendMessageToFrontend(const WebDevToolsMessageData&) { } + + // Invalidates widget which leads to the repaint. + virtual void forceRepaint() { } + + // Returns the identifier of the entity hosting this agent. + virtual int hostIdentifier() { return -1; } + + // Notifies host upon runtime feature being enabled/disabled. + virtual void runtimeFeatureStateChanged(const WebString& feature, bool enabled) { } + + // TODO(32320): remove this method from API. + WEBKIT_API static void sendMessageToFrontendOnIOThread(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3); + WEBKIT_API static void sendMessageToFrontendOnIOThread(const WebDevToolsMessageData&); + +protected: + ~WebDevToolsAgentClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDevToolsFrontend.h b/WebKit/chromium/public/WebDevToolsFrontend.h new file mode 100644 index 0000000..b7d7189 --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsFrontend.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 WebDevToolsFrontend_h +#define WebDevToolsFrontend_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebDevToolsFrontendClient; +class WebString; +class WebView; +struct WebDevToolsMessageData; + +// WebDevToolsFrontend represents DevTools client sitting in the Glue. It provides +// direct and delegate Apis to the host. +class WebDevToolsFrontend { +public: + WEBKIT_API static WebDevToolsFrontend* create(WebView* view, + WebDevToolsFrontendClient* client, + const WebString& applicationLocale); + + virtual ~WebDevToolsFrontend() {} + + virtual void dispatchMessageFromAgent(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3) = 0; + virtual void dispatchMessageFromAgent(const WebDevToolsMessageData&) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDevToolsFrontendClient.h b/WebKit/chromium/public/WebDevToolsFrontendClient.h new file mode 100644 index 0000000..2f74a8c --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsFrontendClient.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 WebDevToolsFrontendClient_h +#define WebDevToolsFrontendClient_h + +namespace WebKit { + +class WebString; +struct WebDevToolsMessageData; + +class WebDevToolsFrontendClient { +public: + WebDevToolsFrontendClient() {} + + virtual void sendMessageToAgent(const WebString& className, + const WebString& methodName, + const WebString& param1, + const WebString& param2, + const WebString& param3) {}; + virtual void sendMessageToAgent(const WebDevToolsMessageData&) {}; + virtual void sendDebuggerCommandToAgent(const WebString& command) {}; + virtual void sendDebuggerPauseScript() {} + + virtual void activateWindow() {}; + virtual void closeWindow() {}; + virtual void dockWindow() {}; + virtual void undockWindow() {}; + +protected: + virtual ~WebDevToolsFrontendClient() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDevToolsMessageData.h b/WebKit/chromium/public/WebDevToolsMessageData.h new file mode 100644 index 0000000..9bf9acd --- /dev/null +++ b/WebKit/chromium/public/WebDevToolsMessageData.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 WebDevToolsMessageData_h +#define WebDevToolsMessageData_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +struct WebDevToolsMessageData { + WebString className; + WebString methodName; + WebVector<WebString> arguments; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebDragData.h b/WebKit/chromium/public/WebDragData.h new file mode 100644 index 0000000..f7a165d --- /dev/null +++ b/WebKit/chromium/public/WebDragData.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 WebDragData_h +#define WebDragData_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class ChromiumDataObject; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebData; +class WebDragDataPrivate; +class WebString; +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_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebDragData&); + + bool isNull() const { return !m_private; } + + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); + + WEBKIT_API WebString urlTitle() const; + WEBKIT_API void setURLTitle(const WebString&); + + WEBKIT_API WebString fileExtension() const; + WEBKIT_API void setFileExtension(const WebString&); + + WEBKIT_API bool hasFileNames() const; + WEBKIT_API void fileNames(WebVector<WebString>&) const; + WEBKIT_API void setFileNames(const WebVector<WebString>&); + WEBKIT_API void appendToFileNames(const WebString&); + + WEBKIT_API WebString plainText() const; + WEBKIT_API void setPlainText(const WebString&); + + WEBKIT_API WebString htmlText() const; + WEBKIT_API void setHTMLText(const WebString&); + + WEBKIT_API WebURL htmlBaseURL() const; + WEBKIT_API void setHTMLBaseURL(const WebURL&); + + WEBKIT_API WebString fileContentFileName() const; + WEBKIT_API void setFileContentFileName(const WebString&); + + WEBKIT_API WebData fileContent() const; + WEBKIT_API void setFileContent(const WebData&); + +#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/WebKit/chromium/public/WebDragOperation.h b/WebKit/chromium/public/WebDragOperation.h new file mode 100644 index 0000000..050b74f --- /dev/null +++ b/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/WebKit/chromium/public/WebEditingAction.h b/WebKit/chromium/public/WebEditingAction.h new file mode 100644 index 0000000..4e76100 --- /dev/null +++ b/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/WebKit/chromium/public/WebElement.h b/WebKit/chromium/public/WebElement.h new file mode 100644 index 0000000..d7a2cbf --- /dev/null +++ b/WebKit/chromium/public/WebElement.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 WebElement_h +#define WebElement_h + +#include "WebNode.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Element; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + + // Provides readonly 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; } + WEBKIT_API void assign(const WebElement& e) { WebNode::assign(e); } + +#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/WebKit/chromium/public/WebFileChooserCompletion.h b/WebKit/chromium/public/WebFileChooserCompletion.h new file mode 100644 index 0000000..14bace4 --- /dev/null +++ b/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/WebKit/chromium/public/WebFindOptions.h b/WebKit/chromium/public/WebFindOptions.h new file mode 100644 index 0000000..93d48d3 --- /dev/null +++ b/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 "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/WebKit/chromium/public/WebFontCache.h b/WebKit/chromium/public/WebFontCache.h new file mode 100644 index 0000000..05aadc7 --- /dev/null +++ b/WebKit/chromium/public/WebFontCache.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 WebFontCache_h +#define WebFontCache_h + +#include "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_API static size_t fontDataCount(); + + // Returns the number of inactive items in the font data cache. + WEBKIT_API static size_t inactiveFontDataCount(); + + // Clears the cache. + WEBKIT_API static void clear(); + +private: + WebFontCache(); // Not intended to be instanced. +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFormElement.h b/WebKit/chromium/public/WebFormElement.h new file mode 100644 index 0000000..27a1edb --- /dev/null +++ b/WebKit/chromium/public/WebFormElement.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 WebFormElement_h +#define WebFormElement_h + +#include "WebElement.h" +#include "WebInputElement.h" +#include "WebVector.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLFormElement; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + // 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& e) : WebElement(e) { } + + WebElement& operator=(const WebFormElement& e) { WebElement::assign(e); return *this; } + WEBKIT_API void assign(const WebFormElement& e) { WebElement::assign(e); } + +#if WEBKIT_IMPLEMENTATION + WebFormElement(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + WebFormElement& operator=(const WTF::PassRefPtr<WebCore::HTMLFormElement>&); + operator WTF::PassRefPtr<WebCore::HTMLFormElement>() const; +#endif + + WEBKIT_API bool autoComplete() const; + WEBKIT_API WebString action() const; + WEBKIT_API WebString name() const; + WEBKIT_API WebString method() const; + WEBKIT_API void submit(); + // FIXME: Deprecate and replace with WebVector<WebElement>. + WEBKIT_API void getNamedElements(const WebString&, WebVector<WebNode>&); + WEBKIT_API void getInputElements(WebVector<WebInputElement>&) const; + }; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFrame.h b/WebKit/chromium/public/WebFrame.h new file mode 100644 index 0000000..44b57aa --- /dev/null +++ b/WebKit/chromium/public/WebFrame.h @@ -0,0 +1,469 @@ +/* + * 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 "WebCanvas.h" +#include "WebURL.h" + +struct NPObject; + +#if WEBKIT_USING_V8 +namespace v8 { +class Context; +template <class T> class Local; +} +#endif + +namespace WebKit { + +class WebData; +class WebDataSource; +class WebFormElement; +class WebHistoryItem; +class WebInputElement; +class WebPasswordAutocompleteListener; +class WebRange; +class WebSecurityOrigin; +class WebString; +class WebURL; +class WebURLRequest; +class WebView; +struct WebConsoleMessage; +struct WebFindOptions; +struct WebRect; +struct WebScriptSource; +struct WebSize; +template <typename T> class WebVector; + +class WebFrame { +public: + // 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_API static WebFrame* frameForEnteredContext(); + WEBKIT_API static WebFrame* frameForCurrentContext(); + + + // Basic properties --------------------------------------------------- + + // The name of this frame. + virtual WebString name() const = 0; + + // The url of the document loaded in this frame. This is equivalent to + // dataSource()->request().url(). + virtual WebURL url() const = 0; + + // The url of the favicon (if any) specified by the document loaded in + // this frame. + virtual WebURL favIconURL() const = 0; + + // The url of the OpenSearch Desription Document (if any) specified by + // the document loaded in this frame. + virtual WebURL openSearchDescriptionURL() 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. + + // The scroll offset from the top-left corner of the frame in pixels. + virtual WebSize scrollOffset() 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; + + + // 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; + + // 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 void forms(WebVector<WebFormElement>&) const = 0; + + + // Scripting ---------------------------------------------------------- + + // Returns the security origin of the current document. + virtual WebSecurityOrigin securityOrigin() const = 0; + + // This grants the currently loaded document access to all security + // origins (including file URLs). Use with care. The access is + // revoked when a new document is loaded into this frame. + virtual void grantUniversalAccess() = 0; + + // 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 script in a new context associated with the frame. The + // script gets its own global scope and its own prototypes for + // intrinsic JS objects (String, Array, and so-on). It shares the + // 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 executeScriptInNewContext(const WebScriptSource* sources, + unsigned numSources, + int extensionGroup) = 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; + + // 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; + +#if WEBKIT_USING_V8 + // Returns the V8 context for this frame, or an empty handle if there + // is none. + virtual v8::Local<v8::Context> mainWorldScriptContext() const = 0; +#endif + + + // Styling ------------------------------------------------------------- + + // Insert the given text as a STYLE element at the beginning of the + // document. |elementId| can be empty, but if specified then it is used + // as the id for the newly inserted element (replacing an existing one + // with the same id, if any). + virtual bool insertStyleText(const WebString& styleText, + const WebString& elementId) = 0; + + + // Navigation ---------------------------------------------------------- + + // Reload the current document. + virtual void reload() = 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. + virtual void dispatchWillSendRequest(WebURLRequest&) = 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; + + // 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&) = 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; + + + // Printing ------------------------------------------------------------ + + // Reformats the WebFrame for printing. pageSize is the page size in + // pixels. Returns the number of pages that can be printed at the + // given page size. + virtual int printBegin(const WebSize& pageSize) = 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; + + + // 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; + + // Password autocompletion --------------------------------------------- + + // Registers a listener for the specified user name input element. The + // listener will receive notifications for blur and when autocomplete + // should be triggered. + // The WebFrame becomes the owner of the passed listener. + virtual void registerPasswordListener( + WebInputElement, + WebPasswordAutocompleteListener*) = 0; + + // Utility ------------------------------------------------------------- + + // Given a relative URL, returns an absolute URL by resolving the URL + // relative to the base URL of the frame's document. This uses the + // same algorithm that WebKit uses to resolve hyperlinks found in a + // HTML document. + virtual WebURL completeURL(const WebString&) const = 0; + + // 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; + +protected: + ~WebFrame() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebFrameClient.h b/WebKit/chromium/public/WebFrameClient.h new file mode 100644 index 0000000..297eb62 --- /dev/null +++ b/WebKit/chromium/public/WebFrameClient.h @@ -0,0 +1,290 @@ +/* + * 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 WebFrameClient_h +#define WebFrameClient_h + +#include "WebCommon.h" +#include "WebNavigationPolicy.h" +#include "WebNavigationType.h" +#include "WebURLError.h" + +namespace WebKit { + +class WebDataSource; +class WebFormElement; +class WebFrame; +class WebMediaPlayer; +class WebMediaPlayerClient; +class WebNode; +class WebPlugin; +class WebSecurityOrigin; +class WebSharedWorker; +class WebString; +class WebURL; +class WebURLRequest; +class WebURLResponse; +class WebWorker; +class WebWorkerClient; +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*, WebWorkerClient*) { 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; } + + + // General notifications ----------------------------------------------- + + // 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) { } + + + // 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 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*, const WebString& title) { } + + // 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 scrolling the page to a named anchor instead + // of downloading a new document. + virtual void didChangeLocationWithinPage(WebFrame*, bool isNewNavigation) { } + + // 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&) { } + + // 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&) { } + + + // Script notifications ------------------------------------------------ + + // Controls whether scripts are allowed to execute for this frame. + virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; } + + // Script in the page tried to allocate too much memory. + virtual void didExhaustMemoryAvailableForScript(WebFrame*) { } + + // 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*) { } + + // Notifies that this frame's script context has been destroyed. + virtual void didDestroyScriptContext(WebFrame*) { } + + // Notifies that a garbage-collected context was created - content + // scripts. + virtual void didCreateIsolatedScriptContext(WebFrame*) { } + + + // Geometry notifications ---------------------------------------------- + + // 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) { } + +protected: + ~WebFrameClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebHTTPBody.h b/WebKit/chromium/public/WebHTTPBody.h new file mode 100644 index 0000000..43f51a6 --- /dev/null +++ b/WebKit/chromium/public/WebHTTPBody.h @@ -0,0 +1,101 @@ +/* + * 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" + +#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 { TypeData, TypeFile } type; + WebData data; + WebString filePath; + }; + + ~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_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebHTTPBody&); + + bool isNull() const { return !m_private; } + + // Returns the number of elements comprising the http body. + WEBKIT_API size_t elementCount() const; + + // Sets the values of the element at the given index. Returns false if + // index is out of bounds. + WEBKIT_API bool elementAt(size_t index, Element&) const; + + // Append to the list of elements. + WEBKIT_API void appendData(const WebData&); + WEBKIT_API void appendFile(const WebString&); + + // Identifies a particular form submission instance. A value of 0 is + // used to indicate an unspecified identifier. + WEBKIT_API long long identifier() const; + WEBKIT_API 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/WebKit/chromium/public/WebHTTPHeaderVisitor.h b/WebKit/chromium/public/WebHTTPHeaderVisitor.h new file mode 100644 index 0000000..2ca86c0 --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebHistoryItem.h b/WebKit/chromium/public/WebHistoryItem.h new file mode 100644 index 0000000..f15a62c --- /dev/null +++ b/WebKit/chromium/public/WebHistoryItem.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 WebHistoryItem_h +#define WebHistoryItem_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HistoryItem; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebHistoryItemPrivate; +class WebHTTPBody; +class WebString; +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() : m_private(0) { } + WebHistoryItem(const WebHistoryItem& h) : m_private(0) { assign(h); } + WebHistoryItem& operator=(const WebHistoryItem& h) + { + assign(h); + return *this; + } + + WEBKIT_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebHistoryItem&); + + bool isNull() const { return !m_private; } + + WEBKIT_API WebString urlString() const; + WEBKIT_API void setURLString(const WebString&); + + WEBKIT_API WebString originalURLString() const; + WEBKIT_API void setOriginalURLString(const WebString&); + + WEBKIT_API WebString referrer() const; + WEBKIT_API void setReferrer(const WebString&); + + WEBKIT_API WebString target() const; + WEBKIT_API void setTarget(const WebString&); + + WEBKIT_API WebString parent() const; + WEBKIT_API void setParent(const WebString&); + + WEBKIT_API WebString title() const; + WEBKIT_API void setTitle(const WebString&); + + WEBKIT_API WebString alternateTitle() const; + WEBKIT_API void setAlternateTitle(const WebString&); + + WEBKIT_API double lastVisitedTime() const; + WEBKIT_API void setLastVisitedTime(double); + + WEBKIT_API WebPoint scrollOffset() const; + WEBKIT_API void setScrollOffset(const WebPoint&); + + WEBKIT_API bool isTargetItem() const; + WEBKIT_API void setIsTargetItem(bool); + + WEBKIT_API int visitCount() const; + WEBKIT_API void setVisitCount(int); + + WEBKIT_API WebVector<WebString> documentState() const; + WEBKIT_API void setDocumentState(const WebVector<WebString>&); + + WEBKIT_API WebString httpContentType() const; + WEBKIT_API void setHTTPContentType(const WebString&); + + WEBKIT_API WebHTTPBody httpBody() const; + WEBKIT_API void setHTTPBody(const WebHTTPBody&); + + WEBKIT_API WebVector<WebHistoryItem> children() const; + WEBKIT_API void setChildren(const WebVector<WebHistoryItem>&); + WEBKIT_API 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 assign(WebHistoryItemPrivate*); + void ensureMutable(); + WebHistoryItemPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebImage.h b/WebKit/chromium/public/WebImage.h new file mode 100644 index 0000000..a7b6f8c --- /dev/null +++ b/WebKit/chromium/public/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_API static WebImage fromData(const WebData&, const WebSize& desiredSize); + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebImage&); + + WEBKIT_API bool isNull() const; + WEBKIT_API 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; } + void assign(CGImageRef); + CGImageRef m_imageRef; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebInputElement.h b/WebKit/chromium/public/WebInputElement.h new file mode 100644 index 0000000..75e44b9 --- /dev/null +++ b/WebKit/chromium/public/WebInputElement.h @@ -0,0 +1,104 @@ +/* + * 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 "WebElement.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class HTMLInputElement; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + + // Provides readonly access to some properties of a DOM input element node. + class WebInputElement : public WebElement { + public: + WebInputElement() : WebElement() { } + WebInputElement(const WebInputElement& n) : WebElement(n) { } + + WebInputElement& operator=(const WebInputElement& n) { WebElement::assign(n); return *this; } + WEBKIT_API void assign(const WebInputElement& n) { WebElement::assign(n); } + +#if WEBKIT_IMPLEMENTATION + WebInputElement(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + WebInputElement& operator=(const WTF::PassRefPtr<WebCore::HTMLInputElement>&); + operator WTF::PassRefPtr<WebCore::HTMLInputElement>() const; +#endif + + enum InputType { + Text = 0, + Password, + IsIndex, + CheckBox, + Radio, + Submit, + Reset, + File, + Hidden, + Image, + Button, + Search, + Range, + Email, + Number, + Telephone, + URL, + Color, + Date, + DateTime, + DateTimeLocal, + Month, + Time, + Week + }; + + WEBKIT_API bool isEnabledFormControl() const; + WEBKIT_API InputType inputType() const; + WEBKIT_API WebString formControlType() const; + WEBKIT_API void setActivatedSubmit(bool); + WEBKIT_API void setValue(const WebString& value); + WEBKIT_API WebString value() const; + WEBKIT_API void setAutofilled(bool); + WEBKIT_API void dispatchFormControlChangeEvent(); + WEBKIT_API void setSelectionRange(int, int); + WEBKIT_API WebString name() const; + // 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_API WebString nameForAutofill() const; + + }; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebInputEvent.h b/WebKit/chromium/public/WebInputEvent.h new file mode 100644 index 0000000..983aa2a --- /dev/null +++ b/WebKit/chromium/public/WebInputEvent.h @@ -0,0 +1,260 @@ +/* + * 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 "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, + + // WebMouseWheelEvent + MouseWheel, + + // WebKeyboardEvent + RawKeyDown, + KeyDown, + KeyUp, + Char + }; + + 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, + }; + + 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 keyboard event. + static bool isKeyboardEventType(int type) + { + return type == RawKeyDown + || type == KeyDown + || type == KeyUp + || type == Char; + } +}; + +// 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_API 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 clickCount; + + WebMouseEvent(unsigned sizeParam = sizeof(WebMouseEvent)) + : WebInputEvent(sizeParam) + , button(ButtonNone) + , x(0) + , y(0) + , windowX(0) + , windowY(0) + , globalX(0) + , globalY(0) + , clickCount(0) + { + } +}; + +// WebMouseWheelEvent --------------------------------------------------------- + +class WebMouseWheelEvent : public WebMouseEvent { +public: + 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; + + WebMouseWheelEvent(unsigned sizeParam = sizeof(WebMouseWheelEvent)) + : WebMouseEvent(sizeParam) + , deltaX(0.0f) + , deltaY(0.0f) + , wheelTicksX(0.0f) + , wheelTicksY(0.0f) + , scrollByPage(false) + { + } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebKit.h b/WebKit/chromium/public/WebKit.h new file mode 100644 index 0000000..b9e6407 --- /dev/null +++ b/WebKit/chromium/public/WebKit.h @@ -0,0 +1,64 @@ +/* + * 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 "WebCommon.h" + +namespace WebKit { + +class WebKitClient; + +// Must be called on the thread that will be the main WebKit thread before +// using any other WebKit APIs. The provided WebKitClient must be non-null +// and must remain valid until the current thread calls shutdown. +WEBKIT_API void initialize(WebKitClient*); + +// Once shutdown, the WebKitClient 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_API void shutdown(); + +// Returns the WebKitClient instance passed to initialize. +WEBKIT_API WebKitClient* webKitClient(); + +// Alters the rendering of content to conform to a fixed set of rules. +WEBKIT_API void setLayoutTestMode(bool); +WEBKIT_API bool layoutTestMode(); + +// Purge the plugin list cache. If |reloadPages| is true, any pages +// containing plugins will be reloaded after refreshing the plugin list. +WEBKIT_API void resetPluginCache(bool reloadPages); + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebKitClient.h b/WebKit/chromium/public/WebKitClient.h new file mode 100644 index 0000000..2a00a9a --- /dev/null +++ b/WebKit/chromium/public/WebKitClient.h @@ -0,0 +1,277 @@ +/* + * 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 WebKitClient_h +#define WebKitClient_h + +#include "WebCommon.h" +#include "WebData.h" +#include "WebLocalizedString.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +#include <time.h> + +#ifdef WIN32 +typedef void *HANDLE; +#endif + +namespace WebKit { + +class WebApplicationCacheHost; +class WebApplicationCacheHostClient; +class WebClipboard; +class WebMessagePortChannel; +class WebMimeRegistry; +class WebPluginListBuilder; +class WebSandboxSupport; +class WebSharedWorkerRepository; +class WebSocketStreamHandle; +class WebStorageNamespace; +class WebThemeEngine; +class WebURLLoader; +struct WebCookie; +struct WebPluginInfo; +template <typename T> class WebVector; + +class WebKitClient { +public: + // Must return non-null. + virtual WebClipboard* clipboard() { return 0; } + + // Must return non-null. + virtual WebMimeRegistry* mimeRegistry() { 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; } + + + // Application Cache -------------------------------------------- + + // May return null if the process type doesn't involve appcaching. + virtual WebApplicationCacheHost* createApplicationCacheHost(WebApplicationCacheHostClient*) { return 0; } + + + // DOM Storage -------------------------------------------------- + + // Return a LocalStorage namespace that corresponds to the following path. + virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } + + // Return a new SessionStorage namespace. + virtual WebStorageNamespace* createSessionStorageNamespace() { 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) { } + + + // File ---------------------------------------------------------------- + + // Various file/directory related functions. These map 1:1 with + // functions in WebCore's FileSystem.h. + 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, time_t& 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(); } + + + // 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; } + + + // 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, FileHandle* dirHandle) { 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; } + + + // 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; } + + + // 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 ------------------------------------------------------------- + + virtual void setCookies( + const WebURL& url, const WebURL& policyURL, const WebString& cookies) { } + virtual WebString cookies(const WebURL& url, const WebURL& policyURL) { return WebString(); } + virtual bool rawCookies(const WebURL& url, const WebURL& policyURL, WebVector<WebCookie>*) { return false; } + virtual void deleteCookie(const WebURL& url, const WebString& cookieName) { } + + // 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(); } + + + // 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 void traceEventBegin(const char* name, void* id, const char* extra) { }; + virtual void traceEventEnd(const char* name, void* id, const char* extra) { }; + + // Generic callback for reporting histogram data. Range is identified by the min, max pair. + // By default, histogram is exponential, so that min=1, max=1000000, bucketCount=50 would do. Setting + // linear to true would require bucket count to cover whole min-max range. + virtual void histogramCounts(const WebString& name, int sample, int min, int max, int bucketCount, bool linear) { }; + + + // Resources ----------------------------------------------------------- + + // Returns a blob of data corresponding to the named resource. + virtual WebData loadResource(const char* name) { return WebData(); } + + // Returns a localized string resource (with an optional numeric + // parameter value). + virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); } + virtual WebString queryLocalizedString(WebLocalizedString::Name, int numericValue) { 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; } + + // Delayed work is driven by a shared timer. + virtual void setSharedTimerFiredFunction(void (*func)()) { } + virtual void setSharedTimerFireTime(double fireTime) { } + virtual void stopSharedTimer() { } + + // Callable from a background WebKit thread. + virtual void callOnMainThread(void (*func)()) { } + +protected: + ~WebKitClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebLocalizedString.h b/WebKit/chromium/public/WebLocalizedString.h new file mode 100644 index 0000000..99a7d23 --- /dev/null +++ b/WebKit/chromium/public/WebLocalizedString.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 WebLocalizedString_h +#define WebLocalizedString_h + +namespace WebKit { + +struct WebLocalizedString { + enum Name { + SubmitButtonDefaultLabel, + InputElementAltText, + ResetButtonDefaultLabel, + FileButtonChooseFileLabel, + FileButtonNoFileSelectedLabel, + MultipleFileUploadText, + SearchableIndexIntroduction, + SearchMenuNoRecentSearchesText, + SearchMenuRecentSearchesText, + SearchMenuClearRecentSearchesText, + AXWebAreaText, + AXLinkText, + AXListMarkerText, + AXImageMapText, + AXHeadingText, + AXButtonActionVerb, + AXRadioButtonActionVerb, + AXTextFieldActionVerb, + AXCheckedCheckBoxActionVerb, + AXUncheckedCheckBoxActionVerb, + AXLinkActionVerb, + KeygenMenuHighGradeKeySize, + KeygenMenuMediumGradeKeySize, + }; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMediaPlayer.h b/WebKit/chromium/public/WebMediaPlayer.h new file mode 100644 index 0000000..0b658f9 --- /dev/null +++ b/WebKit/chromium/public/WebMediaPlayer.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 WebMediaPlayer_h +#define WebMediaPlayer_h + +#include "WebCanvas.h" +#include "WebVector.h" + +namespace WebKit { + +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, + }; + + 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 bool setAutoBuffer(bool) = 0; + virtual bool totalBytesKnown() = 0; + virtual const WebTimeRanges& buffered() const = 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; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMediaPlayerAction.h b/WebKit/chromium/public/WebMediaPlayerAction.h new file mode 100644 index 0000000..3aede25 --- /dev/null +++ b/WebKit/chromium/public/WebMediaPlayerAction.h @@ -0,0 +1,55 @@ +/* + * 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 + }; + + Type type; + bool enable; + + WebMediaPlayerAction() + : type(Unknown), enable(false) { } + WebMediaPlayerAction(Type type, bool enable) + : type(type), enable(enable) { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMediaPlayerClient.h b/WebKit/chromium/public/WebMediaPlayerClient.h new file mode 100644 index 0000000..558fb4a --- /dev/null +++ b/WebKit/chromium/public/WebMediaPlayerClient.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 WebMediaPlayerClient_h +#define WebMediaPlayerClient_h + +namespace WebKit { + +class WebRequest; +class WebURL; + +class WebMediaPlayerClient { +public: + virtual void networkStateChanged() = 0; + virtual void readyStateChanged() = 0; + virtual void volumeChanged() = 0; + virtual void timeChanged() = 0; + virtual void repaint() = 0; + virtual void durationChanged() = 0; + virtual void rateChanged() = 0; + virtual void sizeChanged() = 0; + virtual void sawUnsupportedTracks() = 0; + +protected: + ~WebMediaPlayerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMenuItemInfo.h b/WebKit/chromium/public/WebMenuItemInfo.h new file mode 100644 index 0000000..d513e66 --- /dev/null +++ b/WebKit/chromium/public/WebMenuItemInfo.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 WebMenuItemInfo_h +#define WebMenuItemInfo_h + +#include "WebCommon.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +struct WebMenuItemInfo { + enum Type { + Option, + CheckableOption, + Group, + Separator, + }; + WebString label; + Type type; + unsigned action; + bool enabled; + bool checked; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebMessagePortChannel.h b/WebKit/chromium/public/WebMessagePortChannel.h new file mode 100644 index 0000000..288bd55 --- /dev/null +++ b/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 "WebCommon.h" +#include "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/WebKit/chromium/public/WebMessagePortChannelClient.h b/WebKit/chromium/public/WebMessagePortChannelClient.h new file mode 100644 index 0000000..0b85bb3 --- /dev/null +++ b/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/WebKit/chromium/public/WebMimeRegistry.h b/WebKit/chromium/public/WebMimeRegistry.h new file mode 100644 index 0000000..425753e --- /dev/null +++ b/WebKit/chromium/public/WebMimeRegistry.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 WebMimeRegistry_h +#define WebMimeRegistry_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebString; + +class WebMimeRegistry { +public: + enum SupportsType { IsNotSupported, IsSupported, MayBeSupported }; + + virtual SupportsType supportsMIMEType(const WebString& mimeType) = 0; + virtual SupportsType supportsImageMIMEType(const WebString& mimeType) = 0; + virtual SupportsType supportsJavaScriptMIMEType(const WebString& mimeType) = 0; + virtual SupportsType supportsMediaMIMEType(const WebString& mimeType, + const WebString& codecs) = 0; + virtual SupportsType supportsNonImageMIMEType(const WebString& mimeType) = 0; + + virtual WebString mimeTypeForExtension(const WebString& fileExtension) = 0; + virtual WebString mimeTypeFromFile(const WebString& filePath) = 0; + virtual WebString preferredExtensionForMIMEType(const WebString& mimeType) = 0; + +protected: + ~WebMimeRegistry() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebNavigationPolicy.h b/WebKit/chromium/public/WebNavigationPolicy.h new file mode 100644 index 0000000..54bee9d --- /dev/null +++ b/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/WebKit/chromium/public/WebNavigationType.h b/WebKit/chromium/public/WebNavigationType.h new file mode 100644 index 0000000..8ca8dc6 --- /dev/null +++ b/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/WebKit/chromium/public/WebNode.h b/WebKit/chromium/public/WebNode.h new file mode 100644 index 0000000..03afa90 --- /dev/null +++ b/WebKit/chromium/public/WebNode.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 WebNode_h +#define WebNode_h + +#include "WebCommon.h" +#include "WebString.h" + +namespace WebCore { class Node; } +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { +class WebFrame; + +// Provides readonly access to some properties of a DOM node. +class WebNode { +public: + virtual ~WebNode() { reset(); } + + WebNode() : m_private(0) { } + WebNode(const WebNode& n) : m_private(0) { assign(n); } + WebNode& operator=(const WebNode& n) + { + assign(n); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebNode&); + + bool isNull() const { return !m_private; } + +#if WEBKIT_IMPLEMENTATION + WebNode(const WTF::PassRefPtr<WebCore::Node>&); + WebNode& operator=(const WTF::PassRefPtr<WebCore::Node>&); + operator WTF::PassRefPtr<WebCore::Node>() const; +#endif + + WEBKIT_API WebNode parentNode() const; + WEBKIT_API WebString nodeName() const; + WEBKIT_API WebFrame* frame() const; + + template<typename T> T toElement() + { + T res; + res.m_private = m_private; + return res; + } + +protected: + typedef WebCore::Node WebNodePrivate; + void assign(WebNodePrivate*); + WebNodePrivate* 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/WebKit/chromium/public/WebNonCopyable.h b/WebKit/chromium/public/WebNonCopyable.h new file mode 100644 index 0000000..b0bd456 --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebNotification.h b/WebKit/chromium/public/WebNotification.h new file mode 100644 index 0000000..1a41252 --- /dev/null +++ b/WebKit/chromium/public/WebNotification.h @@ -0,0 +1,118 @@ +/* + * 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 "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Notification; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +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_API void reset(); + WEBKIT_API 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; } + bool lessThan(const WebNotification& other) const; + + // Is the notification HTML vs. icon-title-text? + WEBKIT_API bool isHTML() const; + + // If HTML, the URL which contains the contents of the notification. + WEBKIT_API WebURL url() const; + + // If not HTML, the parameters for the icon-title-text notification. + WEBKIT_API WebString icon() const; + WEBKIT_API WebString title() const; + WEBKIT_API WebString body() const; + + // Called to indicate the notification has been displayed. + WEBKIT_API void dispatchDisplayEvent(); + + // Called to indicate an error has occurred with this notification. + WEBKIT_API 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_API void dispatchCloseEvent(bool byUser); + +#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*); + 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/WebKit/chromium/public/WebNotificationPermissionCallback.h b/WebKit/chromium/public/WebNotificationPermissionCallback.h new file mode 100644 index 0000000..07e85ee --- /dev/null +++ b/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/WebKit/chromium/public/WebNotificationPresenter.h b/WebKit/chromium/public/WebNotificationPresenter.h new file mode 100644 index 0000000..653b142 --- /dev/null +++ b/WebKit/chromium/public/WebNotificationPresenter.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 WebNotificationPresenter_h +#define WebNotificationPresenter_h + +#include "WebString.h" + +namespace WebKit { + +class WebNotification; +class WebNotificationPermissionCallback; + +// 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 of a given origin. + virtual Permission checkPermission(const WebString& origin) = 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 WebString& origin, WebNotificationPermissionCallback* callback) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPasswordAutocompleteListener.h b/WebKit/chromium/public/WebPasswordAutocompleteListener.h new file mode 100644 index 0000000..db6589d --- /dev/null +++ b/WebKit/chromium/public/WebPasswordAutocompleteListener.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 WebPasswordAutocompleteListener_h +#define WebPasswordAutocompleteListener_h + +namespace WebKit { +class WebString; + +class WebPasswordAutocompleteListener { +public: + virtual ~WebPasswordAutocompleteListener() {} + + virtual void didBlurInputElement( + const WebString& userInput) = 0; + + virtual void performInlineAutocomplete( + const WebString& userInput, + bool backSpaceOrDeletePressed, + bool showSuggestions) = 0; +}; + +} // namespace WebKit + + +#endif diff --git a/WebKit/chromium/public/WebPasswordFormData.h b/WebKit/chromium/public/WebPasswordFormData.h new file mode 100644 index 0000000..e1804d1 --- /dev/null +++ b/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 "WebString.h" +#include "WebURL.h" + +namespace WebKit { + +struct WebPasswordFormData { + // If the provided form is suitable for password completion, isValid() will + // return true; + 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/WebKit/chromium/public/WebPlugin.h b/WebKit/chromium/public/WebPlugin.h new file mode 100644 index 0000000..5097265 --- /dev/null +++ b/WebKit/chromium/public/WebPlugin.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 WebPlugin_h +#define WebPlugin_h + +#include "WebCanvas.h" + +struct NPObject; + +namespace WebKit { + +class WebDataSource; +class WebFrame; +class WebInputEvent; +class WebPluginContainer; +class WebURL; +class WebURLResponse; +struct WebCursorInfo; +struct WebPluginParams; +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; + + 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; + +protected: + ~WebPlugin() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPluginContainer.h b/WebKit/chromium/public/WebPluginContainer.h new file mode 100644 index 0000000..41e304e --- /dev/null +++ b/WebKit/chromium/public/WebPluginContainer.h @@ -0,0 +1,82 @@ +/* + * 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 WebString; +class WebURL; +class WebURLRequest; +struct WebRect; + +class WebPluginContainer { +public: + virtual void invalidate() = 0; + virtual void invalidateRect(const WebRect&) = 0; + + // Causes the container to report its current geometry via + // WebPlugin::updateGeometry. + virtual void reportGeometry() = 0; + + // 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; + +protected: + ~WebPluginContainer() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPluginListBuilder.h b/WebKit/chromium/public/WebPluginListBuilder.h new file mode 100644 index 0000000..4bd427d --- /dev/null +++ b/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/WebKit/chromium/public/WebPluginParams.h b/WebKit/chromium/public/WebPluginParams.h new file mode 100644 index 0000000..5d03204 --- /dev/null +++ b/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 "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +namespace WebKit { + +struct WebPluginParams { + WebURL url; + WebString mimeType; + WebVector<WebString> attributeNames; + WebVector<WebString> attributeValues; + bool loadManually; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPoint.h b/WebKit/chromium/public/WebPoint.h new file mode 100644 index 0000000..d1abe02 --- /dev/null +++ b/WebKit/chromium/public/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 <base/gfx/rect.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/WebKit/chromium/public/WebPopupMenu.h b/WebKit/chromium/public/WebPopupMenu.h new file mode 100644 index 0000000..c2cdec3 --- /dev/null +++ b/WebKit/chromium/public/WebPopupMenu.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 WebPopupMenu_h +#define WebPopupMenu_h + +#include "WebCommon.h" +#include "WebWidget.h" + +namespace WebKit { + +class WebWidgetClient; + +class WebPopupMenu : public WebWidget { +public: + WEBKIT_API static WebPopupMenu* create(WebWidgetClient*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebPopupMenuInfo.h b/WebKit/chromium/public/WebPopupMenuInfo.h new file mode 100644 index 0000000..876842d --- /dev/null +++ b/WebKit/chromium/public/WebPopupMenuInfo.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 WebPopupMenuInfo_h +#define WebPopupMenuInfo_h + +#include "WebMenuItemInfo.h" +#include "WebVector.h" + +namespace WebKit { + +// Describes the contents of a popup menu. +struct WebPopupMenuInfo { + // FIXME: migrate clients to WebMenuItemInfo and remove this temporary Item typedef. + typedef WebMenuItemInfo Item; + int itemHeight; + int selectedIndex; + WebVector<WebMenuItemInfo> items; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebRange.h b/WebKit/chromium/public/WebRange.h new file mode 100644 index 0000000..89fc8f6 --- /dev/null +++ b/WebKit/chromium/public/WebRange.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 WebRange_h +#define WebRange_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Range; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +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_API void reset(); + WEBKIT_API void assign(const WebRange&); + + bool isNull() const { return !m_private; } + + WEBKIT_API int startOffset() const; + WEBKIT_API int endOffset() const; + WEBKIT_API WebNode startContainer(int& exceptionCode) const; + WEBKIT_API WebNode endContainer(int& exceptionCode) const; + + WEBKIT_API WebString toHTMLText() const; + WEBKIT_API WebString toPlainText() const; + +#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/WebKit/chromium/public/WebRect.h b/WebKit/chromium/public/WebRect.h new file mode 100644 index 0000000..ed5a7d1 --- /dev/null +++ b/WebKit/chromium/public/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 <base/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/WebKit/chromium/public/WebRegularExpression.h b/WebKit/chromium/public/WebRegularExpression.h new file mode 100644 index 0000000..bdf72d8 --- /dev/null +++ b/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 "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebTextCaseSensitivity.h" + +namespace WebKit { + +class WebRegularExpressionPrivate; +class WebString; + +class WebRegularExpression : public WebNonCopyable { +public: + WEBKIT_API WebRegularExpression(const WebString& pattern, WebTextCaseSensitivity); + WEBKIT_API ~WebRegularExpression(); + + WEBKIT_API int match(const WebString&, int startFrom = 0, int* matchLength = 0) const; + +private: + WebRegularExpressionPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebRuntimeFeatures.h b/WebKit/chromium/public/WebRuntimeFeatures.h new file mode 100644 index 0000000..eb6b2da --- /dev/null +++ b/WebKit/chromium/public/WebRuntimeFeatures.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 WebRuntimeFeatures_h +#define WebRuntimeFeatures_h + +#include "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_API static void enableDatabase(bool); + WEBKIT_API static bool isDatabaseEnabled(); + + WEBKIT_API static void enableLocalStorage(bool); + WEBKIT_API static bool isLocalStorageEnabled(); + + WEBKIT_API static void enableSessionStorage(bool); + WEBKIT_API static bool isSessionStorageEnabled(); + + WEBKIT_API static void enableMediaPlayer(bool); + WEBKIT_API static bool isMediaPlayerEnabled(); + + WEBKIT_API static void enableSockets(bool); + WEBKIT_API static bool isSocketsEnabled(); + + WEBKIT_API static void enableNotifications(bool); + WEBKIT_API static bool isNotificationsEnabled(); + + WEBKIT_API static void enableApplicationCache(bool); + WEBKIT_API static bool isApplicationCacheEnabled(); + +private: + WebRuntimeFeatures(); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebScreenInfo.h b/WebKit/chromium/public/WebScreenInfo.h new file mode 100644 index 0000000..d3d268a --- /dev/null +++ b/WebKit/chromium/public/WebScreenInfo.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 WebScreenInfo_h +#define WebScreenInfo_h + +#include "WebRect.h" + +namespace WebKit { + +struct WebScreenInfo { + // 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; + + WebScreenInfo() + : depth(0) + , depthPerComponent(0) + , isMonochrome(false) { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebScriptController.h b/WebKit/chromium/public/WebScriptController.h new file mode 100644 index 0000000..54bb08a --- /dev/null +++ b/WebKit/chromium/public/WebScriptController.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 WebScriptController_h +#define WebScriptController_h + +#include "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_API static void registerExtension(v8::Extension*); + WEBKIT_API static void registerExtension(v8::Extension*, + const WebString& schemeRestriction); + WEBKIT_API static void registerExtension(v8::Extension*, int extensionGroup); + + // 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_API static void enableV8SingleThreadMode(); + + // Process any pending JavaScript console messages. + WEBKIT_API static void flushConsoleMessages(); + +private: + WebScriptController(); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebScriptSource.h b/WebKit/chromium/public/WebScriptSource.h new file mode 100644 index 0000000..344815b --- /dev/null +++ b/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 "WebString.h" +#include "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/WebKit/chromium/public/WebSearchableFormData.h b/WebKit/chromium/public/WebSearchableFormData.h new file mode 100644 index 0000000..e453387 --- /dev/null +++ b/WebKit/chromium/public/WebSearchableFormData.h @@ -0,0 +1,69 @@ +/* + * 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 "WebString.h" +#include "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. + WebSearchableFormData(const WebFormElement&); + + 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/WebKit/chromium/public/WebSecurityOrigin.h b/WebKit/chromium/public/WebSecurityOrigin.h new file mode 100644 index 0000000..d04fbc6 --- /dev/null +++ b/WebKit/chromium/public/WebSecurityOrigin.h @@ -0,0 +1,92 @@ +/* + * 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 WebSecurityOrigin_h +#define WebSecurityOrigin_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class SecurityOrigin; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebSecurityOriginPrivate; +class WebString; + +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_API void reset(); + WEBKIT_API void assign(const WebSecurityOrigin&); + + bool isNull() const { return !m_private; } + + WEBKIT_API WebString protocol() const; + WEBKIT_API WebString host() const; + WEBKIT_API unsigned short port() const; + + // The empty WebSecurityOrigin is the least privileged WebSecurityOrigin. + WEBKIT_API bool isEmpty() 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_API 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_API WebString databaseIdentifier(); + +#if WEBKIT_IMPLEMENTATION + WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); + WebSecurityOrigin& operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>&); + operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const; +#endif + +private: + void assign(WebSecurityOriginPrivate*); + WebSecurityOriginPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSecurityPolicy.h b/WebKit/chromium/public/WebSecurityPolicy.h new file mode 100644 index 0000000..47dfe87 --- /dev/null +++ b/WebKit/chromium/public/WebSecurityPolicy.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 WebSecurityPolicy_h +#define WebSecurityPolicy_h + +#include "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_API 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_API static void registerURLSchemeAsNoAccess(const WebString&); + + // Support for whitelisting access to origins beyond the same-origin policy. + WEBKIT_API static void whiteListAccessFromOrigin( + const WebURL& sourceOrigin, const WebString& destinationProtocol, + const WebString& destinationHost, bool allowDestinationSubdomains); + WEBKIT_API static void resetOriginAccessWhiteLists(); + +private: + WebSecurityPolicy(); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h new file mode 100644 index 0000000..da36806 --- /dev/null +++ b/WebKit/chromium/public/WebSettings.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 WebSettings_h +#define WebSettings_h + +#include "WebCommon.h" + +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: + virtual void setStandardFontFamily(const WebString&) = 0; + virtual void setFixedFontFamily(const WebString&) = 0; + virtual void setSerifFontFamily(const WebString&) = 0; + virtual void setSansSerifFontFamily(const WebString&) = 0; + virtual void setCursiveFontFamily(const WebString&) = 0; + virtual void setFantasyFontFamily(const WebString&) = 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 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 setUsesPageCache(bool) = 0; + virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setXSSAuditorEnabled(bool) = 0; + virtual void setLocalStorageEnabled(bool) = 0; + virtual void setEditableLinkBehaviorNeverLive() = 0; + virtual void setFontRenderingModeNormal() = 0; + virtual void setShouldPaintCustomScrollbars(bool) = 0; + virtual void setDatabasesEnabled(bool) = 0; + virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; + virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; + virtual void setExperimentalWebGLEnabled(bool) = 0; + virtual void setGeolocationEnabled(bool) = 0; + +protected: + ~WebSettings() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSharedWorker.h b/WebKit/chromium/public/WebSharedWorker.h new file mode 100644 index 0000000..4ac7639 --- /dev/null +++ b/WebKit/chromium/public/WebSharedWorker.h @@ -0,0 +1,82 @@ +/* + * 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 "WebCommon.h" + +namespace WebCore { +class ScriptExecutionContext; +} + +namespace WebKit { + +class WebString; +class WebMessagePortChannel; +class WebCommonWorkerClient; +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_API static WebSharedWorker* create(WebCommonWorkerClient*); + + 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) = 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; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebSharedWorkerRepository.h b/WebKit/chromium/public/WebSharedWorkerRepository.h new file mode 100644 index 0000000..9fe6890 --- /dev/null +++ b/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 "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/WebKit/chromium/public/WebSize.h b/WebKit/chromium/public/WebSize.h new file mode 100644 index 0000000..bb88633 --- /dev/null +++ b/WebKit/chromium/public/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 <base/gfx/rect.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/WebKit/chromium/public/WebSocketStreamError.h b/WebKit/chromium/public/WebSocketStreamError.h new file mode 100644 index 0000000..f52869b --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebSocketStreamHandle.h b/WebKit/chromium/public/WebSocketStreamHandle.h new file mode 100644 index 0000000..ededa0e --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebSocketStreamHandleClient.h b/WebKit/chromium/public/WebSocketStreamHandleClient.h new file mode 100644 index 0000000..82f328c --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/WebStorageArea.h b/WebKit/chromium/public/WebStorageArea.h new file mode 100644 index 0000000..71dc7a5 --- /dev/null +++ b/WebKit/chromium/public/WebStorageArea.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 WebStorageArea_h +#define WebStorageArea_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebString; +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() { } + + // 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. QuotaException is set if we've + // the StorageArea would have exceeded its quota. The value is NOT set when there's + // an exception. url is the url that should be used if a storage event fires. + virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, bool& quotaException) = 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) = 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) = 0; +}; + +} // namespace WebKit + +#endif // WebStorageArea_h diff --git a/WebKit/chromium/public/WebStorageEventDispatcher.h b/WebKit/chromium/public/WebStorageEventDispatcher.h new file mode 100644 index 0000000..57750e8 --- /dev/null +++ b/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 "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: + 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/WebKit/chromium/public/WebStorageNamespace.h b/WebKit/chromium/public/WebStorageNamespace.h new file mode 100644 index 0000000..da92a77 --- /dev/null +++ b/WebKit/chromium/public/WebStorageNamespace.h @@ -0,0 +1,72 @@ +/* + * 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 "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_API static WebStorageNamespace* createLocalStorageNamespace(const WebString& backingDirectoryPath, unsigned quota); + WEBKIT_API static WebStorageNamespace* createSessionStorageNamespace(); + + 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/WebKit/chromium/public/WebString.h b/WebKit/chromium/public/WebString.h new file mode 100644 index 0000000..d9b66b2 --- /dev/null +++ b/WebKit/chromium/public/WebString.h @@ -0,0 +1,155 @@ +/* + * 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 WebString_h +#define WebString_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { +class String; +class AtomicString; +} +#else +#include <base/nullable_string16.h> +#include <base/string16.h> +#endif + +namespace WebKit { + +class WebCString; +class WebStringPrivate; + +// A UTF-16 string container. It is inexpensive to copy a WebString +// object. +// +// WARNING: It is not safe to pass a WebString across threads!!! +// +class WebString { +public: + ~WebString() { reset(); } + + WebString() : m_private(0) { } + + WebString(const WebUChar* data, size_t len) : m_private(0) + { + assign(data, len); + } + + WebString(const WebString& s) : m_private(0) { assign(s); } + + WebString& operator=(const WebString& s) + { + assign(s); + return *this; + } + + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebString&); + WEBKIT_API void assign(const WebUChar* data, size_t len); + + WEBKIT_API size_t length() const; + WEBKIT_API const WebUChar* data() const; + + bool isEmpty() const { return !length(); } + bool isNull() const { return !m_private; } + + WEBKIT_API WebCString utf8() const; + + WEBKIT_API static WebString fromUTF8(const char* data, size_t length); + WEBKIT_API static WebString fromUTF8(const char* data); + +#if WEBKIT_IMPLEMENTATION + WebString(const WebCore::String&); + WebString& operator=(const WebCore::String&); + operator WebCore::String() const; + + WebString(const WebCore::AtomicString&); + WebString& operator=(const WebCore::AtomicString&); + operator WebCore::AtomicString() const; +#else + WebString(const string16& s) : m_private(0) + { + assign(s.data(), s.length()); + } + + WebString& operator=(const string16& s) + { + assign(s.data(), s.length()); + return *this; + } + + operator string16() const + { + size_t len = length(); + return len ? string16(data(), len) : string16(); + } + + WebString(const NullableString16& s) : m_private(0) + { + if (s.is_null()) + assign(0); + else + assign(s.string().data(), s.string().length()); + } + + WebString& operator=(const NullableString16& s) + { + if (s.is_null()) + assign(0); + else + assign(s.string().data(), s.string().length()); + return *this; + } + + operator NullableString16() const + { + if (!m_private) + return NullableString16(string16(), true); + size_t len = length(); + return NullableString16(len ? string16(data(), len) : string16(), false); + } + + template <class UTF8String> + static WebString fromUTF8(const UTF8String& s) + { + return fromUTF8(s.data(), s.length()); + } +#endif + +private: + void assign(WebStringPrivate*); + WebStringPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebTextAffinity.h b/WebKit/chromium/public/WebTextAffinity.h new file mode 100644 index 0000000..1224f61 --- /dev/null +++ b/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/WebKit/chromium/public/WebTextCaseSensitivity.h b/WebKit/chromium/public/WebTextCaseSensitivity.h new file mode 100644 index 0000000..ae5860c --- /dev/null +++ b/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/WebKit/chromium/public/WebTextDirection.h b/WebKit/chromium/public/WebTextDirection.h new file mode 100644 index 0000000..3d51296 --- /dev/null +++ b/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/WebKit/chromium/public/WebURL.h b/WebKit/chromium/public/WebURL.h new file mode 100644 index 0000000..78a16a8 --- /dev/null +++ b/WebKit/chromium/public/WebURL.h @@ -0,0 +1,143 @@ +/* + * 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; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURLError.h b/WebKit/chromium/public/WebURLError.h new file mode 100644 index 0000000..de88e3e --- /dev/null +++ b/WebKit/chromium/public/WebURLError.h @@ -0,0 +1,69 @@ +/* + * 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; + + // The url that failed to load. + WebURL unreachableURL; + + WebURLError() : reason(0) { } + +#if defined(WEBKIT_IMPLEMENTATION) + WebURLError(const WebCore::ResourceError&); + WebURLError& operator=(const WebCore::ResourceError&); + operator WebCore::ResourceError() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURLLoader.h b/WebKit/chromium/public/WebURLLoader.h new file mode 100644 index 0000000..54d105e --- /dev/null +++ b/WebKit/chromium/public/WebURLLoader.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 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/WebKit/chromium/public/WebURLLoaderClient.h b/WebKit/chromium/public/WebURLLoaderClient.h new file mode 100644 index 0000000..03b2c54 --- /dev/null +++ b/WebKit/chromium/public/WebURLLoaderClient.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 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) = 0; + + // 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) = 0; + + // Called when response headers are received. + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) = 0; + + // Called when a chunk of response data is received. + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength) = 0; + + // Called when the load completes successfully. + virtual void didFinishLoading(WebURLLoader*) = 0; + + // Called when the load completes with an error. + virtual void didFail(WebURLLoader*, const WebURLError&) = 0; + +protected: + ~WebURLLoaderClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebURLRequest.h b/WebKit/chromium/public/WebURLRequest.h new file mode 100644 index 0000000..41443b4 --- /dev/null +++ b/WebKit/chromium/public/WebURLRequest.h @@ -0,0 +1,161 @@ +/* + * 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, // Temporary for backward compatibility. + TargetIsSubframe = 1, + TargetIsSubResource = 2, // Temporary for backward comptibility. + TargetIsSubresource = 2, + TargetIsStyleSheet = 3, + TargetIsScript = 4, + TargetIsFontResource = 5, + TargetIsImage = 6, + TargetIsObject = 7, + TargetIsMedia = 8 + }; + + ~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_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLRequest&); + + WEBKIT_API bool isNull() const; + + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); + + // Used to implement third-party cookie blocking. + WEBKIT_API WebURL firstPartyForCookies() const; + WEBKIT_API void setFirstPartyForCookies(const WebURL&); + + WEBKIT_API bool allowCookies() const; + WEBKIT_API void setAllowCookies(bool allowCookies); + + // Controls whether user name, password, and cookies may be sent with the + // request. (If false, this overrides allowCookies.) + WEBKIT_API bool allowStoredCredentials() const; + WEBKIT_API void setAllowStoredCredentials(bool allowStoredCredentials); + + WEBKIT_API CachePolicy cachePolicy() const; + WEBKIT_API void setCachePolicy(CachePolicy); + + WEBKIT_API WebString httpMethod() const; + WEBKIT_API void setHTTPMethod(const WebString&); + + WEBKIT_API WebString httpHeaderField(const WebString& name) const; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void clearHTTPHeaderField(const WebString& name); + WEBKIT_API void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_API WebHTTPBody httpBody() const; + WEBKIT_API void setHTTPBody(const WebHTTPBody&); + + // Controls whether upload progress events are generated when a request + // has a body. + WEBKIT_API bool reportUploadProgress() const; + WEBKIT_API void setReportUploadProgress(bool); + + WEBKIT_API TargetType targetType() const; + WEBKIT_API void setTargetType(TargetType); + + // A consumer controlled value intended to be used to identify the + // requestor. + WEBKIT_API int requestorID() const; + WEBKIT_API void setRequestorID(int); + + // A consumer controlled value intended to be used to identify the + // process of the requestor. + WEBKIT_API int requestorProcessID() const; + WEBKIT_API void setRequestorProcessID(int); + + // Allows the request to be matched up with its app cache host. + WEBKIT_API int appCacheHostID() const; + WEBKIT_API void setAppCacheHostID(int id); + +#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/WebKit/chromium/public/WebURLResponse.h b/WebKit/chromium/public/WebURLResponse.h new file mode 100644 index 0000000..cdac83c --- /dev/null +++ b/WebKit/chromium/public/WebURLResponse.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 WebURLResponse_h +#define WebURLResponse_h + +#include "WebCommon.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceResponse; } +#endif + +namespace WebKit { + +class WebCString; +class WebHTTPHeaderVisitor; +class WebString; +class WebURL; +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_API void initialize(); + WEBKIT_API void reset(); + WEBKIT_API void assign(const WebURLResponse&); + + WEBKIT_API bool isNull() const; + + WEBKIT_API WebURL url() const; + WEBKIT_API void setURL(const WebURL&); + + WEBKIT_API WebString mimeType() const; + WEBKIT_API void setMIMEType(const WebString&); + + WEBKIT_API long long expectedContentLength() const; + WEBKIT_API void setExpectedContentLength(long long); + + WEBKIT_API WebString textEncodingName() const; + WEBKIT_API void setTextEncodingName(const WebString&); + + WEBKIT_API WebString suggestedFileName() const; + WEBKIT_API void setSuggestedFileName(const WebString&); + + WEBKIT_API int httpStatusCode() const; + WEBKIT_API void setHTTPStatusCode(int); + + WEBKIT_API WebString httpStatusText() const; + WEBKIT_API void setHTTPStatusText(const WebString&); + + WEBKIT_API WebString httpHeaderField(const WebString& name) const; + WEBKIT_API void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_API void clearHTTPHeaderField(const WebString& name); + WEBKIT_API void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_API double lastModifiedDate() const; + WEBKIT_API void setLastModifiedDate(double); + + WEBKIT_API bool isContentFiltered() const; + WEBKIT_API void setIsContentFiltered(bool); + + WEBKIT_API long long appCacheID() const; + WEBKIT_API void setAppCacheID(long long); + + WEBKIT_API WebURL appCacheManifestURL() const; + WEBKIT_API void setAppCacheManifestURL(const WebURL&); + + // A consumer controlled value intended to be used to record opaque + // security info related to this request. + WEBKIT_API WebCString securityInfo() const; + WEBKIT_API void setSecurityInfo(const WebCString&); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceResponse& toMutableResourceResponse(); + const WebCore::ResourceResponse& toResourceResponse() const; +#endif + +protected: + void assign(WebURLResponsePrivate*); + +private: + WebURLResponsePrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebVector.h b/WebKit/chromium/public/WebVector.h new file mode 100644 index 0000000..d1f99b4 --- /dev/null +++ b/WebKit/chromium/public/WebVector.h @@ -0,0 +1,162 @@ +/* + * 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()); + } + + 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) { return m_ptr[i]; } + const T& operator[](size_t i) const { return m_ptr[i]; } + + 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/WebKit/chromium/public/WebView.h b/WebKit/chromium/public/WebView.h new file mode 100644 index 0000000..5e1f15d --- /dev/null +++ b/WebKit/chromium/public/WebView.h @@ -0,0 +1,265 @@ +/* + * 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 "WebWidget.h" + +namespace WebKit { + +class WebAccessibilityObject; +class WebDevToolsAgent; +class WebDragData; +class WebFrame; +class WebFrameClient; +class WebNode; +class WebSettings; +class WebString; +class WebViewClient; +struct WebMediaPlayerAction; +struct WebPoint; +template <typename T> class WebVector; + +class WebView : public WebWidget { +public: + // Initialization ------------------------------------------------------ + + // Creates a WebView that is NOT yet initialized. You will need to + // call initializeMainFrame to finish the initialization. It is valid + // to pass a null WebViewClient pointer. + WEBKIT_API 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; + + + // 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; + + + // 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; + + + // Zoom ---------------------------------------------------------------- + + // Returns the current zoom level. 0 is "original size", and each increment + // above or below represents zooming 20% larger or smaller to limits of 300% + // and 50% of original size, respectively. + virtual int 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 int setZoomLevel(bool textOnly, int zoomLevel) = 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; + + // 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&, int identity, + 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; + + virtual int dragIdentity() = 0; + + // Helper method for drag and drop target operations: override the + // default drop effect with either a "copy" (accept true) or "none" + // (accept false) effect. Return true on success. + virtual bool setDropEffect(bool accept) = 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; + + // The embedder may optionally engage a WebDevToolsAgent. This may only + // be set once per WebView. + virtual WebDevToolsAgent* devToolsAgent() = 0; + virtual void setDevToolsAgent(WebDevToolsAgent*) = 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. + virtual void applyAutofillSuggestions( + const WebNode&, + const WebVector<WebString>& suggestions, + int defaultSuggestionIndex) = 0; + + // Hides the autofill popup if any are showing. + virtual void hideAutofillPopup() = 0; + + + // Context menu -------------------------------------------------------- + + virtual void performCustomContextMenuAction(unsigned action) = 0; + + + // Visited link state -------------------------------------------------- + + // Tells all WebView instances to update the visited link state for the + // specified hash. + WEBKIT_API static void updateVisitedLinkState(unsigned long long hash); + + // Tells all WebView instances to update the visited state for all + // their links. + WEBKIT_API static void resetVisitedLinkState(); + + + // Scrollbar colors ---------------------------------------------------- + virtual void setScrollbarColors(unsigned inactiveColor, + unsigned activeColor, + unsigned trackColor) = 0; + +protected: + ~WebView() {} +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebViewClient.h b/WebKit/chromium/public/WebViewClient.h new file mode 100644 index 0000000..2e2f953 --- /dev/null +++ b/WebKit/chromium/public/WebViewClient.h @@ -0,0 +1,278 @@ +/* + * 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 "WebDragOperation.h" +#include "WebEditingAction.h" +#include "WebFileChooserCompletion.h" +#include "WebString.h" +#include "WebTextAffinity.h" +#include "WebTextDirection.h" +#include "WebWidgetClient.h" + +namespace WebKit { + +class WebAccessibilityObject; +class WebDragData; +class WebFileChooserCompletion; +class WebFrame; +class WebNode; +class WebNotificationPresenter; +class WebRange; +class WebURL; +class WebView; +class WebWidget; +struct WebConsoleMessage; +struct WebContextMenuData; +struct WebPoint; +struct WebPopupMenuInfo; + +// 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. + virtual WebView* createView(WebFrame* creator) { 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(bool activatable) { return 0; } + virtual WebWidget* createPopupMenu(const WebPopupMenuInfo&) { 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; } + + + // Navigational -------------------------------------------------------- + + // These notifications bracket any loading that occurs in the WebView. + virtual void didStartLoading() { } + virtual void didStopLoading() { } + + + // 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 setInputMethodEnabled(bool enabled) { } + + 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; } + + + // Spellchecker -------------------------------------------------------- + + // 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. + virtual void spellCheck( + const WebString& text, int& misspelledOffset, int& misspelledLength) { } + + // 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) { } + + + // Dialogs ------------------------------------------------------------- + + // 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( + bool multiSelect, const WebString& title, + const WebString& initialValue, 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&) { } + + // Called when a tooltip should be shown at the current cursor position. + virtual void setToolTipText(const WebString&, WebTextDirection hint) { } + + // 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 WebPoint& from, const WebDragData&, WebDragOperationsMask) { } + + // 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() { } + + + // 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 that the focus has changed to the given + // accessibility object. + virtual void focusAccessibilityObject(const WebAccessibilityObject&) { } + + + // Developer tools ----------------------------------------------------- + + // Called to notify the client that the inspector's settings were + // changed and should be saved. See WebView::inspectorSettings. + virtual void didUpdateInspectorSettings() { } + + + // Autofill ------------------------------------------------------------ + + // Queries the browser for suggestions to be shown for the form text + // field named |name|. |value| is the text entered by the user so + // far and the WebNode corresponds to the input field. + virtual void queryAutofillSuggestions(const WebNode&, + const WebString& name, + const WebString& value) { } + + // Instructs the browser to remove the autofill entry specified from + // its DB. + virtual void removeAutofillSuggestions(const WebString& name, + const WebString& value) { } + +protected: + ~WebViewClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebWidget.h b/WebKit/chromium/public/WebWidget.h new file mode 100644 index 0000000..9dfeefc --- /dev/null +++ b/WebKit/chromium/public/WebWidget.h @@ -0,0 +1,99 @@ +/* + * 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 "WebCanvas.h" +#include "WebCommon.h" +#include "WebCompositionCommand.h" +#include "WebTextDirection.h" + +namespace WebKit { + +class WebInputEvent; +class WebString; +struct WebRect; +struct WebSize; + +class WebWidget { +public: + // This method closes and deletes the WebWidget. + virtual void close() = 0; + + // Returns the current size of the WebWidget. + virtual WebSize size() = 0; + + // Called to resize the WebWidget. + virtual void resize(const WebSize&) = 0; + + // Called to layout the WebWidget. This MUST be called before Paint, + // and it may result in calls to WebWidgetClient::didInvalidateRect. + virtual void layout() = 0; + + // Called to paint the specified region of the WebWidget onto the given + // canvas. 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&) = 0; + + // Called to inform the WebWidget of an input event. Returns true if + // the event has been processed, false otherwise. + virtual bool handleInputEvent(const WebInputEvent&) = 0; + + // Called to inform the WebWidget that mouse capture was lost. + virtual void mouseCaptureLost() = 0; + + // Called to inform the WebWidget that it has gained or lost keyboard focus. + virtual void setFocus(bool) = 0; + + // Called to inform the WebWidget of a composition event. + virtual bool handleCompositionEvent(WebCompositionCommand command, + int cursorPosition, + int targetStart, + int targetEnd, + const WebString& text) = 0; + + // Retrieve the status of this WebWidget required by IME APIs. Upon + // success enabled and caretBounds are set. + virtual bool queryCompositionStatus(bool* enabled, WebRect* caretBounds) = 0; + + // Changes the text direction of the selected input node. + virtual void setTextDirection(WebTextDirection) = 0; + +protected: + ~WebWidget() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebWidgetClient.h b/WebKit/chromium/public/WebWidgetClient.h new file mode 100644 index 0000000..06d9eba --- /dev/null +++ b/WebKit/chromium/public/WebWidgetClient.h @@ -0,0 +1,92 @@ +/* + * 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 "WebCommon.h" +#include "WebNavigationPolicy.h" +#include "WebRect.h" +#include "WebScreenInfo.h" + +namespace WebKit { + +class WebWidget; +struct WebCursorInfo; + +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 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 get/set the position of the widget in screen coordinates. + virtual WebRect windowRect() { return WebRect(); } + virtual void setWindowRect(const WebRect&) { } + + // 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(); } + +protected: + ~WebWidgetClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/WebWorker.h b/WebKit/chromium/public/WebWorker.h new file mode 100644 index 0000000..9397bcd --- /dev/null +++ b/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_API 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/WebKit/chromium/public/WebWorkerClient.h b/WebKit/chromium/public/WebWorkerClient.h new file mode 100644 index 0000000..eb2e63e --- /dev/null +++ b/WebKit/chromium/public/WebWorkerClient.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 WebWorkerClient_h +#define WebWorkerClient_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 WebWorkerClient : public WebCommonWorkerClient { +public: + virtual void postMessageToWorkerObject( + const WebString&, + const WebMessagePortChannelArray&) = 0; + + virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0; + virtual void reportPendingActivity(bool hasPendingActivity) = 0; + +protected: + ~WebWorkerClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/gtk/WebFontInfo.h b/WebKit/chromium/public/gtk/WebFontInfo.h new file mode 100644 index 0000000..ad37680 --- /dev/null +++ b/WebKit/chromium/public/gtk/WebFontInfo.h @@ -0,0 +1,55 @@ +/* + * 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 "../WebCString.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| + // + // Returns: the font family or an empty string if the request could not be + // satisfied. + WEBKIT_API static WebCString familyForChars(const WebUChar* characters, size_t numCharacters); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/gtk/WebInputEventFactory.h b/WebKit/chromium/public/gtk/WebInputEventFactory.h new file mode 100644 index 0000000..463bd28 --- /dev/null +++ b/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 "../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_API static WebKeyboardEvent keyboardEvent(const GdkEventKey*); + WEBKIT_API static WebKeyboardEvent keyboardEvent(wchar_t character, int state, double timeStampSeconds); + WEBKIT_API static WebMouseEvent mouseEvent(const GdkEventButton*); + WEBKIT_API static WebMouseEvent mouseEvent(const GdkEventMotion*); + WEBKIT_API static WebMouseEvent mouseEvent(const GdkEventCrossing*); + WEBKIT_API static WebMouseWheelEvent mouseWheelEvent(const GdkEventScroll*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/gtk/WebScreenInfoFactory.h b/WebKit/chromium/public/gtk/WebScreenInfoFactory.h new file mode 100644 index 0000000..c964741 --- /dev/null +++ b/WebKit/chromium/public/gtk/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 "../WebCommon.h" + +typedef struct _GtkWidget GtkWidget; + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_API static WebScreenInfo screenInfo(GtkWidget*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/linux/WebFontRendering.h b/WebKit/chromium/public/linux/WebFontRendering.h new file mode 100644 index 0000000..9b61bdc --- /dev/null +++ b/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 "../WebCommon.h" +#include <SkFontHost.h> +#include <SkPaint.h> + +namespace WebKit { + +class WebFontRendering { +public: + // Set global font renderering preferences. + + WEBKIT_API static void setHinting(SkPaint::Hinting); + WEBKIT_API static void setAntiAlias(bool on); + WEBKIT_API static void setSubpixelGlyphs(bool on); + WEBKIT_API static void setLCDOrder(SkFontHost::LCDOrder); + WEBKIT_API static void setLCDOrientation(SkFontHost::LCDOrientation); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/linux/WebSandboxSupport.h b/WebKit/chromium/public/linux/WebSandboxSupport.h new file mode 100644 index 0000000..5edceb2 --- /dev/null +++ b/WebKit/chromium/public/linux/WebSandboxSupport.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 WebSandboxSupport_h +#define WebSandboxSupport_h + +#include "../WebCommon.h" +#include "../WebString.h" + +namespace WebKit { + +// 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| + // + // Returns a string with the font family on an empty string if the + // request cannot be satisfied. + virtual WebString getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/mac/WebInputEventFactory.h b/WebKit/chromium/public/mac/WebInputEventFactory.h new file mode 100644 index 0000000..cbf213c --- /dev/null +++ b/WebKit/chromium/public/mac/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 "../WebCommon.h" + +#ifdef __OBJC__ +@class NSEvent; +@class NSView; +#else +class NSEvent; +class NSView; +#endif + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebMouseWheelEvent; + +class WebInputEventFactory { +public: + WEBKIT_API static WebKeyboardEvent keyboardEvent(NSEvent*); + WEBKIT_API static WebKeyboardEvent keyboardEvent(wchar_t character, int modifiers, double timeStampSeconds); + WEBKIT_API static WebMouseEvent mouseEvent(NSEvent*, NSView*); + WEBKIT_API static WebMouseWheelEvent mouseWheelEvent(NSEvent*, NSView*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/mac/WebScreenInfoFactory.h b/WebKit/chromium/public/mac/WebScreenInfoFactory.h new file mode 100644 index 0000000..485e77f --- /dev/null +++ b/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 "../WebCommon.h" + +#ifdef __OBJC__ +@class NSView; +#else +class NSView; +#endif + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_API static WebScreenInfo screenInfo(NSView*); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/win/WebInputEventFactory.h b/WebKit/chromium/public/win/WebInputEventFactory.h new file mode 100644 index 0000000..ae02464 --- /dev/null +++ b/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 "../WebCommon.h" + +#include <windows.h> + +namespace WebKit { + +class WebKeyboardEvent; +class WebMouseEvent; +class WebMouseWheelEvent; + +class WebInputEventFactory { +public: + WEBKIT_API static WebKeyboardEvent keyboardEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_API static WebMouseEvent mouseEvent(HWND, UINT, WPARAM, LPARAM); + WEBKIT_API 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_API static void resetLastClickState(); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/win/WebSandboxSupport.h b/WebKit/chromium/public/win/WebSandboxSupport.h new file mode 100644 index 0000000..88d5362 --- /dev/null +++ b/WebKit/chromium/public/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/WebKit/chromium/public/win/WebScreenInfoFactory.h b/WebKit/chromium/public/win/WebScreenInfoFactory.h new file mode 100644 index 0000000..a7040ea --- /dev/null +++ b/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 "../WebCommon.h" + +typedef struct HWND__* HWND; + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_API static WebScreenInfo screenInfo(HWND); +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/win/WebThemeEngine.h b/WebKit/chromium/public/win/WebThemeEngine.h new file mode 100644 index 0000000..b563608 --- /dev/null +++ b/WebKit/chromium/public/win/WebThemeEngine.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 WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" + +namespace WebKit { + +struct WebRect; + +// 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>. +class WebThemeEngine { +public: + 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 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; +}; + +} // namespace WebKit + +#endif diff --git a/WebKit/chromium/public/x11/WebScreenInfoFactory.h b/WebKit/chromium/public/x11/WebScreenInfoFactory.h new file mode 100644 index 0000000..5e30da8 --- /dev/null +++ b/WebKit/chromium/public/x11/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 "../WebCommon.h" + +typedef struct _XDisplay Display; + +namespace WebKit { + +struct WebScreenInfo; + +class WebScreenInfoFactory { +public: + WEBKIT_API static WebScreenInfo screenInfo(Display*, int screenNumber); +}; + +} // namespace WebKit + +#endif |