diff options
| author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-06 14:44:00 +0100 |
| commit | 40736c5763bf61337c8c14e16d8587db021a87d4 (patch) | |
| tree | b17a9c00042ad89cb1308e2484491799aa14e9f8 /Source/WebKit/chromium/public/platform | |
| download | qtwebkit-40736c5763bf61337c8c14e16d8587db021a87d4.tar.gz | |
Imported WebKit commit 2ea9d364d0f6efa8fa64acf19f451504c59be0e4 (http://svn.webkit.org/repository/webkit/trunk@104285)
Diffstat (limited to 'Source/WebKit/chromium/public/platform')
69 files changed, 6421 insertions, 0 deletions
diff --git a/Source/WebKit/chromium/public/platform/WebArrayBufferView.h b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h new file mode 100644 index 000000000..8f2356930 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebArrayBufferView.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebArrayBufferView_h +#define WebArrayBufferView_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WTF { class ArrayBufferView; } + +namespace WebKit { + +// Provides access to an ArrayBufferView. +class WebArrayBufferView { +public: + ~WebArrayBufferView() { reset(); } + WebArrayBufferView() { } + WebArrayBufferView(const WebArrayBufferView& v) { assign(v); } + + WEBKIT_EXPORT void* baseAddress() const; + WEBKIT_EXPORT unsigned byteOffset() const; + WEBKIT_EXPORT unsigned byteLength() const; + + WEBKIT_EXPORT void assign(const WebArrayBufferView&); + WEBKIT_EXPORT void reset(); + +#if WEBKIT_IMPLEMENTATION + WebArrayBufferView(const WTF::PassRefPtr<WTF::ArrayBufferView>&); + WebArrayBufferView& operator=(const WTF::PassRefPtr<WTF::ArrayBufferView>&); + operator WTF::PassRefPtr<WTF::ArrayBufferView>() const; +#endif + +private: + WebPrivatePtr<WTF::ArrayBufferView> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebAudioBus.h b/Source/WebKit/chromium/public/platform/WebAudioBus.h new file mode 100644 index 000000000..750ae79e2 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebAudioBus.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010, Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebAudioBus_h +#define WebAudioBus_h + +#include "WebCommon.h" + +namespace WebCore { class AudioBus; } + +#if WEBKIT_IMPLEMENTATION +namespace WTF { template <typename T> class PassOwnPtr; } +#endif + +namespace WebKit { + +class WebAudioBusPrivate; + +// A container for multi-channel linear PCM audio data. +// +// WARNING: It is not safe to pass a WebAudioBus across threads!!! +// +class WebAudioBus { +public: + WebAudioBus() : m_private(0) { } + ~WebAudioBus() { reset(); } + + // initialize() allocates memory of the given length for the given number of channels. + WEBKIT_EXPORT void initialize(unsigned numberOfChannels, size_t length, double sampleRate); + + // reset() releases the memory allocated from initialize(). + WEBKIT_EXPORT void reset(); + + WEBKIT_EXPORT unsigned numberOfChannels() const; + WEBKIT_EXPORT size_t length() const; + WEBKIT_EXPORT double sampleRate() const; + + WEBKIT_EXPORT float* channelData(unsigned channelIndex); + +#if WEBKIT_IMPLEMENTATION + WTF::PassOwnPtr<WebCore::AudioBus> release(); +#endif + +private: + // Disallow copy and assign. + WebAudioBus(const WebAudioBus&); + void operator=(const WebAudioBus&); + + WebCore::AudioBus* m_private; +}; + +} // namespace WebKit + +#endif // WebAudioBus_h diff --git a/Source/WebKit/chromium/public/platform/WebAudioDevice.h b/Source/WebKit/chromium/public/platform/WebAudioDevice.h new file mode 100644 index 000000000..00aea975f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebAudioDevice.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebAudioDevice_h +#define WebAudioDevice_h + +#include "WebVector.h" + +namespace WebKit { + +// Abstract interface to the Chromium audio system. + +class WebAudioDevice { +public: + class RenderCallback { + public: + virtual void render(const WebVector<float*>& audioData, size_t numberOfFrames) = 0; + protected: + virtual ~RenderCallback() { } + }; + + virtual ~WebAudioDevice() { } + + virtual void start() = 0; + virtual void stop() = 0; + virtual double sampleRate() = 0; +}; + +} // namespace WebKit + +#endif // WebAudioDevice_h diff --git a/Source/WebKit/chromium/public/platform/WebBlobData.h b/Source/WebKit/chromium/public/platform/WebBlobData.h new file mode 100644 index 000000000..7fa32d3b6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebBlobData.h @@ -0,0 +1,94 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebBlobData_h +#define WebBlobData_h + +#include "WebString.h" +#include "WebThreadSafeData.h" +#include "WebURL.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class BlobData; } +namespace WTF { template <typename T> class PassOwnPtr; } +#endif + +namespace WebKit { + +class WebBlobDataPrivate; + +class WebBlobData { +public: + struct Item { + enum { TypeData, TypeFile, TypeBlob } type; + WebThreadSafeData data; + WebString filePath; + WebURL blobURL; + long long offset; + long long length; // -1 means go to the end of the file/blob. + double expectedModificationTime; // 0.0 means that the time is not set. + }; + + ~WebBlobData() { reset(); } + + WebBlobData() : m_private(0) { } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + + bool isNull() const { return !m_private; } + + // Returns the number of items. + WEBKIT_EXPORT size_t itemCount() const; + + // Retrieves the values of the item at the given index. Returns false if + // index is out of bounds. + WEBKIT_EXPORT bool itemAt(size_t index, Item& result) const; + + WEBKIT_EXPORT WebString contentType() const; + + WEBKIT_EXPORT WebString contentDisposition() const; + +#if WEBKIT_IMPLEMENTATION + WebBlobData(const WTF::PassOwnPtr<WebCore::BlobData>&); + WebBlobData& operator=(const WTF::PassOwnPtr<WebCore::BlobData>&); + operator WTF::PassOwnPtr<WebCore::BlobData>(); +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(const WTF::PassOwnPtr<WebCore::BlobData>&); +#endif + WebBlobDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif // WebBlobData_h diff --git a/Source/WebKit/chromium/public/platform/WebBlobRegistry.h b/Source/WebKit/chromium/public/platform/WebBlobRegistry.h new file mode 100644 index 000000000..d882abad9 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebBlobRegistry.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebBlobRegistry_h +#define WebBlobRegistry_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebBlobData; +class WebURL; + +class WebBlobRegistry { +public: + WEBKIT_EXPORT static WebBlobRegistry* create(); + + virtual ~WebBlobRegistry() { } + + // Registers a blob URL referring to the specified blob data. + virtual void registerBlobURL(const WebURL&, WebBlobData&) = 0; + + // Registers a blob URL referring to the blob data identified by the specified srcURL. + virtual void registerBlobURL(const WebURL&, const WebURL& srcURL) = 0; + + virtual void unregisterBlobURL(const WebURL&) = 0; +}; + +} // namespace WebKit + +#endif // WebBlobRegistry_h diff --git a/Source/WebKit/chromium/public/platform/WebCString.h b/Source/WebKit/chromium/public/platform/WebCString.h new file mode 100644 index 000000000..7a4486db3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCString.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "../../../../Platform/chromium/public/WebCString.h" + diff --git a/Source/WebKit/chromium/public/platform/WebCanvas.h b/Source/WebKit/chromium/public/platform/WebCanvas.h new file mode 100644 index 000000000..4cf729ee1 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCanvas.h @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCanvas_h +#define WebCanvas_h + +#include "WebCommon.h" + +#if WEBKIT_USING_SKIA +class SkCanvas; +#elif WEBKIT_USING_CG +struct CGContext; +#endif + +namespace WebKit { + +#if WEBKIT_USING_SKIA +typedef SkCanvas WebCanvas; +#elif WEBKIT_USING_CG +typedef struct CGContext WebCanvas; +#else +#error "Need to define WebCanvas" +#endif + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebClipboard.h b/Source/WebKit/chromium/public/platform/WebClipboard.h new file mode 100644 index 000000000..503213952 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebClipboard.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebClipboard_h +#define WebClipboard_h + +#include "WebCommon.h" +#include "WebData.h" +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +class WebDragData; +class WebImage; +class WebURL; + +class WebClipboard { +public: + enum Format { + FormatPlainText, + FormatHTML, + FormatBookmark, + FormatSmartPaste + }; + + enum Buffer { + BufferStandard, + // Used on platforms like the X Window System that treat selection + // as a type of clipboard. + BufferSelection, + }; + + // Returns an identifier which can be used to determine whether the data + // contained within the clipboard has changed. + virtual uint64 sequenceNumber(Buffer) { return 0; } + + virtual bool isFormatAvailable(Format, Buffer) { return false; } + + virtual WebVector<WebString> readAvailableTypes( + Buffer, bool* containsFilenames) { return WebVector<WebString>(); } + virtual WebString readPlainText(Buffer) { return WebString(); } + // fragmentStart and fragmentEnd are indexes into the returned markup that + // indicate the start and end of the fragment if the returned markup + // contains additional context. If there is no additional context, + // fragmentStart will be zero and fragmentEnd will be the same as the length + // of the returned markup. + virtual WebString readHTML( + Buffer buffer, WebURL* pageURL, unsigned* fragmentStart, + unsigned* fragmentEnd) { return WebString(); } + virtual WebData readImage(Buffer) { return WebData(); } + virtual WebString readCustomData( + Buffer, const WebString& type) { return WebString(); } + + virtual void writePlainText(const WebString&) { } + virtual void writeHTML( + const WebString& htmlText, const WebURL&, + const WebString& plainText, bool writeSmartPaste) { } + virtual void writeURL( + const WebURL&, const WebString& title) { } + virtual void writeImage( + const WebImage&, const WebURL&, const WebString& title) { } + virtual void writeDataObject(const WebDragData&) { } + +protected: + ~WebClipboard() {} +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebColor.h b/Source/WebKit/chromium/public/platform/WebColor.h new file mode 100644 index 000000000..da45eb1c6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebColor.h @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebColor_h +#define WebColor_h + +#include "WebColorName.h" +#include "WebCommon.h" + +namespace WebKit { + +typedef unsigned WebColor; // RGBA quad. Equivalent to SkColor. + +// Sets the values of a set of named colors. +WEBKIT_EXPORT void setNamedColors(const WebColorName*, const WebColor*, size_t length); + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebColorName.h b/Source/WebKit/chromium/public/platform/WebColorName.h new file mode 100644 index 000000000..f97ed265f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebColorName.h @@ -0,0 +1,71 @@ +/* +* Copyright (C) 2009 Google Inc. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions are +* met: +* +* * Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* * Redistributions in binary form must reproduce the above +* copyright notice, this list of conditions and the following disclaimer +* in the documentation and/or other materials provided with the +* distribution. +* * Neither the name of Google Inc. nor the names of its +* contributors may be used to endorse or promote products derived from +* this software without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +#ifndef WebColorName_h +#define WebColorName_h + +namespace WebKit { + +enum WebColorName { + WebColorActiveBorder, + WebColorActiveCaption, + WebColorAppworkspace, + WebColorBackground, + WebColorButtonFace, + WebColorButtonHighlight, + WebColorButtonShadow, + WebColorButtonText, + WebColorCaptionText, + WebColorGrayText, + WebColorHighlight, + WebColorHighlightText, + WebColorInactiveBorder, + WebColorInactiveCaption, + WebColorInactiveCaptionText, + WebColorInfoBackground, + WebColorInfoText, + WebColorMenu, + WebColorMenuText, + WebColorScrollbar, + WebColorText, + WebColorThreedDarkShadow, + WebColorThreedShadow, + WebColorThreedFace, + WebColorThreedHighlight, + WebColorThreedLightShadow, + WebColorWebkitFocusRingColor, + WebColorWindow, + WebColorWindowFrame, + WebColorWindowText +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebCommon.h b/Source/WebKit/chromium/public/platform/WebCommon.h new file mode 100644 index 000000000..39b40eb7f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCommon.h @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "../../../../Platform/chromium/public/WebCommon.h" diff --git a/Source/WebKit/chromium/public/platform/WebContentLayer.h b/Source/WebKit/chromium/public/platform/WebContentLayer.h new file mode 100644 index 000000000..6d7f91483 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebContentLayer.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebContentLayer_h +#define WebContentLayer_h + +#include "WebCommon.h" +#include "WebLayer.h" + +namespace WebKit { +class WebContentLayerClient; +class WebContentLayerImpl; +struct WebFloatRect; + +class WebContentLayer : public WebLayer { +public: + WEBKIT_EXPORT static WebContentLayer create(WebContentLayerClient*); + + WebContentLayer() { } + WebContentLayer(const WebContentLayer& layer) : WebLayer(layer) { } + virtual ~WebContentLayer() { } + WebContentLayer& operator=(const WebContentLayer& layer) + { + WebLayer::assign(layer); + return *this; + } + + // Sets whether the layer draws its content when compositing. + WEBKIT_EXPORT void setDrawsContent(bool); + WEBKIT_EXPORT bool drawsContent() const; + + // Sets a region of the layer as invalid, i.e. needs to update its content. + // The visible area of the dirty rect will be passed to one or more calls to + // WebContentLayerClient::paintContents before the compositing pass occurs. + WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); + + // Sets the entire layer as invalid, i.e. needs to update its content. + WEBKIT_EXPORT void invalidate(); + +#if WEBKIT_IMPLEMENTATION + WebContentLayer(const WTF::PassRefPtr<WebContentLayerImpl>&); + WebContentLayer& operator=(const WTF::PassRefPtr<WebContentLayerImpl>&); + operator WTF::PassRefPtr<WebContentLayerImpl>() const; +#endif +}; + +} // namespace WebKit + +#endif // WebContentLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebContentLayerClient.h b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h new file mode 100644 index 000000000..deb36e077 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebContentLayerClient.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebContentLayerClient_h +#define WebContentLayerClient_h + +#include "WebCanvas.h" + +namespace WebKit { +struct WebRect; + +class WebContentLayerClient { +public: + // Paints the content area for the layer, typically dirty rects submitted + // through WebContentLayer::setNeedsDisplay, submitting drawing commands + // through the WebCanvas. + // The canvas is already clipped to the |clip| rect. + virtual void paintContents(WebCanvas*, const WebRect& clip) = 0; + +protected: + virtual ~WebContentLayerClient() { } +}; + +} // namespace WebKit + +#endif // WebContentLayerClient_h diff --git a/Source/WebKit/chromium/public/platform/WebCookie.h b/Source/WebKit/chromium/public/platform/WebCookie.h new file mode 100644 index 000000000..318b0e3e3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCookie.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCookie_h +#define WebCookie_h + +#include "WebCommon.h" +#include "WebString.h" + +namespace WebKit { + +// A cookie. +// +struct WebCookie { + WebCookie() + : expires(0) + , httpOnly(false) + , secure(false) + , session(false) + { + } + + WebCookie(const WebString& name, const WebString& value, const WebString& domain, + const WebString& path, double expires, bool httpOnly, bool secure, bool session) + : name(name) + , value(value) + , domain(domain) + , path(path) + , expires(expires) + , httpOnly(httpOnly) + , secure(secure) + , session(session) + { + } + + WebString name; + WebString value; + WebString domain; + WebString path; + double expires; + bool httpOnly; + bool secure; + bool session; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebCookieJar.h b/Source/WebKit/chromium/public/platform/WebCookieJar.h new file mode 100644 index 000000000..6daba6bc4 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebCookieJar.h @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebCookieJar_h +#define WebCookieJar_h + +#include "WebString.h" + +namespace WebKit { +class WebURL; +struct WebCookie; +template <typename T> class WebVector; + +class WebCookieJar { +public: + virtual void setCookie(const WebURL&, const WebURL& firstPartyForCookies, const WebString& cookie) { } + virtual WebString cookies(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual WebString cookieRequestHeaderFieldValue(const WebURL&, const WebURL& firstPartyForCookies) { return WebString(); } + virtual void rawCookies(const WebURL&, const WebURL& firstPartyForCookies, WebVector<WebCookie>&) { } + virtual void deleteCookie(const WebURL&, const WebString& cookieName) { } + virtual bool cookiesEnabled(const WebURL&, const WebURL& firstPartyForCookies) { return true; } + +protected: + ~WebCookieJar() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebData.h b/Source/WebKit/chromium/public/platform/WebData.h new file mode 100644 index 000000000..17d3f388c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebData.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebData_h +#define WebData_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class SharedBuffer; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebDataPrivate; + +// A container for raw bytes. It is inexpensive to copy a WebData object. +// +// WARNING: It is not safe to pass a WebData across threads!!! +// +class WebData { +public: + ~WebData() { reset(); } + + WebData() : m_private(0) { } + + WebData(const char* data, size_t size) : m_private(0) + { + assign(data, size); + } + + template <int N> + WebData(const char (&data)[N]) : m_private(0) + { + assign(data, N - 1); + } + + WebData(const WebData& d) : m_private(0) { assign(d); } + + WebData& operator=(const WebData& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebData&); + WEBKIT_EXPORT void assign(const char* data, size_t size); + + WEBKIT_EXPORT size_t size() const; + WEBKIT_EXPORT const char* data() const; + + bool isEmpty() const { return !size(); } + bool isNull() const { return !m_private; } + +#if WEBKIT_IMPLEMENTATION + WebData(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + WebData& operator=(const WTF::PassRefPtr<WebCore::SharedBuffer>&); + operator WTF::PassRefPtr<WebCore::SharedBuffer>() const; +#else + template <class C> + WebData(const C& c) : m_private(0) + { + assign(c.data(), c.size()); + } + + template <class C> + WebData& operator=(const C& c) + { + assign(c.data(), c.size()); + return *this; + } +#endif + +private: + void assign(WebDataPrivate*); + WebDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebDragData.h b/Source/WebKit/chromium/public/platform/WebDragData.h new file mode 100644 index 000000000..171231eca --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebDragData.h @@ -0,0 +1,122 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebDragData_h +#define WebDragData_h + +#include "WebCommon.h" +#include "WebString.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class ChromiumDataObject; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebData; +class WebDragDataPrivate; +class WebURL; +template <typename T> class WebVector; + +// Holds data that may be exchanged through a drag-n-drop operation. It is +// inexpensive to copy a WebDragData object. +class WebDragData { +public: + ~WebDragData() { reset(); } + + WebDragData() : m_private(0) { } + WebDragData(const WebDragData& d) : m_private(0) { assign(d); } + WebDragData& operator=(const WebDragData& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebDragData&); + + bool isNull() const { return !m_private; } + + WEBKIT_EXPORT WebString url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + WEBKIT_EXPORT WebString urlTitle() const; + WEBKIT_EXPORT void setURLTitle(const WebString&); + + WEBKIT_EXPORT WebString downloadMetadata() const; + WEBKIT_EXPORT void setDownloadMetadata(const WebString&); + + WEBKIT_EXPORT WebString fileExtension() const; + WEBKIT_EXPORT void setFileExtension(const WebString&); + + WEBKIT_EXPORT bool containsFilenames() const; + WEBKIT_EXPORT void filenames(WebVector<WebString>&) const; + WEBKIT_EXPORT void setFilenames(const WebVector<WebString>&); + WEBKIT_EXPORT void appendToFilenames(const WebString&); + + WEBKIT_EXPORT WebString plainText() const; + WEBKIT_EXPORT void setPlainText(const WebString&); + + WEBKIT_EXPORT WebString htmlText() const; + WEBKIT_EXPORT void setHTMLText(const WebString&); + + WEBKIT_EXPORT WebURL htmlBaseURL() const; + WEBKIT_EXPORT void setHTMLBaseURL(const WebURL&); + + WEBKIT_EXPORT WebString fileContentFilename() const; + WEBKIT_EXPORT void setFileContentFilename(const WebString&); + + WEBKIT_EXPORT WebData fileContent() const; + WEBKIT_EXPORT void setFileContent(const WebData&); + + struct CustomData { + WebString type; + WebString data; + }; + WEBKIT_EXPORT WebVector<CustomData> customData() const; + WEBKIT_EXPORT void setCustomData(const WebVector<CustomData>&); + +#if WEBKIT_IMPLEMENTATION + WebDragData(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + WebDragData& operator=(const WTF::PassRefPtr<WebCore::ChromiumDataObject>&); + operator WTF::PassRefPtr<WebCore::ChromiumDataObject>() const; +#endif + +private: + void assign(WebDragDataPrivate*); + void ensureMutable(); + WebDragDataPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h new file mode 100644 index 000000000..ce87bb238 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebExternalTextureLayer.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebExternalTextureLayer_h +#define WebExternalTextureLayer_h + +#include "WebCommon.h" +#include "WebFloatRect.h" +#include "WebLayer.h" + +namespace WebKit { +class WebExternalTextureLayerImpl; + +// This class represents a layer that renders a texture that is generated +// externally (not managed by the WebLayerTreeView). +// The texture will be used by the WebLayerTreeView during compositing passes. +// When in single-thread mode, this means during WebLayerTreeView::composite(). +// When using the threaded compositor, this can mean at an arbitrary time until +// the WebLayerTreeView is destroyed. +class WebExternalTextureLayer : public WebLayer { +public: + WEBKIT_EXPORT static WebExternalTextureLayer create(); + + WebExternalTextureLayer() { } + WebExternalTextureLayer(const WebExternalTextureLayer& layer) : WebLayer(layer) { } + virtual ~WebExternalTextureLayer() { } + WebExternalTextureLayer& operator=(const WebExternalTextureLayer& layer) + { + WebLayer::assign(layer); + return *this; + } + + // Sets the texture id that represents the layer, in the namespace of the + // compositor context. + WEBKIT_EXPORT void setTextureId(unsigned); + WEBKIT_EXPORT unsigned textureId() const; + + // Sets whether or not the texture should be flipped in the Y direction when + // rendered. + WEBKIT_EXPORT void setFlipped(bool); + WEBKIT_EXPORT bool flipped() const; + + // Sets the rect in UV space of the texture that is mapped to the layer + // bounds. + WEBKIT_EXPORT void setUVRect(const WebFloatRect&); + WEBKIT_EXPORT WebFloatRect uvRect() const; + + // Marks a region of the layer as needing a display. These regions are + // collected in a union until the display occurs. + WEBKIT_EXPORT void invalidateRect(const WebFloatRect&); + +#if WEBKIT_IMPLEMENTATION + WebExternalTextureLayer(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); + WebExternalTextureLayer& operator=(const WTF::PassRefPtr<WebExternalTextureLayerImpl>&); + operator WTF::PassRefPtr<WebExternalTextureLayerImpl>() const; +#endif +}; + +} // namespace WebKit + +#endif // WebExternalTextureLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebFileSystem.h b/Source/WebKit/chromium/public/platform/WebFileSystem.h new file mode 100644 index 000000000..583efe07c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFileSystem.h @@ -0,0 +1,123 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFileSystem_h +#define WebFileSystem_h + +#include "WebCommon.h" +#include "WebURL.h" + +namespace WebKit { + +// FIXME: Move these classes into platform. +class WebFileSystemCallbacks; +class WebFileWriter; +class WebFileWriterClient; + +class WebFileSystem { +public: + enum Type { + TypeTemporary, + TypePersistent, + TypeExternal, + }; + + // Moves a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void move(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Copies a file or directory at |srcPath| to |destPath|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void copy(const WebURL& srcPath, const WebURL& destPath, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Deletes a file or directory at a given |path|. + // It is an error to try to remove a directory that is not empty. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void remove(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Deletes a file or directory recursively at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void removeRecursively(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Retrieves the metadata information of the file or directory at the given |path|. + // WebFileSystemCallbacks::didReadMetadata() must be called with a valid metadata when the retrieval is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readMetadata(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a file at given |path|. + // If the |path| doesn't exist, it creates a new file at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or + // it has successfully created a new file at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createFile(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a directory at a given |path|. + // If the |path| doesn't exist, it creates a new directory at |path|. + // If |exclusive| is true, it fails if the |path| already exists. + // If |exclusive| is false, it succeeds if the |path| already exists or it has successfully created a new directory at |path|. + // + // WebFileSystemCallbacks::didSucceed() must be called when + // the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void createDirectory(const WebURL& path, bool exclusive, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a file exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void fileExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Checks if a directory exists at a given |path|. + // WebFileSystemCallbacks::didSucceed() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void directoryExists(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Reads directory entries of a given directory at |path|. + // WebFileSystemCallbacks::didReadDirectory() must be called when the operation is completed successfully. + // WebFileSystemCallbacks::didFail() must be called otherwise. + virtual void readDirectory(const WebURL& path, WebFileSystemCallbacks*) { WEBKIT_ASSERT_NOT_REACHED(); } + + // Creates a WebFileWriter that can be used to write to the given file. + // This is a fast, synchronous call, and should not stat the filesystem. + virtual WebFileWriter* createFileWriter(const WebURL& path, WebFileWriterClient*) { WEBKIT_ASSERT_NOT_REACHED(); return 0; } + +protected: + virtual ~WebFileSystem() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatPoint.h b/Source/WebKit/chromium/public/platform/WebFloatPoint.h new file mode 100644 index 000000000..4afc16b9c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatPoint.h @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatPoint_h +#define WebFloatPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatPoint.h" +#endif + +namespace WebKit { + +struct WebFloatPoint { + float x; + float y; + + WebFloatPoint() + : x(0.0f) + , y(0.0f) + { + } + + WebFloatPoint(float x, float y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatPoint(const WebCore::FloatPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebFloatPoint& operator=(const WebCore::FloatPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::FloatPoint() const + { + return WebCore::FloatPoint(x, y); + } +#endif +}; + +inline bool operator==(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebFloatPoint& a, const WebFloatPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatQuad.h b/Source/WebKit/chromium/public/platform/WebFloatQuad.h new file mode 100644 index 000000000..da5eb0542 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatQuad.h @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatQuad_h +#define WebFloatQuad_h + +#include "WebCommon.h" +#include "WebFloatPoint.h" +#include "WebRect.h" + +#include <algorithm> +#include <cmath> + +#if WEBKIT_IMPLEMENTATION +#include "FloatQuad.h" +#endif + +namespace WebKit { + +struct WebFloatQuad { + WebFloatPoint p[4]; + + WebFloatQuad() + { + } + + WebFloatQuad(const WebFloatPoint& p0, const WebFloatPoint& p1, const WebFloatPoint& p2, const WebFloatPoint& p3) + { + p[0] = p0; + p[1] = p1; + p[2] = p2; + p[3] = p3; + } + + WEBKIT_EXPORT WebRect enclosingRect() const; + +#if WEBKIT_IMPLEMENTATION + WebFloatQuad& operator=(const WebCore::FloatQuad& q) + { + p[0] = q.p1(); + p[1] = q.p2(); + p[2] = q.p3(); + p[3] = q.p4(); + return *this; + } + WebFloatQuad(const WebCore::FloatQuad& q) + { + *this = q; + } +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebFloatRect.h b/Source/WebKit/chromium/public/platform/WebFloatRect.h new file mode 100644 index 000000000..a883513fc --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebFloatRect.h @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFloatRect_h +#define WebFloatRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "FloatRect.h" +#endif + +namespace WebKit { + +struct WebFloatRect { + float x; + float y; + float width; + float height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebFloatRect() + : x(0.0f) + , y(0.0f) + , width(0.0f) + , height(0.0f) + { + } + + WebFloatRect(float x, float y, float width, float height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebFloatRect(const WebCore::FloatRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebFloatRect& operator=(const WebCore::FloatRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::FloatRect() const + { + return WebCore::FloatRect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebFloatRect& a, const WebFloatRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebFloatRect& a, const WebFloatRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebGamepad.h b/Source/WebKit/chromium/public/platform/WebGamepad.h new file mode 100644 index 000000000..71d37b3ba --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGamepad.h @@ -0,0 +1,74 @@ +// Copyright (C) 2011, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. + +#ifndef WebGamepad_h +#define WebGamepad_h + +#include "WebCommon.h" + +namespace WebKit { + +// This structure is intentionally POD and fixed size so that it can be shared +// memory between hardware polling threads and the rest of the browser. See +// also WebGamepads.h. +class WebGamepad { +public: + static const size_t idLengthCap = 128; + static const size_t axesLengthCap = 16; + static const size_t buttonsLengthCap = 32; + + WebGamepad() + : connected(false) + , timestamp(0) + , axesLength(0) + , buttonsLength(0) + { + id[0] = 0; + } + + // Is there a gamepad connected at this index? + bool connected; + + // Device identifier (based on manufacturer, model, etc.). + WebUChar id[idLengthCap]; + + // Monotonically increasing value referring to when the data were last + // updated. + unsigned long long timestamp; + + // Number of valid entries in the axes array. + unsigned axesLength; + + // Normalized values representing axes, in the range [-1..1]. + float axes[axesLengthCap]; + + // Number of valid entries in the buttons array. + unsigned buttonsLength; + + // Normalized values representing buttons, in the range [0..1]. + float buttons[buttonsLengthCap]; +}; + +} + +#endif // WebGamepad_h diff --git a/Source/WebKit/chromium/public/platform/WebGamepads.h b/Source/WebKit/chromium/public/platform/WebGamepads.h new file mode 100644 index 000000000..b1cc18ef8 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGamepads.h @@ -0,0 +1,50 @@ +// Copyright (C) 2011, Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// 2. Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// +// THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND +// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +// ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE +// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +// DAMAGE. + +#ifndef WebGamepads_h +#define WebGamepads_h + +#include "WebGamepad.h" + +namespace WebKit { + +// This structure is intentionally POD and fixed size so that it can be stored +// in shared memory between hardware polling threads and the rest of the +// browser. +class WebGamepads { +public: + WebGamepads() + : length(0) { } + + static const size_t itemsLengthCap = 4; + + // Number of valid entries in the items array. + unsigned length; + + // Gamepad data for N separate gamepad devices. + WebGamepad items[itemsLengthCap]; +}; + +} + +#endif // WebGamepads_h diff --git a/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h new file mode 100644 index 000000000..3811436c2 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebGraphicsContext3D.h @@ -0,0 +1,404 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebGraphicsContext3D_h +#define WebGraphicsContext3D_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebString.h" + +#define USE_WGC3D_TYPES + +#if WEBKIT_USING_SKIA +struct GrGLInterface; +#endif + +namespace WebKit { + +// WGC3D types match the corresponding GL types as defined in OpenGL ES 2.0 +// header file gl2.h from khronos.org. +typedef char WGC3Dchar; +typedef unsigned int WGC3Denum; +typedef unsigned char WGC3Dboolean; +typedef unsigned int WGC3Dbitfield; +typedef signed char WGC3Dbyte; +typedef unsigned char WGC3Dubyte; +typedef short WGC3Dshort; +typedef unsigned short WGC3Dushort; +typedef int WGC3Dint; +typedef int WGC3Dsizei; +typedef unsigned int WGC3Duint; +typedef float WGC3Dfloat; +typedef float WGC3Dclampf; +typedef signed long int WGC3Dintptr; +typedef signed long int WGC3Dsizeiptr; + +// Typedef for server-side objects like OpenGL textures and program objects. +typedef WGC3Duint WebGLId; + +// FIXME: We shouldn't mention WebView in platform. +class WebView; + +// This interface abstracts the operations performed by the +// GraphicsContext3D in order to implement WebGL. Nearly all of the +// methods exposed on this interface map directly to entry points in +// the OpenGL ES 2.0 API. +// +// Creating a WebGraphicsContext does not make it current, or guarantee +// that the context has been created successfully. Use +// makeContextCurrent() to complete initialization of the context, treating +// a false return value as indication that the context could not be created +// successfully. +class WebGraphicsContext3D : public WebNonCopyable { +public: + // Return value from getActiveUniform and getActiveAttrib. + struct ActiveInfo { + WebString name; + WGC3Denum type; + WGC3Dint size; + }; + + // Context creation attributes. + struct Attributes { + Attributes() + : alpha(true) + , depth(true) + , stencil(true) + , antialias(true) + , premultipliedAlpha(true) + , canRecoverFromContextLoss(true) + , noExtensions(false) + , shareResources(true) + , forUseOnAnotherThread(false) + { + } + + bool alpha; + bool depth; + bool stencil; + bool antialias; + bool premultipliedAlpha; + bool canRecoverFromContextLoss; + bool noExtensions; + bool shareResources; + bool forUseOnAnotherThread; + }; + + class WebGraphicsContextLostCallback { + public: + virtual void onContextLost() = 0; + virtual ~WebGraphicsContextLostCallback() { } + }; + + class WebGraphicsSwapBuffersCompleteCallbackCHROMIUM { + public: + virtual void onSwapBuffersComplete() = 0; + virtual ~WebGraphicsSwapBuffersCompleteCallbackCHROMIUM() { } + }; + + // This destructor needs to be public so that using classes can destroy instances if initialization fails. + virtual ~WebGraphicsContext3D() {} + + // Initializes the graphics context; should be the first operation performed + // on newly-constructed instances. Returns true on success. + virtual bool initialize(Attributes, WebView*, bool renderDirectlyToWebView) = 0; + + // Makes the OpenGL context current on the current thread. Returns true on + // success. + virtual bool makeContextCurrent() = 0; + + // The size of the region into which this WebGraphicsContext3D is rendering. + // Returns the last values passed to reshape(). + virtual int width() = 0; + virtual int height() = 0; + + // Resizes the region into which this WebGraphicsContext3D is drawing. + virtual void reshape(int width, int height) = 0; + + // GL_CHROMIUM_setVisibility - Changes the visibility of the backbuffer + virtual void setVisibilityCHROMIUM(bool visible) = 0; + + // Query whether it is built on top of compliant GLES2 implementation. + virtual bool isGLES2Compliant() = 0; + + virtual bool setParentContext(WebGraphicsContext3D* parentContext) { return false; } + + // Helper for software compositing path. Reads back the frame buffer into + // the memory region pointed to by "pixels" with size "bufferSize". It is + // expected that the storage for "pixels" covers (4 * width * height) bytes. + // Returns true on success. + virtual bool readBackFramebuffer(unsigned char* pixels, size_t bufferSize, WebGLId framebuffer, int width, int height) = 0; + + // Returns the id of the texture which is used for storing the contents of + // the framebuffer associated with this context. This texture is accessible + // by the gpu-based page compositor. + virtual WebGLId getPlatformTextureId() = 0; + + // Copies the contents of the off-screen render target used by the WebGL + // context to the corresponding texture used by the compositor. + virtual void prepareTexture() = 0; + + // GL_CHROMIUM_post_sub_buffer - Copies part of the back buffer to the front buffer. + virtual void postSubBufferCHROMIUM(int x, int y, int width, int height) = 0; + + // Synthesizes an OpenGL error which will be returned from a + // later call to getError. This is used to emulate OpenGL ES + // 2.0 behavior on the desktop and to enforce additional error + // checking mandated by WebGL. + // + // Per the behavior of glGetError, this stores at most one + // instance of any given error, and returns them from calls to + // getError in the order they were added. + virtual void synthesizeGLError(WGC3Denum) = 0; + + virtual bool isContextLost() = 0; + + // GL_CHROMIUM_map_sub + virtual void* mapBufferSubDataCHROMIUM(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, WGC3Denum access) = 0; + virtual void unmapBufferSubDataCHROMIUM(const void*) = 0; + virtual void* mapTexSubImage2DCHROMIUM(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, WGC3Denum access) = 0; + virtual void unmapTexSubImage2DCHROMIUM(const void*) = 0; + + // GL_CHROMIUM_request_extension + virtual WebString getRequestableExtensionsCHROMIUM() = 0; + virtual void requestExtensionCHROMIUM(const char*) = 0; + + // GL_CHROMIUM_framebuffer_multisample + virtual void blitFramebufferCHROMIUM(WGC3Dint srcX0, WGC3Dint srcY0, WGC3Dint srcX1, WGC3Dint srcY1, WGC3Dint dstX0, WGC3Dint dstY0, WGC3Dint dstX1, WGC3Dint dstY1, WGC3Dbitfield mask, WGC3Denum filter) = 0; + virtual void renderbufferStorageMultisampleCHROMIUM(WGC3Denum target, WGC3Dsizei samples, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; + + // GL_CHROMIUM_swapbuffers_complete_callback + virtual void setSwapBuffersCompleteCallbackCHROMIUM(WebGraphicsSwapBuffersCompleteCallbackCHROMIUM* callback) { } + + // GL_CHROMIUM_rate_limit_offscreen_context + virtual void rateLimitOffscreenContextCHROMIUM() { } + + // The entry points below map directly to the OpenGL ES 2.0 API. + // See: http://www.khronos.org/registry/gles/ + // and: http://www.khronos.org/opengles/sdk/docs/man/ + virtual void activeTexture(WGC3Denum texture) = 0; + virtual void attachShader(WebGLId program, WebGLId shader) = 0; + virtual void bindAttribLocation(WebGLId program, WGC3Duint index, const WGC3Dchar* name) = 0; + virtual void bindBuffer(WGC3Denum target, WebGLId buffer) = 0; + virtual void bindFramebuffer(WGC3Denum target, WebGLId framebuffer) = 0; + virtual void bindRenderbuffer(WGC3Denum target, WebGLId renderbuffer) = 0; + virtual void bindTexture(WGC3Denum target, WebGLId texture) = 0; + virtual void blendColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; + virtual void blendEquation(WGC3Denum mode) = 0; + virtual void blendEquationSeparate(WGC3Denum modeRGB, WGC3Denum modeAlpha) = 0; + virtual void blendFunc(WGC3Denum sfactor, WGC3Denum dfactor) = 0; + virtual void blendFuncSeparate(WGC3Denum srcRGB, WGC3Denum dstRGB, WGC3Denum srcAlpha, WGC3Denum dstAlpha) = 0; + + virtual void bufferData(WGC3Denum target, WGC3Dsizeiptr size, const void* data, WGC3Denum usage) = 0; + virtual void bufferSubData(WGC3Denum target, WGC3Dintptr offset, WGC3Dsizeiptr size, const void* data) = 0; + + virtual WGC3Denum checkFramebufferStatus(WGC3Denum target) = 0; + virtual void clear(WGC3Dbitfield mask) = 0; + virtual void clearColor(WGC3Dclampf red, WGC3Dclampf green, WGC3Dclampf blue, WGC3Dclampf alpha) = 0; + virtual void clearDepth(WGC3Dclampf depth) = 0; + virtual void clearStencil(WGC3Dint s) = 0; + virtual void colorMask(WGC3Dboolean red, WGC3Dboolean green, WGC3Dboolean blue, WGC3Dboolean alpha) = 0; + virtual void compileShader(WebGLId shader) = 0; + + virtual void compressedTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Dsizei imageSize, const void* data) = 0; + virtual void compressedTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Dsizei imageSize, const void* data) = 0; + virtual void copyTexImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border) = 0; + virtual void copyTexSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void cullFace(WGC3Denum mode) = 0; + virtual void depthFunc(WGC3Denum func) = 0; + virtual void depthMask(WGC3Dboolean flag) = 0; + virtual void depthRange(WGC3Dclampf zNear, WGC3Dclampf zFar) = 0; + virtual void detachShader(WebGLId program, WebGLId shader) = 0; + virtual void disable(WGC3Denum cap) = 0; + virtual void disableVertexAttribArray(WGC3Duint index) = 0; + virtual void drawArrays(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count) = 0; + virtual void drawElements(WGC3Denum mode, WGC3Dsizei count, WGC3Denum type, WGC3Dintptr offset) = 0; + + virtual void enable(WGC3Denum cap) = 0; + virtual void enableVertexAttribArray(WGC3Duint index) = 0; + virtual void finish() = 0; + virtual void flush() = 0; + virtual void framebufferRenderbuffer(WGC3Denum target, WGC3Denum attachment, WGC3Denum renderbuffertarget, WebGLId renderbuffer) = 0; + virtual void framebufferTexture2D(WGC3Denum target, WGC3Denum attachment, WGC3Denum textarget, WebGLId texture, WGC3Dint level) = 0; + virtual void frontFace(WGC3Denum mode) = 0; + virtual void generateMipmap(WGC3Denum target) = 0; + + virtual bool getActiveAttrib(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; + virtual bool getActiveUniform(WebGLId program, WGC3Duint index, ActiveInfo&) = 0; + virtual void getAttachedShaders(WebGLId program, WGC3Dsizei maxCount, WGC3Dsizei* count, WebGLId* shaders) = 0; + virtual WGC3Dint getAttribLocation(WebGLId program, const WGC3Dchar* name) = 0; + virtual void getBooleanv(WGC3Denum pname, WGC3Dboolean* value) = 0; + virtual void getBufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual Attributes getContextAttributes() = 0; + virtual WGC3Denum getError() = 0; + virtual void getFloatv(WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getFramebufferAttachmentParameteriv(WGC3Denum target, WGC3Denum attachment, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getIntegerv(WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getProgramiv(WebGLId program, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WebString getProgramInfoLog(WebGLId program) = 0; + virtual void getRenderbufferParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getShaderiv(WebGLId shader, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WebString getShaderInfoLog(WebGLId shader) = 0; + + // TBD + // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); + + virtual WebString getShaderSource(WebGLId shader) = 0; + virtual WebString getString(WGC3Denum name) = 0; + virtual void getTexParameterfv(WGC3Denum target, WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getTexParameteriv(WGC3Denum target, WGC3Denum pname, WGC3Dint* value) = 0; + virtual void getUniformfv(WebGLId program, WGC3Dint location, WGC3Dfloat* value) = 0; + virtual void getUniformiv(WebGLId program, WGC3Dint location, WGC3Dint* value) = 0; + virtual WGC3Dint getUniformLocation(WebGLId program, const WGC3Dchar* name) = 0; + virtual void getVertexAttribfv(WGC3Duint index, WGC3Denum pname, WGC3Dfloat* value) = 0; + virtual void getVertexAttribiv(WGC3Duint index, WGC3Denum pname, WGC3Dint* value) = 0; + virtual WGC3Dsizeiptr getVertexAttribOffset(WGC3Duint index, WGC3Denum pname) = 0; + + virtual void hint(WGC3Denum target, WGC3Denum mode) = 0; + virtual WGC3Dboolean isBuffer(WebGLId buffer) = 0; + virtual WGC3Dboolean isEnabled(WGC3Denum cap) = 0; + virtual WGC3Dboolean isFramebuffer(WebGLId framebuffer) = 0; + virtual WGC3Dboolean isProgram(WebGLId program) = 0; + virtual WGC3Dboolean isRenderbuffer(WebGLId renderbuffer) = 0; + virtual WGC3Dboolean isShader(WebGLId shader) = 0; + virtual WGC3Dboolean isTexture(WebGLId texture) = 0; + virtual void lineWidth(WGC3Dfloat) = 0; + virtual void linkProgram(WebGLId program) = 0; + virtual void pixelStorei(WGC3Denum pname, WGC3Dint param) = 0; + virtual void polygonOffset(WGC3Dfloat factor, WGC3Dfloat units) = 0; + + virtual void readPixels(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, void* pixels) = 0; + + virtual void releaseShaderCompiler() = 0; + + virtual void renderbufferStorage(WGC3Denum target, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void sampleCoverage(WGC3Dclampf value, WGC3Dboolean invert) = 0; + virtual void scissor(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + virtual void shaderSource(WebGLId shader, const WGC3Dchar* string) = 0; + virtual void stencilFunc(WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; + virtual void stencilFuncSeparate(WGC3Denum face, WGC3Denum func, WGC3Dint ref, WGC3Duint mask) = 0; + virtual void stencilMask(WGC3Duint mask) = 0; + virtual void stencilMaskSeparate(WGC3Denum face, WGC3Duint mask) = 0; + virtual void stencilOp(WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; + virtual void stencilOpSeparate(WGC3Denum face, WGC3Denum fail, WGC3Denum zfail, WGC3Denum zpass) = 0; + + virtual void texImage2D(WGC3Denum target, WGC3Dint level, WGC3Denum internalformat, WGC3Dsizei width, WGC3Dsizei height, WGC3Dint border, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; + + virtual void texParameterf(WGC3Denum target, WGC3Denum pname, WGC3Dfloat param) = 0; + virtual void texParameteri(WGC3Denum target, WGC3Denum pname, WGC3Dint param) = 0; + + virtual void texSubImage2D(WGC3Denum target, WGC3Dint level, WGC3Dint xoffset, WGC3Dint yoffset, WGC3Dsizei width, WGC3Dsizei height, WGC3Denum format, WGC3Denum type, const void* pixels) = 0; + + virtual void uniform1f(WGC3Dint location, WGC3Dfloat x) = 0; + virtual void uniform1fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform1i(WGC3Dint location, WGC3Dint x) = 0; + virtual void uniform1iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform2f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y) = 0; + virtual void uniform2fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform2i(WGC3Dint location, WGC3Dint x, WGC3Dint y) = 0; + virtual void uniform2iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform3f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; + virtual void uniform3fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform3i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z) = 0; + virtual void uniform3iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniform4f(WGC3Dint location, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; + virtual void uniform4fv(WGC3Dint location, WGC3Dsizei count, const WGC3Dfloat* v) = 0; + virtual void uniform4i(WGC3Dint location, WGC3Dint x, WGC3Dint y, WGC3Dint z, WGC3Dint w) = 0; + virtual void uniform4iv(WGC3Dint location, WGC3Dsizei count, const WGC3Dint* v) = 0; + virtual void uniformMatrix2fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + virtual void uniformMatrix3fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + virtual void uniformMatrix4fv(WGC3Dint location, WGC3Dsizei count, WGC3Dboolean transpose, const WGC3Dfloat* value) = 0; + + virtual void useProgram(WebGLId program) = 0; + virtual void validateProgram(WebGLId program) = 0; + + virtual void vertexAttrib1f(WGC3Duint index, WGC3Dfloat x) = 0; + virtual void vertexAttrib1fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib2f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y) = 0; + virtual void vertexAttrib2fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib3f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z) = 0; + virtual void vertexAttrib3fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttrib4f(WGC3Duint index, WGC3Dfloat x, WGC3Dfloat y, WGC3Dfloat z, WGC3Dfloat w) = 0; + virtual void vertexAttrib4fv(WGC3Duint index, const WGC3Dfloat* values) = 0; + virtual void vertexAttribPointer(WGC3Duint index, WGC3Dint size, WGC3Denum type, WGC3Dboolean normalized, + WGC3Dsizei stride, WGC3Dintptr offset) = 0; + + virtual void viewport(WGC3Dint x, WGC3Dint y, WGC3Dsizei width, WGC3Dsizei height) = 0; + + // Support for buffer creation and deletion. + virtual WebGLId createBuffer() = 0; + virtual WebGLId createFramebuffer() = 0; + virtual WebGLId createProgram() = 0; + virtual WebGLId createRenderbuffer() = 0; + virtual WebGLId createShader(WGC3Denum) = 0; + virtual WebGLId createTexture() = 0; + + virtual void deleteBuffer(WebGLId) = 0; + virtual void deleteFramebuffer(WebGLId) = 0; + virtual void deleteProgram(WebGLId) = 0; + virtual void deleteRenderbuffer(WebGLId) = 0; + virtual void deleteShader(WebGLId) = 0; + virtual void deleteTexture(WebGLId) = 0; + + virtual void setContextLostCallback(WebGraphicsContextLostCallback* callback) {} + // GL_ARB_robustness + // + // This entry point must provide slightly different semantics than + // the GL_ARB_robustness extension; specifically, the lost context + // state is sticky, rather than reported only once. + virtual WGC3Denum getGraphicsResetStatusARB() { return 0; /* GL_NO_ERROR */ } + + // FIXME: make this function pure virtual once it is implemented in + // both command buffer port and in-process port. + virtual WebString getTranslatedShaderSourceANGLE(WebGLId shader) { return WebString(); } + + // GL_CHROMIUM_iosurface + virtual void texImageIOSurface2DCHROMIUM(WGC3Denum target, WGC3Dint width, WGC3Dint height, WGC3Duint ioSurfaceId, WGC3Duint plane) { } + + // GL_EXT_texture_storage + virtual void texStorage2DEXT(WGC3Denum target, WGC3Dint levels, WGC3Duint internalformat, + WGC3Dint width, WGC3Dint height) { } + + +#if WEBKIT_USING_SKIA + GrGLInterface* createGrGLInterface(); +#endif + +protected: +#if WEBKIT_USING_SKIA + virtual GrGLInterface* onCreateGrGLInterface() { return 0; } +#endif + +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPBody.h b/Source/WebKit/chromium/public/platform/WebHTTPBody.h new file mode 100644 index 000000000..e97856320 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPBody.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHTTPBody_h +#define WebHTTPBody_h + +#include "WebData.h" +#include "WebNonCopyable.h" +#include "WebString.h" +#include "WebURL.h" + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class FormData; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebHTTPBodyPrivate; + +class WebHTTPBody { +public: + struct Element { + enum Type { TypeData, TypeFile, TypeBlob } type; + WebData data; + WebString filePath; + long long fileStart; + long long fileLength; // -1 means to the end of the file. + double modificationTime; + WebURL blobURL; + }; + + ~WebHTTPBody() { reset(); } + + WebHTTPBody() : m_private(0) { } + WebHTTPBody(const WebHTTPBody& b) : m_private(0) { assign(b); } + WebHTTPBody& operator=(const WebHTTPBody& b) + { + assign(b); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebHTTPBody&); + + bool isNull() const { return !m_private; } + + // Returns the number of elements comprising the http body. + WEBKIT_EXPORT size_t elementCount() const; + + // Sets the values of the element at the given index. Returns false if + // index is out of bounds. + WEBKIT_EXPORT bool elementAt(size_t index, Element&) const; + + // Append to the list of elements. + WEBKIT_EXPORT void appendData(const WebData&); + WEBKIT_EXPORT void appendFile(const WebString&); + // Passing -1 to fileLength means to the end of the file. + WEBKIT_EXPORT void appendFileRange(const WebString&, long long fileStart, long long fileLength, double modificationTime); + WEBKIT_EXPORT void appendBlob(const WebURL&); + + // Identifies a particular form submission instance. A value of 0 is + // used to indicate an unspecified identifier. + WEBKIT_EXPORT long long identifier() const; + WEBKIT_EXPORT void setIdentifier(long long); + +#if WEBKIT_IMPLEMENTATION + WebHTTPBody(const WTF::PassRefPtr<WebCore::FormData>&); + WebHTTPBody& operator=(const WTF::PassRefPtr<WebCore::FormData>&); + operator WTF::PassRefPtr<WebCore::FormData>() const; +#endif + +private: + void assign(WebHTTPBodyPrivate*); + void ensureMutable(); + WebHTTPBodyPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h new file mode 100644 index 000000000..2ca86c01c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPHeaderVisitor.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHTTPHeaderVisitor_h +#define WebHTTPHeaderVisitor_h + +namespace WebKit { + +class WebString; + +class WebHTTPHeaderVisitor { +public: + virtual void visitHeader(const WebString& name, const WebString& value) = 0; + +protected: + ~WebHTTPHeaderVisitor() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h new file mode 100644 index 000000000..09bf16992 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebHTTPLoadInfo.h @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebHTTPLoadInfo_h +#define WebHTTPLoadInfo_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +struct ResourceLoadInfo; +} + +namespace WebKit { +class WebString; + +class WebHTTPLoadInfo { +public: + WebHTTPLoadInfo() { initialize(); } + ~WebHTTPLoadInfo() { reset(); } + WebHTTPLoadInfo(const WebHTTPLoadInfo& r) { assign(r); } + WebHTTPLoadInfo& operator =(const WebHTTPLoadInfo& r) + { + assign(r); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebHTTPLoadInfo& r); + + WEBKIT_EXPORT int httpStatusCode() const; + WEBKIT_EXPORT void setHTTPStatusCode(int); + + WEBKIT_EXPORT WebString httpStatusText() const; + WEBKIT_EXPORT void setHTTPStatusText(const WebString&); + + WEBKIT_EXPORT long long encodedDataLength() const; + WEBKIT_EXPORT void setEncodedDataLength(long long); + + WEBKIT_EXPORT void addRequestHeader(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addResponseHeader(const WebString& name, const WebString& value); + + WEBKIT_EXPORT WebString requestHeadersText() const; + WEBKIT_EXPORT void setRequestHeadersText(const WebString&); + + WEBKIT_EXPORT WebString responseHeadersText() const; + WEBKIT_EXPORT void setResponseHeadersText(const WebString&); + +#if WEBKIT_IMPLEMENTATION + WebHTTPLoadInfo(WTF::PassRefPtr<WebCore::ResourceLoadInfo>); + operator WTF::PassRefPtr<WebCore::ResourceLoadInfo>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadInfo> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebImage.h b/Source/WebKit/chromium/public/platform/WebImage.h new file mode 100644 index 000000000..bf0e9722e --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebImage.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebImage_h +#define WebImage_h + +#include "WebCommon.h" + +#if WEBKIT_USING_SKIA +#include <SkBitmap.h> +#elif WEBKIT_USING_CG +typedef struct CGImage* CGImageRef; +#endif + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class Image; } +namespace WTF { template <typename T> class PassRefPtr; } +#endif + +namespace WebKit { + +class WebData; +struct WebSize; + +// A container for an ARGB bitmap. +class WebImage { +public: + ~WebImage() { reset(); } + + WebImage() { init(); } + WebImage(const WebImage& image) + { + init(); + assign(image); + } + + WebImage& operator=(const WebImage& image) + { + assign(image); + return *this; + } + + // Decodes the given image data. If the image has multiple frames, + // then the frame whose size is desiredSize is returned. Otherwise, + // the first frame is returned. + WEBKIT_EXPORT static WebImage fromData(const WebData&, const WebSize& desiredSize); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebImage&); + + WEBKIT_EXPORT bool isNull() const; + WEBKIT_EXPORT WebSize size() const; + +#if WEBKIT_IMPLEMENTATION + WebImage(const WTF::PassRefPtr<WebCore::Image>&); + WebImage& operator=(const WTF::PassRefPtr<WebCore::Image>&); +#endif + +#if WEBKIT_USING_SKIA + WebImage(const SkBitmap& bitmap) : m_bitmap(bitmap) { } + + WebImage& operator=(const SkBitmap& bitmap) + { + m_bitmap = bitmap; + return *this; + } + + SkBitmap& getSkBitmap() { return m_bitmap; } + const SkBitmap& getSkBitmap() const { return m_bitmap; } + +private: + void init() { } + SkBitmap m_bitmap; + +#elif WEBKIT_USING_CG + WebImage(CGImageRef imageRef) + { + init(); + assign(imageRef); + } + + WebImage& operator=(CGImageRef imageRef) + { + assign(imageRef); + return *this; + } + + CGImageRef getCGImageRef() const { return m_imageRef; } + +private: + void init() { m_imageRef = 0; } + WEBKIT_EXPORT void assign(CGImageRef); + CGImageRef m_imageRef; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h new file mode 100644 index 000000000..6c0e74f12 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebKitPlatformSupport.h @@ -0,0 +1,347 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebKitPlatformSupport_h +#define WebKitPlatformSupport_h + +#include "WebAudioBus.h" +#include "WebAudioDevice.h" +#include "WebCommon.h" +#include "WebData.h" +#include "WebGamepads.h" +#include "WebLocalizedString.h" +#include "WebSerializedScriptValue.h" +#include "WebString.h" +#include "WebURL.h" +#include "WebVector.h" + +#include <time.h> + +#ifdef WIN32 +typedef void *HANDLE; +#endif + +namespace WebKit { + +class WebApplicationCacheHost; // FIXME: Does this belong in platform? +class WebApplicationCacheHostClient; // FIXME: Does this belong in platform? +class WebBlobRegistry; +class WebClipboard; +class WebCookieJar; +class WebFileSystem; +class WebFileUtilities; +class WebGraphicsContext3D; +class WebIDBFactory; // FIXME: Does this belong in platform? +class WebIDBKey; // FIXME: Does this belong in platform? +class WebMessagePortChannel; // FIXME: Does this belong in platform? +class WebMimeRegistry; +class WebPeerConnectionHandler; +class WebPeerConnectionHandlerClient; +class WebPluginListBuilder; // FIXME: Does this belong in platform? +class WebSandboxSupport; +class WebSharedWorkerRepository; // FIXME: Does this belong in platform? +class WebSocketStreamHandle; +class WebStorageNamespace; // FIXME: Does this belong in platform? +class WebThemeEngine; +class WebThread; +class WebURLLoader; +class WebWorkerRunLoop; + +class WebKitPlatformSupport { +public: + // Must return non-null. + virtual WebClipboard* clipboard() { return 0; } + + // Must return non-null. + virtual WebMimeRegistry* mimeRegistry() { return 0; } + + // Must return non-null. + virtual WebFileUtilities* fileUtilities() { return 0; } + + // May return null if sandbox support is not necessary + virtual WebSandboxSupport* sandboxSupport() { return 0; } + + // May return null on some platforms. + virtual WebThemeEngine* themeEngine() { return 0; } + + // May return null. + virtual WebCookieJar* cookieJar() { return 0; } + + // Blob ---------------------------------------------------------------- + + // Must return non-null. + virtual WebBlobRegistry* blobRegistry() { return 0; } + + // DOM Storage -------------------------------------------------- + + // Return a LocalStorage namespace that corresponds to the following path. + virtual WebStorageNamespace* createLocalStorageNamespace(const WebString& path, unsigned quota) { return 0; } + + // Called when storage events fire. + virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue, + const WebString& newValue, const WebString& origin, + const WebURL& url, bool isLocalStorage) { } + + + // Gamepad ------------------------------------------------------------- + + virtual void sampleGamepads(WebGamepads& into) { into.length = 0; } + + + // History ------------------------------------------------------------- + + // Returns the hash for the given canonicalized URL for use in visited + // link coloring. + virtual unsigned long long visitedLinkHash( + const char* canonicalURL, size_t length) { return 0; } + + // Returns whether the given link hash is in the user's history. The + // hash must have been generated by calling VisitedLinkHash(). + virtual bool isLinkVisited(unsigned long long linkHash) { return false; } + + + // HTML5 Database ------------------------------------------------------ + +#ifdef WIN32 + typedef HANDLE FileHandle; +#else + typedef int FileHandle; +#endif + + // Opens a database file; dirHandle should be 0 if the caller does not need + // a handle to the directory containing this file + virtual FileHandle databaseOpenFile( + const WebString& vfsFileName, int desiredFlags) { return FileHandle(); } + + // Deletes a database file and returns the error code + virtual int databaseDeleteFile(const WebString& vfsFileName, bool syncDir) { return 0; } + + // Returns the attributes of the given database file + virtual long databaseGetFileAttributes(const WebString& vfsFileName) { return 0; } + + // Returns the size of the given database file + virtual long long databaseGetFileSize(const WebString& vfsFileName) { return 0; } + + // Returns the space available for the given origin + virtual long long databaseGetSpaceAvailableForOrigin(const WebKit::WebString& originIdentifier) { return 0; } + + // Indexed Database ---------------------------------------------------- + + virtual WebIDBFactory* idbFactory() { return 0; } + virtual void createIDBKeysFromSerializedValuesAndKeyPath(const WebVector<WebSerializedScriptValue>& values, const WebString& keyPath, WebVector<WebIDBKey>& keys) { } + virtual WebSerializedScriptValue injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebString& keyPath) { return WebSerializedScriptValue(); } + + + // Keygen -------------------------------------------------------------- + + // Handle the <keygen> tag for generating client certificates + // Returns a base64 encoded signed copy of a public key from a newly + // generated key pair and the supplied challenge string. keySizeindex + // specifies the strength of the key. + virtual WebString signedPublicKeyAndChallengeString(unsigned keySizeIndex, + const WebKit::WebString& challenge, + const WebKit::WebURL& url) { return WebString(); } + + + + // Memory -------------------------------------------------------------- + + // Returns the current space allocated for the pagefile, in MB. + // That is committed size for Windows and virtual memory size for POSIX + virtual size_t memoryUsageMB() { return 0; } + + // Same as above, but always returns actual value, without any caches. + virtual size_t actualMemoryUsageMB() { return 0; } + + // If memory usage is below this threshold, do not bother forcing GC. + virtual size_t lowMemoryUsageMB() { return 256; } + + // If memory usage is above this threshold, force GC more aggressively. + virtual size_t highMemoryUsageMB() { return 1024; } + + // Delta of memory usage growth (vs. last actualMemoryUsageMB()) to force GC when memory usage is high. + virtual size_t highUsageDeltaMB() { return 128; } + + + // Threads ------------------------------------------------------- + + // Creates an embedder-defined thread. + virtual WebThread* createThread(const char* name) { return 0; } + + // Returns an interface to the current thread. This is owned by the + // embedder. + virtual WebThread* currentThread() { return 0; } + + + // Message Ports ------------------------------------------------------- + + // Creates a Message Port Channel. This can be called on any thread. + // The returned object should only be used on the thread it was created on. + virtual WebMessagePortChannel* createMessagePortChannel() { return 0; } + + + // Network ------------------------------------------------------------- + + // A suggestion to prefetch IP information for the given hostname. + virtual void prefetchHostName(const WebString&) { } + + // Returns a new WebURLLoader instance. + virtual WebURLLoader* createURLLoader() { return 0; } + + // Returns a new WebSocketStreamHandle instance. + virtual WebSocketStreamHandle* createSocketStreamHandle() { return 0; } + + // Returns the User-Agent string that should be used for the given URL. + virtual WebString userAgent(const WebURL&) { return WebString(); } + + // A suggestion to cache this metadata in association with this URL. + virtual void cacheMetadata(const WebURL&, double responseTime, const char* data, size_t dataSize) { } + + + // Plugins ------------------------------------------------------------- + + // If refresh is true, then cached information should not be used to + // satisfy this call. + virtual void getPluginList(bool refresh, WebPluginListBuilder*) { } + + + // Profiling ----------------------------------------------------------- + + virtual void decrementStatsCounter(const char* name) { } + virtual void incrementStatsCounter(const char* name) { } + + // An event is identified by the pair (name, id). The extra parameter + // specifies additional data to log with the event. + virtual bool isTraceEventEnabled() const { return true; } + virtual void traceEventBegin(const char* name, void* id, const char* extra) { } + virtual void traceEventEnd(const char* name, void* id, const char* extra) { } + + // Callbacks for reporting histogram data. + // CustomCounts histogram has exponential bucket sizes, so that min=1, max=1000000, bucketCount=50 would do. + virtual void histogramCustomCounts(const char* name, int sample, int min, int max, int bucketCount) { } + // Enumeration histogram buckets are linear, boundaryValue should be larger than any possible sample value. + virtual void histogramEnumeration(const char* name, int sample, int boundaryValue) { } + + + // Resources ----------------------------------------------------------- + + // Returns a blob of data corresponding to the named resource. + virtual WebData loadResource(const char* name) { return WebData(); } + + // Decodes the in-memory audio file data and returns the linear PCM audio data in the destinationBus. + // A sample-rate conversion to sampleRate will occur if the file data is at a different sample-rate. + // Returns true on success. + virtual bool loadAudioResource(WebAudioBus* destinationBus, const char* audioFileData, size_t dataSize, double sampleRate) { return false; } + + // Returns a localized string resource (with substitution parameters). + virtual WebString queryLocalizedString(WebLocalizedString::Name) { return WebString(); } + virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter) { return WebString(); } + virtual WebString queryLocalizedString(WebLocalizedString::Name, const WebString& parameter1, const WebString& parameter2) { return WebString(); } + + + // Sandbox ------------------------------------------------------------ + + // In some browsers, a "sandbox" restricts what operations a program + // is allowed to preform. Such operations are typically abstracted out + // via this API, but sometimes (like in HTML 5 database opening) WebKit + // needs to behave differently based on whether it's restricted or not. + // In these cases (and these cases only) you can call this function. + // It's OK for this value to be conservitive (i.e. true even if the + // sandbox isn't active). + virtual bool sandboxEnabled() { return false; } + + + // Shared Workers ------------------------------------------------------ + + virtual WebSharedWorkerRepository* sharedWorkerRepository() { return 0; } + + // Sudden Termination -------------------------------------------------- + + // Disable/Enable sudden termination. + virtual void suddenTerminationChanged(bool enabled) { } + + + // System -------------------------------------------------------------- + + // Returns a value such as "en-US". + virtual WebString defaultLocale() { return WebString(); } + + // Wall clock time in seconds since the epoch. + virtual double currentTime() { return 0; } + + // Monotonically increasing time in seconds from an arbitrary fixed point in the past. + // This function is expected to return at least millisecond-precision values. For this reason, + // it is recommended that the fixed point be no further in the past than the epoch. + virtual double monotonicallyIncreasingTime() { return 0; } + + // WebKit clients must implement this funcion if they use cryptographic randomness. + virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0; + + // Delayed work is driven by a shared timer. + typedef void (*SharedTimerFunction)(); + virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) { } + virtual void setSharedTimerFireInterval(double) { } + virtual void stopSharedTimer() { } + + // Callable from a background WebKit thread. + virtual void callOnMainThread(void (*func)(void*), void* context) { } + + // WebGL -------------------------------------------------------------- + + // May return null if WebGL is not supported. + // Returns newly allocated WebGraphicsContext3D instance. + virtual WebGraphicsContext3D* createGraphicsContext3D() { return 0; } + + // Audio -------------------------------------------------------------- + + virtual double audioHardwareSampleRate() { return 0; } + virtual size_t audioHardwareBufferSize() { return 0; } + virtual WebAudioDevice* createAudioDevice(size_t bufferSize, unsigned numberOfChannels, double sampleRate, WebAudioDevice::RenderCallback*) { return 0; } + + // FileSystem ---------------------------------------------------------- + + // Must return non-null. + virtual WebFileSystem* fileSystem() { return 0; } + + // WebRTC ---------------------------------------------------------- + + // May return null if WebRTC functionality is not avaliable or out of resources. + virtual WebPeerConnectionHandler* createPeerConnectionHandler(WebPeerConnectionHandlerClient*) { return 0; } + + virtual void didStartWorkerRunLoop(const WebWorkerRunLoop&) { } + virtual void didStopWorkerRunLoop(const WebWorkerRunLoop&) { } + +protected: + ~WebKitPlatformSupport() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebLayer.h b/Source/WebKit/chromium/public/platform/WebLayer.h new file mode 100644 index 000000000..3d919fa46 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayer.h @@ -0,0 +1,143 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebLayer_h +#define WebLayer_h + +#include "WebColor.h" +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +class SkMatrix44; +namespace WebCore { class LayerChromium; } + +namespace WebKit { +struct WebFloatPoint; +struct WebSize; + +class WebLayer { +public: + WEBKIT_EXPORT static WebLayer create(); + + WebLayer() { } + WebLayer(const WebLayer& layer) { assign(layer); } + virtual ~WebLayer() { reset(); } + WebLayer& operator=(const WebLayer& layer) + { + assign(layer); + return *this; + } + bool isNull() { return m_private.isNull(); } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebLayer&); + WEBKIT_EXPORT bool equals(const WebLayer&) const; + + WEBKIT_EXPORT WebLayer rootLayer() const; + WEBKIT_EXPORT WebLayer parent() const; + WEBKIT_EXPORT void addChild(const WebLayer&); + WEBKIT_EXPORT void insertChild(const WebLayer&, size_t index); + WEBKIT_EXPORT void replaceChild(const WebLayer& reference, const WebLayer& newLayer); + WEBKIT_EXPORT void removeFromParent(); + WEBKIT_EXPORT void removeAllChildren(); + + WEBKIT_EXPORT void setAnchorPoint(const WebFloatPoint&); + WEBKIT_EXPORT WebFloatPoint anchorPoint() const; + + WEBKIT_EXPORT void setAnchorPointZ(float); + WEBKIT_EXPORT float anchorPointZ() const; + + WEBKIT_EXPORT void setBounds(const WebSize&); + WEBKIT_EXPORT WebSize bounds() const; + + WEBKIT_EXPORT void setMasksToBounds(bool); + WEBKIT_EXPORT bool masksToBounds() const; + + WEBKIT_EXPORT void setMaskLayer(const WebLayer&); + WEBKIT_EXPORT WebLayer maskLayer() const; + + WEBKIT_EXPORT void setOpacity(float); + WEBKIT_EXPORT float opacity() const; + + WEBKIT_EXPORT void setOpaque(bool); + WEBKIT_EXPORT bool opaque() const; + + WEBKIT_EXPORT void setPosition(const WebFloatPoint&); + WEBKIT_EXPORT WebFloatPoint position() const; + + WEBKIT_EXPORT void setSublayerTransform(const SkMatrix44&); + WEBKIT_EXPORT SkMatrix44 sublayerTransform() const; + + WEBKIT_EXPORT void setTransform(const SkMatrix44&); + WEBKIT_EXPORT SkMatrix44 transform() const; + + WEBKIT_EXPORT void setDebugBorderColor(const WebColor&); + WEBKIT_EXPORT void setDebugBorderWidth(float); + + template<typename T> T to() + { + T res; + res.WebLayer::assign(*this); + return res; + } + + template<typename T> const T toConst() const + { + T res; + res.WebLayer::assign(*this); + return res; + } + +#if WEBKIT_IMPLEMENTATION + WebLayer(const WTF::PassRefPtr<WebCore::LayerChromium>&); + WebLayer& operator=(const WTF::PassRefPtr<WebCore::LayerChromium>&); + operator WTF::PassRefPtr<WebCore::LayerChromium>() const; + template<typename T> T* unwrap() + { + return static_cast<T*>(m_private.get()); + } + + template<typename T> const T* constUnwrap() const + { + return static_cast<const T*>(m_private.get()); + } +#endif + +protected: + WebPrivatePtr<WebCore::LayerChromium> m_private; +}; + +inline bool operator==(const WebLayer& a, const WebLayer& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebLayer& a, const WebLayer& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif // WebLayer_h diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeView.h b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h new file mode 100644 index 000000000..0263b3926 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeView.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebLayerTreeView_h +#define WebLayerTreeView_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class CCLayerTreeHost; +struct CCSettings; +} + +namespace WebKit { +class WebLayer; +class WebLayerTreeViewClient; +struct WebRect; +struct WebSize; + +class WebLayerTreeView { +public: + struct Settings { + Settings() + : acceleratePainting(false) + , compositeOffscreen(false) + , showFPSCounter(false) + , showPlatformLayerTree(false) + , refreshRate(0) + , partialSwapEnabled(false) { } + + bool acceleratePainting; + bool compositeOffscreen; + bool showFPSCounter; + bool showPlatformLayerTree; + double refreshRate; + bool partialSwapEnabled; +#if WEBKIT_IMPLEMENTATION + operator WebCore::CCSettings() const; +#endif + }; + + WEBKIT_EXPORT static WebLayerTreeView create(WebLayerTreeViewClient*, const WebLayer& root, const Settings&); + + WebLayerTreeView() { } + WebLayerTreeView(const WebLayerTreeView& layer) { assign(layer); } + ~WebLayerTreeView() { reset(); } + WebLayerTreeView& operator=(const WebLayerTreeView& layer) + { + assign(layer); + return *this; + } + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebLayerTreeView&); + WEBKIT_EXPORT bool equals(const WebLayerTreeView&) const; + + // Triggers a compositing pass. If the compositor thread was not + // enabled via WebCompositor::initialize, the compositing pass happens + // immediately. If it is enabled, the compositing pass will happen at a + // later time. Before the compositing pass happens (i.e. before composite() + // returns when the compositor thread is disabled), WebContentLayers will be + // asked to paint their dirty region, through + // WebContentLayerClient::paintContents. + WEBKIT_EXPORT void composite(); + + WEBKIT_EXPORT void setViewportSize(const WebSize&); + WEBKIT_EXPORT WebSize viewportSize() const; + + // Composites and attempts to read back the result into the provided + // buffer. If it wasn't possible, e.g. due to context lost, will return + // false. Pixel format is 32bit (RGBA), and the provided buffer must be + // large enough contain viewportSize().width() * viewportSize().height() + // pixels. The WebLayerTreeView does not assume ownership of the buffer. + // The buffer is not modified if the false is returned. + WEBKIT_EXPORT bool compositeAndReadback(void *pixels, const WebRect&); + + // Sets the root of the tree. The root is set by way of the constructor. + // This is typically used to explicitly set the root to null to break + // cycles. + WEBKIT_EXPORT void setRootLayer(WebLayer*); + +#if WEBKIT_IMPLEMENTATION + WebLayerTreeView(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); + WebLayerTreeView& operator=(const WTF::PassRefPtr<WebCore::CCLayerTreeHost>&); + operator WTF::PassRefPtr<WebCore::CCLayerTreeHost>() const; +#endif + +protected: + WebPrivatePtr<WebCore::CCLayerTreeHost> m_private; +}; + +inline bool operator==(const WebLayerTreeView& a, const WebLayerTreeView& b) +{ + return a.equals(b); +} + +inline bool operator!=(const WebLayerTreeView& a, const WebLayerTreeView& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif // WebLayerTreeView_h diff --git a/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h new file mode 100644 index 000000000..9c4dfb77b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLayerTreeViewClient.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebLayerTreeViewClient_h +#define WebLayerTreeViewClient_h + +namespace WebKit { +class WebGraphicsContext3D; +struct WebSize; +class WebThread; + +class WebLayerTreeViewClient { +public: + // Updates animation and layout. These are called before the compositing + // pass so that layers can be updated at the given frame time. + virtual void updateAnimations(double frameBeginTime) = 0; + virtual void layout() = 0; + + // Applies a scroll delta to the root layer, which is bundled with a page + // scale factor that may apply a CSS transform on the whole document (used + // for mobile-device pinch zooming). This is triggered by events sent to the + // compositor thread through the WebCompositor interface. + virtual void applyScrollAndScale(const WebSize& scrollDelta, float scaleFactor) = 0; + + // Creates a 3D context suitable for the compositing. This may be called + // more than once if the context gets lost. + virtual WebGraphicsContext3D* createContext3D() = 0; + + // Signals a successful rebinding of the 3D context (e.g. after a lost + // context event). + virtual void didRebindGraphicsContext(bool success) = 0; + + // Schedules a compositing pass, meaning the client should call + // WebLayerTreeView::composite at a later time. This is only called if the + // compositor thread is disabled; when enabled, the compositor will + // internally schedule a compositing pass when needed. + virtual void scheduleComposite() = 0; + +protected: + virtual ~WebLayerTreeViewClient() { } +}; + +} // namespace WebKit + +#endif // WebLayerTreeViewClient_h diff --git a/Source/WebKit/chromium/public/platform/WebLocalizedString.h b/Source/WebKit/chromium/public/platform/WebLocalizedString.h new file mode 100644 index 000000000..0483df90b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebLocalizedString.h @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebLocalizedString_h +#define WebLocalizedString_h + +namespace WebKit { + +struct WebLocalizedString { + enum Name { + DetailsLabel, + SubmitButtonDefaultLabel, + InputElementAltText, + ResetButtonDefaultLabel, + FileButtonChooseFileLabel, + FileButtonChooseMultipleFilesLabel, + FileButtonNoFileSelectedLabel, + MultipleFileUploadText, + SearchableIndexIntroduction, + SearchMenuNoRecentSearchesText, + SearchMenuRecentSearchesText, + SearchMenuClearRecentSearchesText, + AXWebAreaText, + AXLinkText, + AXListMarkerText, + AXImageMapText, + AXHeadingText, + AXButtonActionVerb, + AXRadioButtonActionVerb, + AXTextFieldActionVerb, + AXCheckedCheckBoxActionVerb, + AXUncheckedCheckBoxActionVerb, + AXLinkActionVerb, + KeygenMenuHighGradeKeySize, + KeygenMenuMediumGradeKeySize, + ValidationValueMissing, + ValidationValueMissingForCheckbox, + ValidationValueMissingForFile, + ValidationValueMissingForMultipleFile, + ValidationValueMissingForRadio, + ValidationValueMissingForSelect, + ValidationTypeMismatch, + ValidationTypeMismatchForEmail, + ValidationTypeMismatchForMultipleEmail, + ValidationTypeMismatchForURL, + ValidationPatternMismatch, + ValidationTooLong, + ValidationRangeUnderflow, + ValidationRangeOverflow, + ValidationStepMismatch, + }; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h new file mode 100644 index 000000000..52c63d321 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamDescriptor.h @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMediaStreamDescriptor_h +#define WebMediaStreamDescriptor_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebPrivatePtr.h" +#include "WebVector.h" + +namespace WebCore { +class MediaStreamDescriptor; +} + +namespace WebKit { + +class WebMediaStreamSource; +class WebString; + +class WebMediaStreamDescriptor { +public: + WebMediaStreamDescriptor() { } + ~WebMediaStreamDescriptor() { reset(); } + + WEBKIT_EXPORT void initialize(const WebString& label, const WebVector<WebMediaStreamSource>&); + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebString label() const; + WEBKIT_EXPORT void sources(WebVector<WebMediaStreamSource>&) const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamDescriptor(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); + operator WTF::PassRefPtr<WebCore::MediaStreamDescriptor>() const; + operator WebCore::MediaStreamDescriptor*() const; + WebMediaStreamDescriptor& operator=(const WTF::PassRefPtr<WebCore::MediaStreamDescriptor>&); +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamDescriptor> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamDescriptor_h diff --git a/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h new file mode 100644 index 000000000..b65e996bd --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMediaStreamSource.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebMediaStreamSource_h +#define WebMediaStreamSource_h + +#include "WebCommon.h" +#include "WebNonCopyable.h" +#include "WebPrivatePtr.h" + +namespace WebCore { +class MediaStreamSource; +} + +namespace WebKit { + +class WebString; + +class WebMediaStreamSource { +public: + enum Type { + TypeAudio, + TypeVideo + }; + + WebMediaStreamSource() { } + ~WebMediaStreamSource() { reset(); } + + WEBKIT_EXPORT void initialize(const WebString& id, Type, const WebString& name); + WEBKIT_EXPORT void reset(); + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT WebString id() const; + WEBKIT_EXPORT Type type() const; + WEBKIT_EXPORT WebString name() const; + +#if WEBKIT_IMPLEMENTATION + WebMediaStreamSource(const WTF::PassRefPtr<WebCore::MediaStreamSource>&); + WebMediaStreamSource& operator=(WebCore::MediaStreamSource*); + operator WTF::PassRefPtr<WebCore::MediaStreamSource>() const; + operator WebCore::MediaStreamSource*() const; +#endif + +private: + WebPrivatePtr<WebCore::MediaStreamSource> m_private; +}; + +} // namespace WebKit + +#endif // WebMediaStreamSource_h diff --git a/Source/WebKit/chromium/public/platform/WebMimeRegistry.h b/Source/WebKit/chromium/public/platform/WebMimeRegistry.h new file mode 100644 index 000000000..4137b0756 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebMimeRegistry.h @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// This is a temporary forwarding header to ease the Platform transition for downstream users of the WebKit API. +// See https://bugs.webkit.org/show_bug.cgi?id=74583 +// FIXME: Remove as soon as downstream clients are updated. +#include "../../../../Platform/chromium/public/WebMimeRegistry.h" diff --git a/Source/WebKit/chromium/public/platform/WebNonCopyable.h b/Source/WebKit/chromium/public/platform/WebNonCopyable.h new file mode 100644 index 000000000..b0bd4565c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebNonCopyable.h @@ -0,0 +1,49 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebNonCopyable_h +#define WebNonCopyable_h + +namespace WebKit { + +// A base class to extend from if you do not support copying. +class WebNonCopyable { +protected: + WebNonCopyable() { } + ~WebNonCopyable() { } + +private: + WebNonCopyable(const WebNonCopyable&); + WebNonCopyable& operator=(const WebNonCopyable&); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h new file mode 100644 index 000000000..7586abc03 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandler.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPeerConnectionHandler_h +#define WebPeerConnectionHandler_h + +#include "../WebSecurityOrigin.h" // FIXME: This is a layering violation. +#include "WebString.h" +#include "WebVector.h" + +namespace WebKit { + +class WebMediaStreamDescriptor; +class WebPeerConnectionHandlerClient; + +// Note: +// SDP stands for Session Description Protocol, which is intended for describing +// multimedia sessions for the purposes of session announcement, session +// invitation, and other forms of multimedia session initiation. +// +// More information can be found here: +// http://tools.ietf.org/html/rfc4566 +// http://en.wikipedia.org/wiki/Session_Description_Protocol + + +class WebPeerConnectionHandler { +public: + virtual ~WebPeerConnectionHandler() { } + + virtual void initialize(const WebString& serverConfiguration, const WebSecurityOrigin&) = 0; + + virtual void produceInitialOffer(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams) = 0; + virtual void handleInitialOffer(const WebString& sdp) = 0; + virtual void processSDP(const WebString& sdp) = 0; + virtual void processPendingStreams(const WebVector<WebMediaStreamDescriptor>& pendingAddStreams, const WebVector<WebMediaStreamDescriptor>& pendingRemoveStreams) = 0; + virtual void sendDataStreamMessage(const char* data, size_t length) = 0; + + virtual void stop() = 0; +}; + +} // namespace WebKit + +#endif // WebPeerConnectionHandler_h diff --git a/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h new file mode 100644 index 000000000..f2b1d3297 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPeerConnectionHandlerClient.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPeerConnectionHandlerClient_h +#define WebPeerConnectionHandlerClient_h + +namespace WebKit { + +class WebMediaStreamDescriptor; +class WebString; + +class WebPeerConnectionHandlerClient { +public: + virtual ~WebPeerConnectionHandlerClient() { } + + virtual void didCompleteICEProcessing() = 0; + virtual void didGenerateSDP(const WebString& sdp) = 0; + virtual void didReceiveDataStreamMessage(const char* data, size_t length) = 0; + virtual void didAddRemoteStream(const WebMediaStreamDescriptor&) = 0; + virtual void didRemoveRemoteStream(const WebMediaStreamDescriptor&) = 0; +}; + +} // namespace WebKit + +#endif // WebPeerConnectionHandlerClient_h diff --git a/Source/WebKit/chromium/public/platform/WebPoint.h b/Source/WebKit/chromium/public/platform/WebPoint.h new file mode 100644 index 000000000..766236398 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPoint.h @@ -0,0 +1,111 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPoint_h +#define WebPoint_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntPoint.h" +#else +#include <ui/gfx/point.h> +#endif + +namespace WebKit { + +struct WebPoint { + int x; + int y; + + WebPoint() + : x(0) + , y(0) + { + } + + WebPoint(int x, int y) + : x(x) + , y(y) + { + } + +#if WEBKIT_IMPLEMENTATION + WebPoint(const WebCore::IntPoint& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const WebCore::IntPoint& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator WebCore::IntPoint() const + { + return WebCore::IntPoint(x, y); + } +#else + WebPoint(const gfx::Point& p) + : x(p.x()) + , y(p.y()) + { + } + + WebPoint& operator=(const gfx::Point& p) + { + x = p.x(); + y = p.y(); + return *this; + } + + operator gfx::Point() const + { + return gfx::Point(x, y); + } +#endif +}; + +inline bool operator==(const WebPoint& a, const WebPoint& b) +{ + return a.x == b.x && a.y == b.y; +} + +inline bool operator!=(const WebPoint& a, const WebPoint& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h new file mode 100644 index 000000000..4bcabcfe6 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPrivateOwnPtr.h @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPrivateOwnPtr_h +#define WebPrivateOwnPtr_h + +#include "WebCommon.h" + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a pointer to a WebCore class. It's similar to WebPrivatePtr, but it +// wraps a naked pointer rather than a reference counted. +// Note: you must call reset(0) on the implementation side in order to delete +// the WebCore pointer. +template <typename T> +class WebPrivateOwnPtr { +public: + WebPrivateOwnPtr() : m_ptr(0) {} + ~WebPrivateOwnPtr() { WEBKIT_ASSERT(!m_ptr); } + +#if WEBKIT_IMPLEMENTATION + explicit WebPrivateOwnPtr(T* ptr) + : m_ptr(ptr) + { + } + + void reset(T* ptr) + { + delete m_ptr; + m_ptr = ptr; + } + + T* get() const { return m_ptr; } + + T* operator->() const + { + WEBKIT_ASSERT(m_ptr); + return m_ptr; + } +#endif // WEBKIT_IMPLEMENTATION + +private: + T* m_ptr; + + WebPrivateOwnPtr(const WebPrivateOwnPtr&); + void operator=(const WebPrivateOwnPtr&); +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebPrivatePtr.h b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h new file mode 100644 index 000000000..31d09a90b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebPrivatePtr.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebPrivatePtr_h +#define WebPrivatePtr_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include <wtf/PassRefPtr.h> +#endif + +namespace WebKit { + +// This class is an implementation detail of the WebKit API. It exists +// to help simplify the implementation of WebKit interfaces that merely +// wrap a reference counted WebCore class. +template <typename T> +class WebPrivatePtr { +public: + WebPrivatePtr() : m_ptr(0) { } + ~WebPrivatePtr() { WEBKIT_ASSERT(!m_ptr); } + + bool isNull() const { return !m_ptr; } + +#if WEBKIT_IMPLEMENTATION + WebPrivatePtr(const PassRefPtr<T>& prp) + : m_ptr(prp.leakRef()) + { + } + + void reset() + { + assign(0); + } + + WebPrivatePtr<T>& operator=(const WebPrivatePtr<T>& other) + { + T* p = other.m_ptr; + if (p) + p->ref(); + assign(p); + return *this; + } + + WebPrivatePtr<T>& operator=(const PassRefPtr<T>& prp) + { + assign(prp.leakRef()); + return *this; + } + + T* get() const + { + return m_ptr; + } + + T* operator->() const + { + ASSERT(m_ptr); + return m_ptr; + } +#endif + +private: +#if WEBKIT_IMPLEMENTATION + void assign(T* p) + { + // p is already ref'd for us by the caller + if (m_ptr) + m_ptr->deref(); + m_ptr = p; + } +#endif + + T* m_ptr; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebRect.h b/Source/WebKit/chromium/public/platform/WebRect.h new file mode 100644 index 000000000..045b7a8eb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebRect.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebRect_h +#define WebRect_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntRect.h" +#else +#include <ui/gfx/rect.h> +#endif + +namespace WebKit { + +struct WebRect { + int x; + int y; + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebRect() + : x(0) + , y(0) + , width(0) + , height(0) + { + } + + WebRect(int x, int y, int width, int height) + : x(x) + , y(y) + , width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebRect(const WebCore::IntRect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const WebCore::IntRect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator WebCore::IntRect() const + { + return WebCore::IntRect(x, y, width, height); + } +#else + WebRect(const gfx::Rect& r) + : x(r.x()) + , y(r.y()) + , width(r.width()) + , height(r.height()) + { + } + + WebRect& operator=(const gfx::Rect& r) + { + x = r.x(); + y = r.y(); + width = r.width(); + height = r.height(); + return *this; + } + + operator gfx::Rect() const + { + return gfx::Rect(x, y, width, height); + } +#endif +}; + +inline bool operator==(const WebRect& a, const WebRect& b) +{ + return a.x == b.x && a.y == b.y && a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebRect& a, const WebRect& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h b/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h new file mode 100644 index 000000000..8501633bc --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSerializedScriptValue.h @@ -0,0 +1,96 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSerializedScriptValue_h +#define WebSerializedScriptValue_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class SerializedScriptValue; } + +#if WEBKIT_USING_V8 +namespace v8 { +class Value; +template <class T> class Handle; +} +#endif + +namespace WebKit { +class WebString; + +// FIXME: Should this class be in platform? +class WebSerializedScriptValue { +public: + ~WebSerializedScriptValue() { reset(); } + + WebSerializedScriptValue() { } + WebSerializedScriptValue(const WebSerializedScriptValue& d) { assign(d); } + WebSerializedScriptValue& operator=(const WebSerializedScriptValue& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT static WebSerializedScriptValue fromString(const WebString&); + +#if WEBKIT_USING_V8 + WEBKIT_EXPORT static WebSerializedScriptValue serialize(v8::Handle<v8::Value>); +#endif + + // Create a WebSerializedScriptValue that represents a serialization error. + WEBKIT_EXPORT static WebSerializedScriptValue createInvalid(); + + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebSerializedScriptValue&); + + bool isNull() const { return m_private.isNull(); } + + // Returns a string representation of the WebSerializedScriptValue. + WEBKIT_EXPORT WebString toString() const; + +#if WEBKIT_USING_V8 + // Convert the serialized value to a parsed v8 value. + WEBKIT_EXPORT v8::Handle<v8::Value> deserialize(); +#endif + +#if WEBKIT_IMPLEMENTATION + WebSerializedScriptValue(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + WebSerializedScriptValue& operator=(const WTF::PassRefPtr<WebCore::SerializedScriptValue>&); + operator WTF::PassRefPtr<WebCore::SerializedScriptValue>() const; +#endif + +private: + WebPrivatePtr<WebCore::SerializedScriptValue> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSize.h b/Source/WebKit/chromium/public/platform/WebSize.h new file mode 100644 index 000000000..94a53654d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSize.h @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSize_h +#define WebSize_h + +#include "WebCommon.h" + +#if WEBKIT_IMPLEMENTATION +#include "IntSize.h" +#else +#include <ui/gfx/size.h> +#endif + +namespace WebKit { + +struct WebSize { + int width; + int height; + + bool isEmpty() const { return width <= 0 || height <= 0; } + + WebSize() + : width(0) + , height(0) + { + } + + WebSize(int width, int height) + : width(width) + , height(height) + { + } + +#if WEBKIT_IMPLEMENTATION + WebSize(const WebCore::IntSize& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const WebCore::IntSize& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator WebCore::IntSize() const + { + return WebCore::IntSize(width, height); + } +#else + WebSize(const gfx::Size& s) + : width(s.width()) + , height(s.height()) + { + } + + WebSize& operator=(const gfx::Size& s) + { + width = s.width(); + height = s.height(); + return *this; + } + + operator gfx::Size() const + { + return gfx::Size(width, height); + } +#endif +}; + +inline bool operator==(const WebSize& a, const WebSize& b) +{ + return a.width == b.width && a.height == b.height; +} + +inline bool operator!=(const WebSize& a, const WebSize& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamError.h b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h new file mode 100644 index 000000000..f52869b3b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamError.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSocketStreamError_h +#define WebSocketStreamError_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebSocketStreamError { +public: + // FIXME: Define SocketStream Error codes and accessor methods. +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h new file mode 100644 index 000000000..ededa0e43 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandle.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSocketStreamHandle_h +#define WebSocketStreamHandle_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebSocketStreamHandleClient; +class WebURL; + +class WebSocketStreamHandle { +public: + virtual ~WebSocketStreamHandle() { } + + // Connect new socket stream asynchronously. + virtual void connect(const WebURL&, WebSocketStreamHandleClient*) = 0; + + // Send web socket frame data on the socket stream. + virtual bool send(const WebData&) = 0; + + // Close the socket stream. + virtual void close() = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h new file mode 100644 index 000000000..82f328c6e --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebSocketStreamHandleClient.h @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSocketStreamHandleClient_h +#define WebSocketStreamHandleClient_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebSocketStreamError; +class WebSocketStreamHandle; +class WebURL; + +class WebSocketStreamHandleClient { +public: + + // Called when Socket Stream is opened. + virtual void didOpenStream(WebSocketStreamHandle*, int /* maxPendingSendAllowed */) = 0; + + // Called when |amountSent| bytes are sent. + virtual void didSendData(WebSocketStreamHandle*, int /* amountSent */) = 0; + + // Called when data are received. + virtual void didReceiveData(WebSocketStreamHandle*, const WebData&) = 0; + + // Called when Socket Stream is closed. + virtual void didClose(WebSocketStreamHandle*) = 0; + + // Called when Socket Stream has an error. + virtual void didFail(WebSocketStreamHandle*, const WebSocketStreamError&) = 0; + + // FIXME: auth challenge for proxy +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebString.h b/Source/WebKit/chromium/public/platform/WebString.h new file mode 100644 index 000000000..d8f4fe21a --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebString.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "../../../../Platform/chromium/public/WebString.h" + diff --git a/Source/WebKit/chromium/public/platform/WebThread.h b/Source/WebKit/chromium/public/platform/WebThread.h new file mode 100644 index 000000000..a7b372fee --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebThread.h @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef WebThread_h +#define WebThread_h + +#include "WebCommon.h" + +namespace WebKit { + +#define WEBTHREAD_HAS_LONGLONG_CHANGE + +// Provides an interface to an embedder-defined thread implementation. +// +// Deleting the thread blocks until all pending, non-delayed tasks have been +// run. +class WebThread { +public: + class Task { + public: + virtual ~Task() { } + virtual void run() = 0; + }; + + class TaskObserver { + public: + virtual ~TaskObserver() { } + virtual void didProcessTask() = 0; + }; + + virtual void postTask(Task*) = 0; + virtual void postDelayedTask(Task*, long long delayMs) = 0; + virtual void addTaskObserver(TaskObserver*) { } + virtual void removeTaskObserver(TaskObserver*) { } + + virtual ~WebThread() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebThreadSafeData.h b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h new file mode 100644 index 000000000..19af4df2b --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebThreadSafeData.h @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThreadSafeData_h +#define WebThreadSafeData_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +#if !WEBKIT_IMPLEMENTATION +#include <string> +#endif + +namespace WebCore { class RawData; } + +namespace WebKit { + +// A container for raw bytes. It is inexpensive to copy a WebThreadSafeData object. +// It is safe to pass a WebThreadSafeData across threads!!! +class WebThreadSafeData { +public: + WebThreadSafeData() { } + ~WebThreadSafeData() { reset(); } + + WEBKIT_EXPORT void assign(const WebThreadSafeData&); + WEBKIT_EXPORT void reset(); + + WEBKIT_EXPORT size_t size() const; + WEBKIT_EXPORT const char* data() const; + + bool isEmpty() const { return !size(); } + +#if WEBKIT_IMPLEMENTATION + WebThreadSafeData(const WTF::PassRefPtr<WebCore::RawData>&); + WebThreadSafeData& operator=(const WTF::PassRefPtr<WebCore::RawData>&); +#else + operator std::string() const + { + size_t len = size(); + return len ? std::string(data(), len) : std::string(); + } +#endif + +private: + WebPrivatePtr<WebCore::RawData> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURL.h b/Source/WebKit/chromium/public/platform/WebURL.h new file mode 100644 index 000000000..707ba0896 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURL.h @@ -0,0 +1,158 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURL_h +#define WebURL_h + +#include "WebCString.h" +#include <googleurl/src/url_parse.h> + +#if WEBKIT_IMPLEMENTATION +namespace WebCore { class KURL; } +#else +#include <googleurl/src/gurl.h> +#endif + +namespace WebKit { + +class WebURL { +public: + ~WebURL() + { + } + + WebURL() : m_isValid(false) + { + } + + WebURL(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + : m_spec(spec) + , m_parsed(parsed) + , m_isValid(isValid) + { + } + + WebURL(const WebURL& s) + : m_spec(s.m_spec) + , m_parsed(s.m_parsed) + , m_isValid(s.m_isValid) + { + } + + WebURL& operator=(const WebURL& s) + { + m_spec = s.m_spec; + m_parsed = s.m_parsed; + m_isValid = s.m_isValid; + return *this; + } + + void assign(const WebCString& spec, const url_parse::Parsed& parsed, bool isValid) + { + m_spec = spec; + m_parsed = parsed; + m_isValid = isValid; + } + + const WebCString& spec() const + { + return m_spec; + } + + const url_parse::Parsed& parsed() const + { + return m_parsed; + } + + bool isValid() const + { + return m_isValid; + } + + bool isEmpty() const + { + return m_spec.isEmpty(); + } + + bool isNull() const + { + return m_spec.isEmpty(); + } + +#if WEBKIT_IMPLEMENTATION + WebURL(const WebCore::KURL&); + WebURL& operator=(const WebCore::KURL&); + operator WebCore::KURL() const; +#else + WebURL(const GURL& g) + : m_spec(g.possibly_invalid_spec()) + , m_parsed(g.parsed_for_possibly_invalid_spec()) + , m_isValid(g.is_valid()) + { + } + + WebURL& operator=(const GURL& g) + { + m_spec = g.possibly_invalid_spec(); + m_parsed = g.parsed_for_possibly_invalid_spec(); + m_isValid = g.is_valid(); + return *this; + } + + operator GURL() const + { + return isNull() ? GURL() : GURL(m_spec.data(), m_spec.length(), m_parsed, m_isValid); + } +#endif + +private: + WebCString m_spec; // UTF-8 encoded + url_parse::Parsed m_parsed; + bool m_isValid; +}; + +inline bool operator<(const WebURL& a, const WebURL& b) +{ + return a.spec() < b.spec(); +} + +inline bool operator==(const WebURL& a, const WebURL& b) +{ + return !a.spec().compare(b.spec()); +} + +inline bool operator!=(const WebURL& a, const WebURL& b) +{ + return !(a == b); +} + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLError.h b/Source/WebKit/chromium/public/platform/WebURLError.h new file mode 100644 index 000000000..862dbeaa3 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLError.h @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLError_h +#define WebURLError_h + +#include "WebString.h" +#include "WebURL.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceError; } +#endif + +namespace WebKit { + +struct WebURLError { + // A namespace for "reason" to support various layers generating + // resource errors. WebKit does not care about the value of this + // string as it will just be passed via callbacks to the consumer. + WebString domain; + + // A numeric error code detailing the reason for this error. A value + // of 0 means no error. WebKit does not interpret the meaning of other + // values and normally just forwards this error information back to the + // embedder (see for example WebFrameClient). + int reason; + + // A flag showing whether this error should be treated as a cancellation, + // e.g. we do not show console errors for cancellations. + bool isCancellation; + + // The url that failed to load. + WebURL unreachableURL; + + WebURLError() : reason(0), isCancellation(false) { } + +#if defined(WEBKIT_IMPLEMENTATION) + WebURLError(const WebCore::ResourceError&); + WebURLError& operator=(const WebCore::ResourceError&); + operator WebCore::ResourceError() const; +#endif +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h new file mode 100644 index 000000000..839276bfb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoadTiming.h @@ -0,0 +1,108 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoadTiming_h +#define WebURLLoadTiming_h + +#include "WebCommon.h" +#include "WebPrivatePtr.h" + +namespace WebCore { class ResourceLoadTiming; } + +namespace WebKit { +class WebString; + +class WebURLLoadTiming { +public: + ~WebURLLoadTiming() { reset(); } + + WebURLLoadTiming() { } + WebURLLoadTiming(const WebURLLoadTiming& d) { assign(d); } + WebURLLoadTiming& operator=(const WebURLLoadTiming& d) + { + assign(d); + return *this; + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLLoadTiming&); + + bool isNull() const { return m_private.isNull(); } + + WEBKIT_EXPORT double requestTime() const; + WEBKIT_EXPORT void setRequestTime(double); + + WEBKIT_EXPORT int proxyStart() const; + WEBKIT_EXPORT void setProxyStart(int); + + WEBKIT_EXPORT int proxyEnd() const; + WEBKIT_EXPORT void setProxyEnd(int); + + WEBKIT_EXPORT int dnsStart() const; + WEBKIT_EXPORT void setDNSStart(int); + + WEBKIT_EXPORT int dnsEnd() const; + WEBKIT_EXPORT void setDNSEnd(int); + + WEBKIT_EXPORT int connectStart() const; + WEBKIT_EXPORT void setConnectStart(int); + + WEBKIT_EXPORT int connectEnd() const; + WEBKIT_EXPORT void setConnectEnd(int); + + WEBKIT_EXPORT int sendStart() const; + WEBKIT_EXPORT void setSendStart(int); + + WEBKIT_EXPORT int sendEnd() const; + WEBKIT_EXPORT void setSendEnd(int); + + WEBKIT_EXPORT int receiveHeadersEnd() const; + WEBKIT_EXPORT void setReceiveHeadersEnd(int); + + WEBKIT_EXPORT int sslStart() const; + WEBKIT_EXPORT void setSSLStart(int); + + WEBKIT_EXPORT int sslEnd() const; + WEBKIT_EXPORT void setSSLEnd(int); + +#if WEBKIT_IMPLEMENTATION + WebURLLoadTiming(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + WebURLLoadTiming& operator=(const WTF::PassRefPtr<WebCore::ResourceLoadTiming>&); + operator WTF::PassRefPtr<WebCore::ResourceLoadTiming>() const; +#endif + +private: + WebPrivatePtr<WebCore::ResourceLoadTiming> m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoader.h b/Source/WebKit/chromium/public/platform/WebURLLoader.h new file mode 100644 index 000000000..a47b986b9 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoader.h @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2009, 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoader_h +#define WebURLLoader_h + +#include "WebCommon.h" + +namespace WebKit { + +class WebData; +class WebURLLoaderClient; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +class WebURLLoader { +public: + // The WebURLLoader may be deleted in a call to its client. + virtual ~WebURLLoader() {} + + // Load the request synchronously, returning results directly to the + // caller upon completion. There is no mechanism to interrupt a + // synchronous load!! + virtual void loadSynchronously(const WebURLRequest&, + WebURLResponse&, WebURLError&, WebData& data) = 0; + + // Load the request asynchronously, sending notifications to the given + // client. The client will receive no further notifications if the + // loader is disposed before it completes its work. + virtual void loadAsynchronously(const WebURLRequest&, + WebURLLoaderClient*) = 0; + + // Cancels an asynchronous load. This will appear as a load error to + // the client. + virtual void cancel() = 0; + + // Suspends/resumes an asynchronous load. + virtual void setDefersLoading(bool) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h new file mode 100644 index 000000000..3313a9c03 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLLoaderClient.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLLoaderClient_h +#define WebURLLoaderClient_h + +namespace WebKit { + +class WebURLLoader; +class WebURLRequest; +class WebURLResponse; +struct WebURLError; + +class WebURLLoaderClient { +public: + // Called when following a redirect. |newRequest| contains the request + // generated by the redirect. The client may modify |newRequest|. + virtual void willSendRequest( + WebURLLoader*, WebURLRequest& newRequest, const WebURLResponse& redirectResponse) { } + + // Called to report upload progress. The bytes reported correspond to + // the HTTP message body. + virtual void didSendData( + WebURLLoader*, unsigned long long bytesSent, unsigned long long totalBytesToBeSent) { } + + // Called when response headers are received. + virtual void didReceiveResponse(WebURLLoader*, const WebURLResponse&) { } + + // Called when a chunk of response data is downloaded. This is only called + // if WebURLRequest's downloadToFile flag was set to true. + virtual void didDownloadData(WebURLLoader*, int dataLength) { } + + // Called when a chunk of response data is received. + virtual void didReceiveData(WebURLLoader*, const char* data, int dataLength, int encodedDataLength) { } + + // Called when a chunk of renderer-generated metadata is received from the cache. + virtual void didReceiveCachedMetadata(WebURLLoader*, const char* data, int dataLength) { } + + // Called when the load completes successfully. + virtual void didFinishLoading(WebURLLoader*, double finishTime) { } + + // Called when the load completes with an error. + virtual void didFail(WebURLLoader*, const WebURLError&) { } + +protected: + virtual ~WebURLLoaderClient() { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLRequest.h b/Source/WebKit/chromium/public/platform/WebURLRequest.h new file mode 100644 index 000000000..adf2f2e23 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLRequest.h @@ -0,0 +1,199 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLRequest_h +#define WebURLRequest_h + +#include "WebCommon.h" +#include "WebHTTPBody.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceRequest; } +#endif + +namespace WebKit { + +class WebCString; +class WebHTTPBody; +class WebHTTPHeaderVisitor; +class WebString; +class WebURL; +class WebURLRequestPrivate; + +class WebURLRequest { +public: + enum CachePolicy { + UseProtocolCachePolicy, // normal load + ReloadIgnoringCacheData, // reload + ReturnCacheDataElseLoad, // back/forward or encoding change - allow stale data + ReturnCacheDataDontLoad, // results of a post - allow stale data and only use cache + }; + + enum TargetType { + TargetIsMainFrame = 0, + TargetIsSubframe = 1, + TargetIsSubresource = 2, + TargetIsStyleSheet = 3, + TargetIsScript = 4, + TargetIsFontResource = 5, + TargetIsImage = 6, + TargetIsObject = 7, + TargetIsMedia = 8, + TargetIsWorker = 9, + TargetIsSharedWorker = 10, + TargetIsPrefetch = 11, + TargetIsPrerender = 12, + TargetIsFavicon = 13, + TargetIsXHR = 14, + TargetIsTextTrack = 15, + TargetIsUnspecified = 16, + }; + + class ExtraData { + public: + virtual ~ExtraData() { } + }; + + ~WebURLRequest() { reset(); } + + WebURLRequest() : m_private(0) { } + WebURLRequest(const WebURLRequest& r) : m_private(0) { assign(r); } + WebURLRequest& operator=(const WebURLRequest& r) + { + assign(r); + return *this; + } + + explicit WebURLRequest(const WebURL& url) : m_private(0) + { + initialize(); + setURL(url); + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLRequest&); + + WEBKIT_EXPORT bool isNull() const; + + WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + // Used to implement third-party cookie blocking. + WEBKIT_EXPORT WebURL firstPartyForCookies() const; + WEBKIT_EXPORT void setFirstPartyForCookies(const WebURL&); + + WEBKIT_EXPORT bool allowCookies() const; + WEBKIT_EXPORT void setAllowCookies(bool); + + // Controls whether user name, password, and cookies may be sent with the + // request. (If false, this overrides allowCookies.) + WEBKIT_EXPORT bool allowStoredCredentials() const; + WEBKIT_EXPORT void setAllowStoredCredentials(bool); + + WEBKIT_EXPORT CachePolicy cachePolicy() const; + WEBKIT_EXPORT void setCachePolicy(CachePolicy); + + WEBKIT_EXPORT WebString httpMethod() const; + WEBKIT_EXPORT void setHTTPMethod(const WebString&); + + WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const; + WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name); + WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_EXPORT WebHTTPBody httpBody() const; + WEBKIT_EXPORT void setHTTPBody(const WebHTTPBody&); + + // Controls whether upload progress events are generated when a request + // has a body. + WEBKIT_EXPORT bool reportUploadProgress() const; + WEBKIT_EXPORT void setReportUploadProgress(bool); + + // Controls whether load timing info is collected for the request. + WEBKIT_EXPORT bool reportLoadTiming() const; + WEBKIT_EXPORT void setReportLoadTiming(bool); + + // Controls whether actual headers sent and received for request are + // collected and reported. + WEBKIT_EXPORT bool reportRawHeaders() const; + WEBKIT_EXPORT void setReportRawHeaders(bool); + + WEBKIT_EXPORT TargetType targetType() const; + WEBKIT_EXPORT void setTargetType(TargetType); + + // True if the request was user initiated. + WEBKIT_EXPORT bool hasUserGesture() const; + WEBKIT_EXPORT void setHasUserGesture(bool); + + // A consumer controlled value intended to be used to identify the + // requestor. + WEBKIT_EXPORT int requestorID() const; + WEBKIT_EXPORT void setRequestorID(int); + + // A consumer controlled value intended to be used to identify the + // process of the requestor. + WEBKIT_EXPORT int requestorProcessID() const; + WEBKIT_EXPORT void setRequestorProcessID(int); + + // Allows the request to be matched up with its app cache host. + WEBKIT_EXPORT int appCacheHostID() const; + WEBKIT_EXPORT void setAppCacheHostID(int); + + // If true, the response body will be downloaded to a file managed by the + // WebURLLoader. See WebURLResponse::downloadedFilePath. + WEBKIT_EXPORT bool downloadToFile() const; + WEBKIT_EXPORT void setDownloadToFile(bool); + + // Extra data associated with the underlying resource request. Resource + // requests can be copied. If non-null, each copy of a resource requests + // holds a pointer to the extra data, and the extra data pointer will be + // deleted when the last resource request is destroyed. Setting the extra + // data pointer will cause the underlying resource request to be + // dissociated from any existing non-null extra data pointer. + WEBKIT_EXPORT ExtraData* extraData() const; + WEBKIT_EXPORT void setExtraData(ExtraData*); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceRequest& toMutableResourceRequest(); + const WebCore::ResourceRequest& toResourceRequest() const; +#endif + +protected: + void assign(WebURLRequestPrivate*); + +private: + WebURLRequestPrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebURLResponse.h b/Source/WebKit/chromium/public/platform/WebURLResponse.h new file mode 100644 index 000000000..8629b849c --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebURLResponse.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebURLResponse_h +#define WebURLResponse_h + +#include "WebCommon.h" +#include "WebPrivateOwnPtr.h" + +#if defined(WEBKIT_IMPLEMENTATION) +namespace WebCore { class ResourceResponse; } +#endif + +namespace WebKit { + +class WebCString; +class WebHTTPHeaderVisitor; +class WebHTTPLoadInfo; +class WebString; +class WebURL; +class WebURLLoadTiming; +class WebURLResponsePrivate; + +class WebURLResponse { +public: + ~WebURLResponse() { reset(); } + + WebURLResponse() : m_private(0) { } + WebURLResponse(const WebURLResponse& r) : m_private(0) { assign(r); } + WebURLResponse& operator=(const WebURLResponse& r) + { + assign(r); + return *this; + } + + explicit WebURLResponse(const WebURL& url) : m_private(0) + { + initialize(); + setURL(url); + } + + WEBKIT_EXPORT void initialize(); + WEBKIT_EXPORT void reset(); + WEBKIT_EXPORT void assign(const WebURLResponse&); + + WEBKIT_EXPORT bool isNull() const; + + WEBKIT_EXPORT WebURL url() const; + WEBKIT_EXPORT void setURL(const WebURL&); + + WEBKIT_EXPORT unsigned connectionID() const; + WEBKIT_EXPORT void setConnectionID(unsigned); + + WEBKIT_EXPORT bool connectionReused() const; + WEBKIT_EXPORT void setConnectionReused(bool); + + WEBKIT_EXPORT WebURLLoadTiming loadTiming(); + WEBKIT_EXPORT void setLoadTiming(const WebURLLoadTiming&); + + WEBKIT_EXPORT WebHTTPLoadInfo httpLoadInfo(); + WEBKIT_EXPORT void setHTTPLoadInfo(const WebHTTPLoadInfo&); + + WEBKIT_EXPORT double responseTime() const; + WEBKIT_EXPORT void setResponseTime(double); + + WEBKIT_EXPORT WebString mimeType() const; + WEBKIT_EXPORT void setMIMEType(const WebString&); + + WEBKIT_EXPORT long long expectedContentLength() const; + WEBKIT_EXPORT void setExpectedContentLength(long long); + + WEBKIT_EXPORT WebString textEncodingName() const; + WEBKIT_EXPORT void setTextEncodingName(const WebString&); + + WEBKIT_EXPORT WebString suggestedFileName() const; + WEBKIT_EXPORT void setSuggestedFileName(const WebString&); + + WEBKIT_EXPORT int httpStatusCode() const; + WEBKIT_EXPORT void setHTTPStatusCode(int); + + WEBKIT_EXPORT WebString httpStatusText() const; + WEBKIT_EXPORT void setHTTPStatusText(const WebString&); + + WEBKIT_EXPORT WebString httpHeaderField(const WebString& name) const; + WEBKIT_EXPORT void setHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void addHTTPHeaderField(const WebString& name, const WebString& value); + WEBKIT_EXPORT void clearHTTPHeaderField(const WebString& name); + WEBKIT_EXPORT void visitHTTPHeaderFields(WebHTTPHeaderVisitor*) const; + + WEBKIT_EXPORT double lastModifiedDate() const; + WEBKIT_EXPORT void setLastModifiedDate(double); + + WEBKIT_EXPORT long long appCacheID() const; + WEBKIT_EXPORT void setAppCacheID(long long); + + WEBKIT_EXPORT WebURL appCacheManifestURL() const; + WEBKIT_EXPORT void setAppCacheManifestURL(const WebURL&); + + // A consumer controlled value intended to be used to record opaque + // security info related to this request. + WEBKIT_EXPORT WebCString securityInfo() const; + WEBKIT_EXPORT void setSecurityInfo(const WebCString&); + +#if defined(WEBKIT_IMPLEMENTATION) + WebCore::ResourceResponse& toMutableResourceResponse(); + const WebCore::ResourceResponse& toResourceResponse() const; +#endif + + // Flag whether this request was served from the disk cache entry. + WEBKIT_EXPORT bool wasCached() const; + WEBKIT_EXPORT void setWasCached(bool); + + // Flag whether this request was loaded via the SPDY protocol or not. + // SPDY is an experimental web protocol, see http://dev.chromium.org/spdy + WEBKIT_EXPORT bool wasFetchedViaSPDY() const; + WEBKIT_EXPORT void setWasFetchedViaSPDY(bool); + + // Flag whether this request was loaded after the TLS/Next-Protocol-Negotiation was used. + // This is related to SPDY. + WEBKIT_EXPORT bool wasNpnNegotiated() const; + WEBKIT_EXPORT void setWasNpnNegotiated(bool); + + // Flag whether this request was made when "Alternate-Protocol: xxx" + // is present in server's response. + WEBKIT_EXPORT bool wasAlternateProtocolAvailable() const; + WEBKIT_EXPORT void setWasAlternateProtocolAvailable(bool); + + // Flag whether this request was loaded via an explicit proxy (HTTP, SOCKS, etc). + WEBKIT_EXPORT bool wasFetchedViaProxy() const; + WEBKIT_EXPORT void setWasFetchedViaProxy(bool); + + // Flag whether this request is part of a multipart response. + WEBKIT_EXPORT bool isMultipartPayload() const; + WEBKIT_EXPORT void setIsMultipartPayload(bool); + + // This indicates the location of a downloaded response if the + // WebURLRequest had the downloadToFile flag set to true. This file path + // remains valid for the lifetime of the WebURLLoader used to create it. + WEBKIT_EXPORT WebString downloadFilePath() const; + WEBKIT_EXPORT void setDownloadFilePath(const WebString&); + + // Remote IP address of the socket which fetched this resource. + WEBKIT_EXPORT WebString remoteIPAddress() const; + WEBKIT_EXPORT void setRemoteIPAddress(const WebString&); + + // Remote port number of the socket which fetched this resource. + WEBKIT_EXPORT unsigned short remotePort() const; + WEBKIT_EXPORT void setRemotePort(unsigned short); + +protected: + void assign(WebURLResponsePrivate*); + +private: + WebURLResponsePrivate* m_private; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/WebVector.h b/Source/WebKit/chromium/public/platform/WebVector.h new file mode 100644 index 000000000..bb02abcdf --- /dev/null +++ b/Source/WebKit/chromium/public/platform/WebVector.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebVector_h +#define WebVector_h + +#include "WebCommon.h" + +#include <algorithm> + +namespace WebKit { + +// A simple vector class. +// +// Sample usage: +// +// void Foo(WebVector<int>& result) +// { +// WebVector<int> data(10); +// for (size_t i = 0; i < data.size(); ++i) +// data[i] = ... +// result.swap(data); +// } +// +// It is also possible to assign from other types of random access +// containers: +// +// void Foo(const std::vector<std::string>& input) +// { +// WebVector<WebCString> cstrings = input; +// ... +// } +// +template <typename T> +class WebVector { +public: + typedef T ValueType; + + ~WebVector() + { + destroy(); + } + + explicit WebVector(size_t size = 0) + { + initialize(size); + } + + WebVector(const WebVector<T>& other) + { + initializeFrom(other.m_ptr, other.m_size); + } + + template <typename C> + WebVector(const C& other) + { + initializeFrom(other.size() ? &other[0] : 0, other.size()); + } + + WebVector& operator=(const WebVector& other) + { + if (this != &other) + assign(other); + return *this; + } + + template <typename C> + WebVector<T>& operator=(const C& other) + { + if (this != reinterpret_cast<const WebVector<T>*>(&other)) + assign(other); + return *this; + } + + template <typename C> + void assign(const C& other) + { + assign(other.size() ? &other[0] : 0, other.size()); + } + + template <typename U> + void assign(const U* values, size_t size) + { + destroy(); + initializeFrom(values, size); + } + + size_t size() const { return m_size; } + bool isEmpty() const { return !m_size; } + + T& operator[](size_t i) + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } + const T& operator[](size_t i) const + { + WEBKIT_ASSERT(i < m_size); + return m_ptr[i]; + } + + bool contains(const T& value) const + { + for (size_t i = 0; i < m_size; i++) { + if (m_ptr[i] == value) + return true; + } + return false; + } + + T* data() { return m_ptr; } + const T* data() const { return m_ptr; } + + void swap(WebVector<T>& other) + { + std::swap(m_ptr, other.m_ptr); + std::swap(m_size, other.m_size); + } + +private: + void initialize(size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(); + } + } + + template <typename U> + void initializeFrom(const U* values, size_t size) + { + m_size = size; + if (!m_size) + m_ptr = 0; + else { + m_ptr = static_cast<T*>(::operator new(sizeof(T) * m_size)); + for (size_t i = 0; i < m_size; ++i) + new (&m_ptr[i]) T(values[i]); + } + } + + void destroy() + { + for (size_t i = 0; i < m_size; ++i) + m_ptr[i].~T(); + ::operator delete(m_ptr); + } + + T* m_ptr; + size_t m_size; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h new file mode 100644 index 000000000..3f39f195d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/android/WebSandboxSupport.h @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +namespace WebKit { + +// Empty class, as we need it to compile. +class WebSandboxSupport { +public: +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h new file mode 100644 index 000000000..35dd82e8d --- /dev/null +++ b/Source/WebKit/chromium/public/platform/android/WebThemeEngine.h @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + // The UI part which is being accessed. + enum Part { + // ScrollbarTheme parts + PartScrollbarDownArrow, + PartScrollbarLeftArrow, + PartScrollbarRightArrow, + PartScrollbarUpArrow, + PartScrollbarHorizontalThumb, + PartScrollbarVerticalThumb, + PartScrollbarHorizontalTrack, + PartScrollbarVerticalTrack, + + // RenderTheme parts + PartCheckbox, + PartRadio, + PartButton, + PartTextField, + PartMenuList, + PartSliderTrack, + PartSliderThumb, + PartInnerSpinButton, + PartProgressBar + }; + + // The current state of the associated Part. + enum State { + StateDisabled, + StateHover, + StateNormal, + StatePressed, + }; + + // Extra parameters for drawing the PartScrollbarHorizontalTrack and + // PartScrollbarVerticalTrack. + struct ScrollbarTrackExtraParams { + // The bounds of the entire track, as opposed to the part being painted. + int trackX; + int trackY; + int trackWidth; + int trackHeight; + }; + + // Extra parameters for PartCheckbox, PartPushButton and PartRadio. + struct ButtonExtraParams { + bool checked; + bool indeterminate; // Whether the button state is indeterminate. + bool isDefault; // Whether the button is default button. + bool hasBorder; + WebColor backgroundColor; + }; + + // Extra parameters for PartTextField + struct TextFieldExtraParams { + bool isTextArea; + bool isListbox; + WebColor backgroundColor; + }; + + // Extra parameters for PartMenuList + struct MenuListExtraParams { + bool hasBorder; + bool hasBorderRadius; + int arrowX; + int arrowY; + WebColor backgroundColor; + }; + + // Extra parameters for PartSliderTrack and PartSliderThumb + struct SliderExtraParams { + bool vertical; + bool inDrag; + }; + + // Extra parameters for PartInnerSpinButton + struct InnerSpinButtonExtraParams { + bool spinUp; + bool readOnly; + }; + + // Extra parameters for PartProgressBar + struct ProgressBarExtraParams { + bool determinate; + int valueRectX; + int valueRectY; + int valueRectWidth; + int valueRectHeight; + }; + + union ExtraParams { + ScrollbarTrackExtraParams scrollbarTrack; + ButtonExtraParams button; + TextFieldExtraParams textField; + MenuListExtraParams menuList; + SliderExtraParams slider; + InnerSpinButtonExtraParams innerSpin; + ProgressBarExtraParams progressBar; + }; + + // Gets the size of the given theme part. For variable sized items + // like vertical scrollbar thumbs, the width will be the required width of + // the track while the height will be the minimum height. + virtual WebSize getSize(Part) { return WebSize(); } + // Paint the given the given theme part. + virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h new file mode 100644 index 000000000..47f037882 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebFontFamily.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2011 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebFontFamily_h +#define WebFontFamily_h + +#include "../WebCString.h" +#include "../WebCommon.h" + +namespace WebKit { + +struct WebFontFamily { + WebCString name; + bool isBold; + bool isItalic; +}; + +} // namespace WebKit + +#endif // WebFontFamily_h diff --git a/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h new file mode 100644 index 000000000..154505662 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebSandboxSupport.h @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +#include "../WebCommon.h" +#include "../WebString.h" +#include "WebFontFamily.h" + +namespace WebKit { + +struct WebFontRenderStyle; + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Fonts --------------------------------------------------------------- + + // Get a font family which contains glyphs for the given Unicode + // code-points. + // characters: a UTF-16 encoded string + // numCharacters: the number of 16-bit words in |characters| + // preferredLocale: preferred locale identifier for the |characters| + // (e.g. "en", "ja", "zh-CN") + // + // Returns a string with the font family on an empty string if the + // request cannot be satisfied. + // Returns a WebFontFamily instance with the font name. The instance has empty font name if the request cannot be satisfied. + // FIXME: Make this to be a pure virtual function after transition. + virtual void getFontFamilyForCharacters(const WebUChar* characters, size_t numCharacters, const char* preferredLocale, WebFontFamily*) = 0; + + virtual void getRenderStyleForStrike(const char* family, int sizeAndStyle, WebFontRenderStyle* style) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h new file mode 100644 index 000000000..f84f292d7 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/linux/WebThemeEngine.h @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + // The UI part which is being accessed. + enum Part { + // ScrollbarTheme parts + PartScrollbarDownArrow, + PartScrollbarLeftArrow, + PartScrollbarRightArrow, + PartScrollbarUpArrow, + PartScrollbarHorizontalThumb, + PartScrollbarVerticalThumb, + PartScrollbarHorizontalTrack, + PartScrollbarVerticalTrack, + + // RenderTheme parts + PartCheckbox, + PartRadio, + PartButton, + PartTextField, + PartMenuList, + PartSliderTrack, + PartSliderThumb, + PartInnerSpinButton, + PartProgressBar + }; + + // The current state of the associated Part. + enum State { + StateDisabled, + StateHover, + StateNormal, + StatePressed, + }; + + // Extra parameters for drawing the PartScrollbarHorizontalTrack and + // PartScrollbarVerticalTrack. + struct ScrollbarTrackExtraParams { + // The bounds of the entire track, as opposed to the part being painted. + int trackX; + int trackY; + int trackWidth; + int trackHeight; + }; + + // Extra parameters for PartCheckbox, PartPushButton and PartRadio. + struct ButtonExtraParams { + bool checked; + bool indeterminate; // Whether the button state is indeterminate. + bool isDefault; // Whether the button is default button. + bool hasBorder; + WebColor backgroundColor; + }; + + // Extra parameters for PartTextField + struct TextFieldExtraParams { + bool isTextArea; + bool isListbox; + WebColor backgroundColor; + }; + + // Extra parameters for PartMenuList + struct MenuListExtraParams { + bool hasBorder; + bool hasBorderRadius; + int arrowX; + int arrowY; + WebColor backgroundColor; + }; + + // Extra parameters for PartSliderTrack and PartSliderThumb + struct SliderExtraParams { + bool vertical; + bool inDrag; + }; + + // Extra parameters for PartInnerSpinButton + struct InnerSpinButtonExtraParams { + bool spinUp; + bool readOnly; + }; + + // Extra parameters for PartProgressBar + struct ProgressBarExtraParams { + bool determinate; + int valueRectX; + int valueRectY; + int valueRectWidth; + int valueRectHeight; + }; + + union ExtraParams { + ScrollbarTrackExtraParams scrollbarTrack; + ButtonExtraParams button; + TextFieldExtraParams textField; + MenuListExtraParams menuList; + SliderExtraParams slider; + InnerSpinButtonExtraParams innerSpin; + ProgressBarExtraParams progressBar; + }; + + // Gets the size of the given theme part. For variable sized items + // like vertical scrollbar thumbs, the width will be the required width of + // the track while the height will be the minimum height. + virtual WebSize getSize(Part) { return WebSize(); } + // Paint the given the given theme part. + virtual void paint(WebCanvas*, Part, State, const WebRect&, const ExtraParams*) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h new file mode 100644 index 000000000..34280c6eb --- /dev/null +++ b/Source/WebKit/chromium/public/platform/mac/WebSandboxSupport.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct CGFont* CGFontRef; + +#ifdef __OBJC__ +@class NSFont; +#else +class NSFont; +#endif + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Given an input font - |srcFont| [which can't be loaded due to sandbox + // restrictions]. Return a font belonging to an equivalent font file + // that can be used to access the font and a unique identifier corresponding + // to the on-disk font file. + // + // If this function succeeds, the caller assumes ownership of the |out| + // parameter and must call CGFontRelease() to unload it when done. + // + // Returns: true on success, false on error. + virtual bool loadFont(NSFont* srcFont, CGFontRef* out, uint32_t* fontID) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h new file mode 100644 index 000000000..c7857022f --- /dev/null +++ b/Source/WebKit/chromium/public/platform/mac/WebThemeEngine.h @@ -0,0 +1,78 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" + +namespace WebKit { + +struct WebRect; + +class WebThemeEngine { +public: + enum State { + StateDisabled, + StateInactive, + StateActive, + StatePressed, + }; + + enum Size { + SizeRegular, + SizeSmall, + }; + + enum ScrollbarOrientation { + ScrollbarOrientationHorizontal, + ScrollbarOrientationVertical, + }; + + enum ScrollbarParent { + ScrollbarParentScrollView, + ScrollbarParentRenderLayer, + }; + + struct ScrollbarInfo { + ScrollbarOrientation orientation; + ScrollbarParent parent; + int maxValue; + int currentValue; + int visibleSize; + int totalSize; + }; + + virtual void paintScrollbarThumb(WebCanvas*, State, Size, const WebRect&, const ScrollbarInfo&) { } +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h new file mode 100644 index 000000000..3522c7284 --- /dev/null +++ b/Source/WebKit/chromium/public/platform/win/WebSandboxSupport.h @@ -0,0 +1,52 @@ +/* + * Copyright (C) 2009 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebSandboxSupport_h +#define WebSandboxSupport_h + +typedef struct HFONT__* HFONT; + +namespace WebKit { + +// Put methods here that are required due to sandbox restrictions. +class WebSandboxSupport { +public: + // Sometimes a Win32 API call will fail because a font is not loaded, + // and due to sandbox restrictions, the current process may be unable + // to access the filesystem to load the font. So, this call serves as + // a failover to ask the embedder to try some other way to load the + // font (usually by delegating to an empowered process to have it load + // the font). Returns true if the font was successfully loaded. + virtual bool ensureFontLoaded(HFONT) = 0; +}; + +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h b/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h new file mode 100644 index 000000000..1890db6ea --- /dev/null +++ b/Source/WebKit/chromium/public/platform/win/WebThemeEngine.h @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2010 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WebThemeEngine_h +#define WebThemeEngine_h + +#include "../WebCanvas.h" +#include "../WebColor.h" +#include "../WebSize.h" + +namespace WebKit { + +struct WebRect; +struct WebSize; + +class WebThemeEngine { +public: +// The part and state parameters correspond to values defined by the +// Windows Theme API (see +// http://msdn.microsoft.com/en-us/library/bb773187(VS.85).aspx ). +// The classicState parameter corresponds to the uState +// parameter of the Windows DrawFrameControl() function. +// See the definitions in <vsstyle.h> and <winuser.h>. + virtual void paintButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintMenuList( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarArrow( + WebCanvas*, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarThumb( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintScrollbarTrack( + WebCanvas*, int part, int state, int classicState, + const WebRect&, const WebRect& alignRect) = 0; + + virtual void paintSpinButton( + WebCanvas*, int part, int state, int classicState, + const WebRect&) {} + + virtual void paintTextField( + WebCanvas*, int part, int state, int classicState, + const WebRect&, WebColor, bool fillContentArea, bool drawEdges) = 0; + + virtual void paintTrackbar( + WebCanvas*, int part, int state, int classicState, + const WebRect&) = 0; + + virtual void paintProgressBar( + WebCanvas*, const WebRect& barRect, const WebRect& valueRect, + bool determinate, double animatedSeconds) {} +}; + +} // namespace WebKit + +#endif |
