[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
eric at webkit.org
eric at webkit.org
Wed Apr 7 23:28:32 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 34b114c91b41db89c56bdd0ee45e1a309f9fba60
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 10 08:16:46 2009 +0000
2009-11-10 Yaar Schnitman <yaar at chromium.org>
Reviewed by Dimitri Glazkov.
Up-streaming Chromium API src files: WebScriptController...WebStorageNamespaceImpl
https://bugs.webkit.org/show_bug.cgi?id=31276
* src/WebScriptController.cpp: Added.
(WebKit::WebScriptController::registerExtension):
(WebKit::WebScriptController::enableV8SingleThreadMode):
(WebKit::WebScriptController::flushConsoleMessages):
* src/WebSearchableFormData.cpp: Added.
(WebCore::GetFormEncoding):
(WebCore::IsHTTPFormSubmit):
(WebCore::GetButtonToActivate):
(WebCore::IsSelectInDefaultState):
(WebCore::IsInDefaultState):
(WebCore::HasSuitableTextElement):
(WebKit::WebSearchableFormData::WebSearchableFormData):
* src/WebSecurityOrigin.cpp: Added.
(WebKit::WebSecurityOrigin::reset):
(WebKit::WebSecurityOrigin::assign):
(WebKit::WebSecurityOrigin::protocol):
(WebKit::WebSecurityOrigin::host):
(WebKit::WebSecurityOrigin::port):
(WebKit::WebSecurityOrigin::isEmpty):
(WebKit::WebSecurityOrigin::toString):
(WebKit::WebSecurityOrigin::databaseIdentifier):
(WebKit::WebSecurityOrigin::WebSecurityOrigin):
(WebKit::WebSecurityOrigin::operator=):
(WebKit::WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>):
* src/WebSecurityPolicy.cpp: Added.
(WebKit::WebSecurityPolicy::registerURLSchemeAsLocal):
(WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess):
(WebKit::WebSecurityPolicy::whiteListAccessFromOrigin):
(WebKit::WebSecurityPolicy::resetOriginAccessWhiteLists):
* src/WebSettingsImpl.cpp: Added.
(WebKit::WebSettingsImpl::WebSettingsImpl):
(WebKit::WebSettingsImpl::setStandardFontFamily):
(WebKit::WebSettingsImpl::setFixedFontFamily):
(WebKit::WebSettingsImpl::setSerifFontFamily):
(WebKit::WebSettingsImpl::setSansSerifFontFamily):
(WebKit::WebSettingsImpl::setCursiveFontFamily):
(WebKit::WebSettingsImpl::setFantasyFontFamily):
(WebKit::WebSettingsImpl::setDefaultFontSize):
(WebKit::WebSettingsImpl::setDefaultFixedFontSize):
(WebKit::WebSettingsImpl::setMinimumFontSize):
(WebKit::WebSettingsImpl::setMinimumLogicalFontSize):
(WebKit::WebSettingsImpl::setDefaultTextEncodingName):
(WebKit::WebSettingsImpl::setJavaScriptEnabled):
(WebKit::WebSettingsImpl::setWebSecurityEnabled):
(WebKit::WebSettingsImpl::setJavaScriptCanOpenWindowsAutomatically):
(WebKit::WebSettingsImpl::setLoadsImagesAutomatically):
(WebKit::WebSettingsImpl::setPluginsEnabled):
(WebKit::WebSettingsImpl::setDOMPasteAllowed):
(WebKit::WebSettingsImpl::setDeveloperExtrasEnabled):
(WebKit::WebSettingsImpl::setShrinksStandaloneImagesToFit):
(WebKit::WebSettingsImpl::setUsesEncodingDetector):
(WebKit::WebSettingsImpl::setTextAreasAreResizable):
(WebKit::WebSettingsImpl::setJavaEnabled):
(WebKit::WebSettingsImpl::setAllowScriptsToCloseWindows):
(WebKit::WebSettingsImpl::setUserStyleSheetLocation):
(WebKit::WebSettingsImpl::setUsesPageCache):
(WebKit::WebSettingsImpl::setDownloadableBinaryFontsEnabled):
(WebKit::WebSettingsImpl::setXSSAuditorEnabled):
(WebKit::WebSettingsImpl::setLocalStorageEnabled):
(WebKit::WebSettingsImpl::setEditableLinkBehaviorNeverLive):
(WebKit::WebSettingsImpl::setFontRenderingModeNormal):
(WebKit::WebSettingsImpl::setShouldPaintCustomScrollbars):
(WebKit::WebSettingsImpl::setDatabasesEnabled):
(WebKit::WebSettingsImpl::setAllowUniversalAccessFromFileURLs):
(WebKit::WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded):
(WebKit::WebSettingsImpl::setOfflineWebApplicationCacheEnabled):
(WebKit::WebSettingsImpl::setExperimentalWebGLEnabled):
* src/WebSettingsImpl.h: Added.
(WebKit::WebSettingsImpl::~WebSettingsImpl):
* src/WebSharedWorkerImpl.cpp: Added.
(WebKit::WebSharedWorkerImpl::WebSharedWorkerImpl):
(WebKit::WebSharedWorkerImpl::~WebSharedWorkerImpl):
(WebKit::WebSharedWorkerImpl::isStarted):
(WebKit::WebSharedWorkerImpl::connect):
(WebKit::WebSharedWorkerImpl::connectTask):
(WebKit::WebSharedWorkerImpl::startWorkerContext):
(WebKit::WebSharedWorkerImpl::terminateWorkerContext):
(WebKit::WebSharedWorkerImpl::clientDestroyed):
(WebKit::WebSharedWorkerImpl::client):
(WebKit::WebSharedWorker::create):
* src/WebSharedWorkerImpl.h: Added.
(WebKit::WebSharedWorkerImpl::commonClient):
* src/WebStorageAreaImpl.cpp: Added.
(WebKit::WebStorageAreaImpl::WebStorageAreaImpl):
(WebKit::WebStorageAreaImpl::~WebStorageAreaImpl):
(WebKit::WebStorageAreaImpl::length):
(WebKit::WebStorageAreaImpl::key):
(WebKit::WebStorageAreaImpl::getItem):
(WebKit::WebStorageAreaImpl::setItem):
(WebKit::WebStorageAreaImpl::removeItem):
(WebKit::WebStorageAreaImpl::clear):
* src/WebStorageAreaImpl.h: Added.
(WebKit::WebStorageAreaImpl::currentStorageEventURL):
(WebKit::WebStorageAreaImpl::ScopedStorageEventURL::ScopedStorageEventURL):
(WebKit::WebStorageAreaImpl::ScopedStorageEventURL::~ScopedStorageEventURL):
* src/WebStorageEventDispatcherImpl.cpp: Added.
(WebKit::WebStorageEventDispatcher::create):
(WebKit::WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl):
(WebKit::WebStorageEventDispatcherImpl::dispatchStorageEvent):
* src/WebStorageEventDispatcherImpl.h: Added.
* src/WebStorageNamespaceImpl.cpp: Added.
(WebKit::WebStorageNamespace::createLocalStorageNamespace):
(WebKit::WebStorageNamespace::createSessionStorageNamespace):
(WebKit::WebStorageNamespaceImpl::WebStorageNamespaceImpl):
(WebKit::WebStorageNamespaceImpl::~WebStorageNamespaceImpl):
(WebKit::WebStorageNamespaceImpl::createStorageArea):
(WebKit::WebStorageNamespaceImpl::copy):
(WebKit::WebStorageNamespaceImpl::close):
* src/WebStorageNamespaceImpl.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50723 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index 8536713..7722231 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -2,6 +2,124 @@
Reviewed by Dimitri Glazkov.
+ Up-streaming Chromium API src files: WebScriptController...WebStorageNamespaceImpl
+
+ https://bugs.webkit.org/show_bug.cgi?id=31276
+
+ * src/WebScriptController.cpp: Added.
+ (WebKit::WebScriptController::registerExtension):
+ (WebKit::WebScriptController::enableV8SingleThreadMode):
+ (WebKit::WebScriptController::flushConsoleMessages):
+ * src/WebSearchableFormData.cpp: Added.
+ (WebCore::GetFormEncoding):
+ (WebCore::IsHTTPFormSubmit):
+ (WebCore::GetButtonToActivate):
+ (WebCore::IsSelectInDefaultState):
+ (WebCore::IsInDefaultState):
+ (WebCore::HasSuitableTextElement):
+ (WebKit::WebSearchableFormData::WebSearchableFormData):
+ * src/WebSecurityOrigin.cpp: Added.
+ (WebKit::WebSecurityOrigin::reset):
+ (WebKit::WebSecurityOrigin::assign):
+ (WebKit::WebSecurityOrigin::protocol):
+ (WebKit::WebSecurityOrigin::host):
+ (WebKit::WebSecurityOrigin::port):
+ (WebKit::WebSecurityOrigin::isEmpty):
+ (WebKit::WebSecurityOrigin::toString):
+ (WebKit::WebSecurityOrigin::databaseIdentifier):
+ (WebKit::WebSecurityOrigin::WebSecurityOrigin):
+ (WebKit::WebSecurityOrigin::operator=):
+ (WebKit::WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>):
+ * src/WebSecurityPolicy.cpp: Added.
+ (WebKit::WebSecurityPolicy::registerURLSchemeAsLocal):
+ (WebKit::WebSecurityPolicy::registerURLSchemeAsNoAccess):
+ (WebKit::WebSecurityPolicy::whiteListAccessFromOrigin):
+ (WebKit::WebSecurityPolicy::resetOriginAccessWhiteLists):
+ * src/WebSettingsImpl.cpp: Added.
+ (WebKit::WebSettingsImpl::WebSettingsImpl):
+ (WebKit::WebSettingsImpl::setStandardFontFamily):
+ (WebKit::WebSettingsImpl::setFixedFontFamily):
+ (WebKit::WebSettingsImpl::setSerifFontFamily):
+ (WebKit::WebSettingsImpl::setSansSerifFontFamily):
+ (WebKit::WebSettingsImpl::setCursiveFontFamily):
+ (WebKit::WebSettingsImpl::setFantasyFontFamily):
+ (WebKit::WebSettingsImpl::setDefaultFontSize):
+ (WebKit::WebSettingsImpl::setDefaultFixedFontSize):
+ (WebKit::WebSettingsImpl::setMinimumFontSize):
+ (WebKit::WebSettingsImpl::setMinimumLogicalFontSize):
+ (WebKit::WebSettingsImpl::setDefaultTextEncodingName):
+ (WebKit::WebSettingsImpl::setJavaScriptEnabled):
+ (WebKit::WebSettingsImpl::setWebSecurityEnabled):
+ (WebKit::WebSettingsImpl::setJavaScriptCanOpenWindowsAutomatically):
+ (WebKit::WebSettingsImpl::setLoadsImagesAutomatically):
+ (WebKit::WebSettingsImpl::setPluginsEnabled):
+ (WebKit::WebSettingsImpl::setDOMPasteAllowed):
+ (WebKit::WebSettingsImpl::setDeveloperExtrasEnabled):
+ (WebKit::WebSettingsImpl::setShrinksStandaloneImagesToFit):
+ (WebKit::WebSettingsImpl::setUsesEncodingDetector):
+ (WebKit::WebSettingsImpl::setTextAreasAreResizable):
+ (WebKit::WebSettingsImpl::setJavaEnabled):
+ (WebKit::WebSettingsImpl::setAllowScriptsToCloseWindows):
+ (WebKit::WebSettingsImpl::setUserStyleSheetLocation):
+ (WebKit::WebSettingsImpl::setUsesPageCache):
+ (WebKit::WebSettingsImpl::setDownloadableBinaryFontsEnabled):
+ (WebKit::WebSettingsImpl::setXSSAuditorEnabled):
+ (WebKit::WebSettingsImpl::setLocalStorageEnabled):
+ (WebKit::WebSettingsImpl::setEditableLinkBehaviorNeverLive):
+ (WebKit::WebSettingsImpl::setFontRenderingModeNormal):
+ (WebKit::WebSettingsImpl::setShouldPaintCustomScrollbars):
+ (WebKit::WebSettingsImpl::setDatabasesEnabled):
+ (WebKit::WebSettingsImpl::setAllowUniversalAccessFromFileURLs):
+ (WebKit::WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded):
+ (WebKit::WebSettingsImpl::setOfflineWebApplicationCacheEnabled):
+ (WebKit::WebSettingsImpl::setExperimentalWebGLEnabled):
+ * src/WebSettingsImpl.h: Added.
+ (WebKit::WebSettingsImpl::~WebSettingsImpl):
+ * src/WebSharedWorkerImpl.cpp: Added.
+ (WebKit::WebSharedWorkerImpl::WebSharedWorkerImpl):
+ (WebKit::WebSharedWorkerImpl::~WebSharedWorkerImpl):
+ (WebKit::WebSharedWorkerImpl::isStarted):
+ (WebKit::WebSharedWorkerImpl::connect):
+ (WebKit::WebSharedWorkerImpl::connectTask):
+ (WebKit::WebSharedWorkerImpl::startWorkerContext):
+ (WebKit::WebSharedWorkerImpl::terminateWorkerContext):
+ (WebKit::WebSharedWorkerImpl::clientDestroyed):
+ (WebKit::WebSharedWorkerImpl::client):
+ (WebKit::WebSharedWorker::create):
+ * src/WebSharedWorkerImpl.h: Added.
+ (WebKit::WebSharedWorkerImpl::commonClient):
+ * src/WebStorageAreaImpl.cpp: Added.
+ (WebKit::WebStorageAreaImpl::WebStorageAreaImpl):
+ (WebKit::WebStorageAreaImpl::~WebStorageAreaImpl):
+ (WebKit::WebStorageAreaImpl::length):
+ (WebKit::WebStorageAreaImpl::key):
+ (WebKit::WebStorageAreaImpl::getItem):
+ (WebKit::WebStorageAreaImpl::setItem):
+ (WebKit::WebStorageAreaImpl::removeItem):
+ (WebKit::WebStorageAreaImpl::clear):
+ * src/WebStorageAreaImpl.h: Added.
+ (WebKit::WebStorageAreaImpl::currentStorageEventURL):
+ (WebKit::WebStorageAreaImpl::ScopedStorageEventURL::ScopedStorageEventURL):
+ (WebKit::WebStorageAreaImpl::ScopedStorageEventURL::~ScopedStorageEventURL):
+ * src/WebStorageEventDispatcherImpl.cpp: Added.
+ (WebKit::WebStorageEventDispatcher::create):
+ (WebKit::WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl):
+ (WebKit::WebStorageEventDispatcherImpl::dispatchStorageEvent):
+ * src/WebStorageEventDispatcherImpl.h: Added.
+ * src/WebStorageNamespaceImpl.cpp: Added.
+ (WebKit::WebStorageNamespace::createLocalStorageNamespace):
+ (WebKit::WebStorageNamespace::createSessionStorageNamespace):
+ (WebKit::WebStorageNamespaceImpl::WebStorageNamespaceImpl):
+ (WebKit::WebStorageNamespaceImpl::~WebStorageNamespaceImpl):
+ (WebKit::WebStorageNamespaceImpl::createStorageArea):
+ (WebKit::WebStorageNamespaceImpl::copy):
+ (WebKit::WebStorageNamespaceImpl::close):
+ * src/WebStorageNamespaceImpl.h: Added.
+
+2009-11-10 Yaar Schnitman <yaar at chromium.org>
+
+ Reviewed by Dimitri Glazkov.
+
Up-streaming Chromium API src files: WebPasswordFormData...WebRuntimeFeatures
https://bugs.webkit.org/show_bug.cgi?id=31276
diff --git a/WebKit/chromium/src/WebScriptController.cpp b/WebKit/chromium/src/WebScriptController.cpp
new file mode 100644
index 0000000..06f47e6
--- /dev/null
+++ b/WebKit/chromium/src/WebScriptController.cpp
@@ -0,0 +1,70 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebScriptController.h"
+
+#include "V8Binding.h"
+#include "V8Proxy.h"
+
+#include "WebString.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebScriptController::registerExtension(v8::Extension* extension)
+{
+ V8Proxy::registerExtension(extension, WebString());
+}
+
+void WebScriptController::registerExtension(v8::Extension* extension,
+ const WebString& schemeRestriction)
+{
+ V8Proxy::registerExtension(extension, schemeRestriction);
+}
+
+void WebScriptController::registerExtension(v8::Extension* extension,
+ int extensionGroup)
+{
+ V8Proxy::registerExtension(extension, extensionGroup);
+}
+
+void WebScriptController::enableV8SingleThreadMode()
+{
+ enableStringImplCache();
+}
+
+void WebScriptController::flushConsoleMessages()
+{
+ WebCore::V8Proxy::processConsoleMessages();
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSearchableFormData.cpp b/WebKit/chromium/src/WebSearchableFormData.cpp
new file mode 100644
index 0000000..eddaffe
--- /dev/null
+++ b/WebKit/chromium/src/WebSearchableFormData.cpp
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (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 "config.h"
+#include "WebSearchableFormData.h"
+
+#include "Document.h"
+#include "FormDataBuilder.h"
+#include "FormDataList.h"
+#include "Frame.h"
+#include "HTMLFormControlElement.h"
+#include "HTMLFormElement.h"
+#include "HTMLInputElement.h"
+#include "HTMLNames.h"
+#include "HTMLOptionElement.h"
+#include "HTMLOptionsCollection.h"
+#include "HTMLSelectElement.h"
+#include "TextEncoding.h"
+#include "WebFormElement.h"
+
+using namespace WebCore;
+
+namespace {
+
+// Gets the encoding for the form.
+void GetFormEncoding(const HTMLFormElement* form, TextEncoding* encoding)
+{
+ String str(form->getAttribute(HTMLNames::accept_charsetAttr));
+ str.replace(',', ' ');
+ Vector<String> charsets;
+ str.split(' ', charsets);
+ for (Vector<String>::const_iterator i(charsets.begin()); i != charsets.end(); ++i) {
+ *encoding = TextEncoding(*i);
+ if (encoding->isValid())
+ return;
+ }
+ const Frame* frame = form->document()->frame();
+ *encoding = frame ? TextEncoding(frame->loader()->encoding()) : Latin1Encoding();
+}
+
+// Returns true if the submit request results in an HTTP URL.
+bool IsHTTPFormSubmit(const HTMLFormElement* form)
+{
+ String action(form->action());
+ return form->document()->frame()->loader()->completeURL(action.isNull() ? "" : action).protocol() == "http";
+}
+
+// If the form does not have an activated submit button, the first submit
+// button is returned.
+HTMLFormControlElement* GetButtonToActivate(HTMLFormElement* form)
+{
+ HTMLFormControlElement* firstSubmitButton = 0;
+ for (Vector<HTMLFormControlElement*>::const_iterator i(form->formElements.begin()); i != form->formElements.end(); ++i) {
+ HTMLFormControlElement* formElement = *i;
+ if (formElement->isActivatedSubmit())
+ // There's a button that is already activated for submit, return 0.
+ return 0;
+ if (!firstSubmitButton && formElement->isSuccessfulSubmitButton())
+ firstSubmitButton = formElement;
+ }
+ return firstSubmitButton;
+}
+
+// Returns true if the selected state of all the options matches the default
+// selected state.
+bool IsSelectInDefaultState(const HTMLSelectElement* select)
+{
+ const Vector<Element*>& listItems = select->listItems();
+ if (select->multiple() || select->size() > 1) {
+ for (Vector<Element*>::const_iterator i(listItems.begin()); i != listItems.end(); ++i) {
+ if (!(*i)->hasLocalName(HTMLNames::optionTag))
+ continue;
+ const HTMLOptionElement* optionElement = static_cast<const HTMLOptionElement*>(*i);
+ if (optionElement->selected() != optionElement->defaultSelected())
+ return false;
+ }
+ return true;
+ }
+
+ // The select is rendered as a combobox (called menulist in WebKit). At
+ // least one item is selected, determine which one.
+ const HTMLOptionElement* initialSelected = 0;
+ for (Vector<Element*>::const_iterator i(listItems.begin()); i != listItems.end(); ++i) {
+ if (!(*i)->hasLocalName(HTMLNames::optionTag))
+ continue;
+ const HTMLOptionElement* optionElement = static_cast<const HTMLOptionElement*>(*i);
+ if (optionElement->defaultSelected()) {
+ // The page specified the option to select.
+ initialSelected = optionElement;
+ break;
+ }
+ if (!initialSelected)
+ initialSelected = optionElement;
+ }
+ return initialSelected ? initialSelected->selected() : true;
+}
+
+// Returns true if the form element is in its default state, false otherwise.
+// The default state is the state of the form element on initial load of the
+// page, and varies depending upon the form element. For example, a checkbox is
+// in its default state if the checked state matches the defaultChecked state.
+bool IsInDefaultState(const HTMLFormControlElement* formElement)
+{
+ if (formElement->hasTagName(HTMLNames::inputTag)) {
+ const HTMLInputElement* inputElement = static_cast<const HTMLInputElement*>(formElement);
+ if (inputElement->inputType() == HTMLInputElement::CHECKBOX || inputElement->inputType() == HTMLInputElement::RADIO)
+ return inputElement->checked() == inputElement->defaultChecked();
+ } else if (formElement->hasTagName(HTMLNames::selectTag))
+ return IsSelectInDefaultState(static_cast<const HTMLSelectElement*>(formElement));
+ return true;
+}
+
+// If form has only one text input element, return true. If a valid input
+// element is not found, return false. Additionally, the form data for all
+// elements is added to enc_string and the encoding used is set in
+// encoding_name.
+bool HasSuitableTextElement(const HTMLFormElement* form, Vector<char>* encodedString, String* encodingName)
+{
+ TextEncoding encoding;
+ GetFormEncoding(form, &encoding);
+ if (!encoding.isValid()) {
+ // Need a valid encoding to encode the form elements.
+ // If the encoding isn't found webkit ends up replacing the params with
+ // empty strings. So, we don't try to do anything here.
+ return 0;
+ }
+ *encodingName = encoding.name();
+
+ HTMLInputElement* textElement = 0;
+ for (Vector<HTMLFormControlElement*>::const_iterator i(form->formElements.begin()); i != form->formElements.end(); ++i) {
+ HTMLFormControlElement* formElement = *i;
+ if (formElement->disabled() || formElement->name().isNull())
+ continue;
+
+ if (!IsInDefaultState(formElement) || formElement->hasTagName(HTMLNames::textareaTag))
+ return 0;
+
+ bool isTextElement = false;
+ if (formElement->hasTagName(HTMLNames::inputTag)) {
+ switch (static_cast<const HTMLInputElement*>(formElement)->inputType()) {
+ case HTMLInputElement::TEXT:
+ case HTMLInputElement::ISINDEX:
+ isTextElement = true;
+ break;
+ case HTMLInputElement::PASSWORD:
+ // Don't store passwords! This is most likely an https anyway.
+ // Fall through.
+ case HTMLInputElement::FILE:
+ // Too big, don't try to index this.
+ return 0;
+ default:
+ // All other input types are indexable.
+ break;
+ }
+ }
+
+ FormDataList dataList(encoding);
+ if (!formElement->appendFormData(dataList, false))
+ continue;
+
+ const Vector<FormDataList::Item>& itemList = dataList.list();
+ if (isTextElement && !itemList.isEmpty()) {
+ if (textElement) {
+ // The auto-complete bar only knows how to fill in one value.
+ // This form has multiple fields; don't treat it as searchable.
+ return false;
+ }
+ textElement = static_cast<HTMLInputElement*>(formElement);
+ }
+ for (Vector<FormDataList::Item>::const_iterator j(itemList.begin()); j != itemList.end(); ++j) {
+ // Handle ISINDEX / <input name=isindex> specially, but only if it's
+ // the first entry.
+ if (!encodedString->isEmpty() || j->data() != "isindex") {
+ if (!encodedString->isEmpty())
+ encodedString->append('&');
+ FormDataBuilder::encodeStringAsFormData(*encodedString, j->data());
+ encodedString->append('=');
+ }
+ ++j;
+ if (formElement == textElement)
+ encodedString->append("{searchTerms}", 13);
+ else
+ FormDataBuilder::encodeStringAsFormData(*encodedString, j->data());
+ }
+ }
+
+ return textElement;
+}
+
+} // namespace
+
+namespace WebKit {
+
+WebSearchableFormData::WebSearchableFormData(const WebFormElement& form)
+{
+ RefPtr<HTMLFormElement> formElement = form.operator PassRefPtr<HTMLFormElement>();
+ const Frame* frame = formElement->document()->frame();
+ if (!frame)
+ return;
+
+ // Only consider forms that GET data and the action targets an http page.
+ if (equalIgnoringCase(formElement->getAttribute(HTMLNames::methodAttr), "post") || !IsHTTPFormSubmit(formElement.get()))
+ return;
+
+ HTMLFormControlElement* firstSubmitButton = GetButtonToActivate(formElement.get());
+ if (firstSubmitButton) {
+ // The form does not have an active submit button, make the first button
+ // active. We need to do this, otherwise the URL will not contain the
+ // name of the submit button.
+ firstSubmitButton->setActivatedSubmit(true);
+ }
+ Vector<char> encodedString;
+ String encoding;
+ bool hasElement = HasSuitableTextElement(formElement.get(), &encodedString, &encoding);
+ if (firstSubmitButton)
+ firstSubmitButton->setActivatedSubmit(false);
+ if (!hasElement) {
+ // Not a searchable form.
+ return;
+ }
+
+ String action(formElement->action());
+ KURL url(frame->loader()->completeURL(action.isNull() ? "" : action));
+ RefPtr<FormData> formData = FormData::create(encodedString);
+ url.setQuery(formData->flattenToString());
+ m_url = url;
+ m_encoding = encoding;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSecurityOrigin.cpp b/WebKit/chromium/src/WebSecurityOrigin.cpp
new file mode 100644
index 0000000..2adf3db
--- /dev/null
+++ b/WebKit/chromium/src/WebSecurityOrigin.cpp
@@ -0,0 +1,124 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (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 "config.h"
+#include "WebSecurityOrigin.h"
+
+#include "SecurityOrigin.h"
+#include "WebString.h"
+#include <wtf/PassRefPtr.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+class WebSecurityOriginPrivate : public SecurityOrigin {
+};
+
+void WebSecurityOrigin::reset()
+{
+ assign(0);
+}
+
+void WebSecurityOrigin::assign(const WebSecurityOrigin& other)
+{
+ WebSecurityOriginPrivate* p = const_cast<WebSecurityOriginPrivate*>(other.m_private);
+ if (p)
+ p->ref();
+ assign(p);
+}
+
+WebString WebSecurityOrigin::protocol() const
+{
+ ASSERT(m_private);
+ return m_private->protocol();
+}
+
+WebString WebSecurityOrigin::host() const
+{
+ ASSERT(m_private);
+ return m_private->host();
+}
+
+unsigned short WebSecurityOrigin::port() const
+{
+ ASSERT(m_private);
+ return m_private->port();
+}
+
+bool WebSecurityOrigin::isEmpty() const
+{
+ ASSERT(m_private);
+ return m_private->isEmpty();
+}
+
+WebString WebSecurityOrigin::toString() const
+{
+ // FIXME: We should not support calling this method when m_private is null.
+ if (m_private)
+ return m_private->toString();
+
+ return WebString::fromUTF8("null");
+}
+
+WebString WebSecurityOrigin::databaseIdentifier()
+{
+ // FIXME: We should not support calling this method when m_private is null.
+ if (m_private)
+ return m_private->databaseIdentifier();
+
+ return WebString::fromUTF8("null");
+}
+
+WebSecurityOrigin::WebSecurityOrigin(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin)
+ : m_private(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef()))
+{
+}
+
+WebSecurityOrigin& WebSecurityOrigin::operator=(const WTF::PassRefPtr<WebCore::SecurityOrigin>& origin)
+{
+ assign(static_cast<WebSecurityOriginPrivate*>(origin.releaseRef()));
+ return *this;
+}
+
+WebSecurityOrigin::operator WTF::PassRefPtr<WebCore::SecurityOrigin>() const
+{
+ return PassRefPtr<SecurityOrigin>(const_cast<WebSecurityOriginPrivate*>(m_private));
+}
+
+void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p)
+{
+ // p is already ref'd for us by the caller
+ if (m_private)
+ m_private->deref();
+ m_private = p;
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSecurityPolicy.cpp b/WebKit/chromium/src/WebSecurityPolicy.cpp
new file mode 100644
index 0000000..c66c805
--- /dev/null
+++ b/WebKit/chromium/src/WebSecurityPolicy.cpp
@@ -0,0 +1,69 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebSecurityPolicy.h"
+
+#include "FrameLoader.h"
+#include "SecurityOrigin.h"
+
+#include "WebString.h"
+#include "WebURL.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void WebSecurityPolicy::registerURLSchemeAsLocal(const WebString& scheme)
+{
+ SecurityOrigin::registerURLSchemeAsLocal(scheme);
+}
+
+void WebSecurityPolicy::registerURLSchemeAsNoAccess(const WebString& scheme)
+{
+ SecurityOrigin::registerURLSchemeAsNoAccess(scheme);
+}
+
+void WebSecurityPolicy::whiteListAccessFromOrigin(const WebURL& sourceOrigin,
+ const WebString& destinationProtocol,
+ const WebString& destinationHost,
+ bool allowDestinationSubdomains)
+{
+ SecurityOrigin::whiteListAccessFromOrigin(
+ *SecurityOrigin::create(sourceOrigin), destinationProtocol,
+ destinationHost, allowDestinationSubdomains);
+}
+
+void WebSecurityPolicy::resetOriginAccessWhiteLists()
+{
+ SecurityOrigin::resetOriginAccessWhiteLists();
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp
new file mode 100644
index 0000000..cc5c567
--- /dev/null
+++ b/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -0,0 +1,247 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (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 "config.h"
+#include "WebSettingsImpl.h"
+
+#include "FontRenderingMode.h"
+#include "Settings.h"
+#include "WebString.h"
+#include "WebURL.h"
+
+#if defined(OS_WIN)
+#include "RenderThemeChromiumWin.h"
+#endif
+
+using namespace WebCore;
+
+namespace WebKit {
+
+WebSettingsImpl::WebSettingsImpl(Settings* settings)
+ : m_settings(settings)
+{
+ ASSERT(settings);
+}
+
+void WebSettingsImpl::setStandardFontFamily(const WebString& font)
+{
+ m_settings->setStandardFontFamily(font);
+}
+
+void WebSettingsImpl::setFixedFontFamily(const WebString& font)
+{
+ m_settings->setFixedFontFamily((String)font);
+}
+
+void WebSettingsImpl::setSerifFontFamily(const WebString& font)
+{
+ m_settings->setSerifFontFamily((String)font);
+}
+
+void WebSettingsImpl::setSansSerifFontFamily(const WebString& font)
+{
+ m_settings->setSansSerifFontFamily((String)font);
+}
+
+void WebSettingsImpl::setCursiveFontFamily(const WebString& font)
+{
+ m_settings->setCursiveFontFamily((String)font);
+}
+
+void WebSettingsImpl::setFantasyFontFamily(const WebString& font)
+{
+ m_settings->setFantasyFontFamily((String)font);
+}
+
+void WebSettingsImpl::setDefaultFontSize(int size)
+{
+ m_settings->setDefaultFontSize(size);
+#if defined(OS_WIN)
+ // RenderTheme is a singleton that needs to know the default font size to
+ // draw some form controls. We let it know each time the size changes.
+ WebCore::RenderThemeChromiumWin::setDefaultFontSize(size);
+#endif
+}
+
+void WebSettingsImpl::setDefaultFixedFontSize(int size)
+{
+ m_settings->setDefaultFixedFontSize(size);
+}
+
+void WebSettingsImpl::setMinimumFontSize(int size)
+{
+ m_settings->setMinimumFontSize(size);
+}
+
+void WebSettingsImpl::setMinimumLogicalFontSize(int size)
+{
+ m_settings->setMinimumLogicalFontSize(size);
+}
+
+void WebSettingsImpl::setDefaultTextEncodingName(const WebString& encoding)
+{
+ m_settings->setDefaultTextEncodingName((String)encoding);
+}
+
+void WebSettingsImpl::setJavaScriptEnabled(bool enabled)
+{
+ m_settings->setJavaScriptEnabled(enabled);
+}
+
+void WebSettingsImpl::setWebSecurityEnabled(bool enabled)
+{
+ m_settings->setWebSecurityEnabled(enabled);
+}
+
+void WebSettingsImpl::setJavaScriptCanOpenWindowsAutomatically(bool canOpenWindows)
+{
+ m_settings->setJavaScriptCanOpenWindowsAutomatically(canOpenWindows);
+}
+
+void WebSettingsImpl::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
+{
+ m_settings->setLoadsImagesAutomatically(loadsImagesAutomatically);
+}
+
+void WebSettingsImpl::setPluginsEnabled(bool enabled)
+{
+ m_settings->setPluginsEnabled(enabled);
+}
+
+void WebSettingsImpl::setDOMPasteAllowed(bool enabled)
+{
+ m_settings->setDOMPasteAllowed(enabled);
+}
+
+void WebSettingsImpl::setDeveloperExtrasEnabled(bool enabled)
+{
+ m_settings->setDeveloperExtrasEnabled(enabled);
+}
+
+void WebSettingsImpl::setShrinksStandaloneImagesToFit(bool shrinkImages)
+{
+ m_settings->setShrinksStandaloneImagesToFit(shrinkImages);
+}
+
+void WebSettingsImpl::setUsesEncodingDetector(bool usesDetector)
+{
+ m_settings->setUsesEncodingDetector(usesDetector);
+}
+
+void WebSettingsImpl::setTextAreasAreResizable(bool areResizable)
+{
+ m_settings->setTextAreasAreResizable(areResizable);
+}
+
+void WebSettingsImpl::setJavaEnabled(bool enabled)
+{
+ m_settings->setJavaEnabled(enabled);
+}
+
+void WebSettingsImpl::setAllowScriptsToCloseWindows(bool allow)
+{
+ m_settings->setAllowScriptsToCloseWindows(allow);
+}
+
+void WebSettingsImpl::setUserStyleSheetLocation(const WebURL& location)
+{
+ m_settings->setUserStyleSheetLocation(location);
+}
+
+void WebSettingsImpl::setUsesPageCache(bool usesPageCache)
+{
+ m_settings->setUsesPageCache(usesPageCache);
+}
+
+void WebSettingsImpl::setDownloadableBinaryFontsEnabled(bool enabled)
+{
+ m_settings->setDownloadableBinaryFontsEnabled(enabled);
+}
+
+void WebSettingsImpl::setXSSAuditorEnabled(bool enabled)
+{
+ m_settings->setXSSAuditorEnabled(enabled);
+}
+
+void WebSettingsImpl::setLocalStorageEnabled(bool enabled)
+{
+ m_settings->setLocalStorageEnabled(enabled);
+}
+
+void WebSettingsImpl::setEditableLinkBehaviorNeverLive()
+{
+ // FIXME: If you ever need more behaviors than this, then we should probably
+ // define an enum in WebSettings.h and have a switch statement that
+ // translates. Until then, this is probably fine, though.
+ m_settings->setEditableLinkBehavior(WebCore::EditableLinkNeverLive);
+}
+
+void WebSettingsImpl::setFontRenderingModeNormal()
+{
+ // FIXME: If you ever need more behaviors than this, then we should probably
+ // define an enum in WebSettings.h and have a switch statement that
+ // translates. Until then, this is probably fine, though.
+ m_settings->setFontRenderingMode(WebCore::NormalRenderingMode);
+}
+
+void WebSettingsImpl::setShouldPaintCustomScrollbars(bool enabled)
+{
+ m_settings->setShouldPaintCustomScrollbars(enabled);
+}
+
+void WebSettingsImpl::setDatabasesEnabled(bool enabled)
+{
+ m_settings->setDatabasesEnabled(enabled);
+}
+
+void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow)
+{
+ m_settings->setAllowUniversalAccessFromFileURLs(allow);
+}
+
+void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded()
+{
+ // FIXME: If you ever need more behaviors than this, then we should probably
+ // define an enum in WebSettings.h and have a switch statement that
+ // translates. Until then, this is probably fine, though.
+ m_settings->setTextDirectionSubmenuInclusionBehavior(WebCore::TextDirectionSubmenuNeverIncluded);
+}
+
+void WebSettingsImpl::setOfflineWebApplicationCacheEnabled(bool enabled)
+{
+ m_settings->setOfflineWebApplicationCacheEnabled(enabled);
+}
+
+void WebSettingsImpl::setExperimentalWebGLEnabled(bool enabled)
+{
+ m_settings->setWebGLEnabled(enabled);
+}
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h
new file mode 100644
index 0000000..01eb631
--- /dev/null
+++ b/WebKit/chromium/src/WebSettingsImpl.h
@@ -0,0 +1,91 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebSettingsImpl_h
+#define WebSettingsImpl_h
+
+// TODO(jorlow): Remove this hack once WebView is free of glue.
+#include "../public/WebSettings.h"
+
+namespace WebCore {
+class Settings;
+}
+
+namespace WebKit {
+
+class WebSettingsImpl : public WebSettings {
+public:
+ explicit WebSettingsImpl(WebCore::Settings*);
+ virtual ~WebSettingsImpl() { }
+
+ virtual void setStandardFontFamily(const WebString&);
+ virtual void setFixedFontFamily(const WebString&);
+ virtual void setSerifFontFamily(const WebString&);
+ virtual void setSansSerifFontFamily(const WebString&);
+ virtual void setCursiveFontFamily(const WebString&);
+ virtual void setFantasyFontFamily(const WebString&);
+ virtual void setDefaultFontSize(int);
+ virtual void setDefaultFixedFontSize(int);
+ virtual void setMinimumFontSize(int);
+ virtual void setMinimumLogicalFontSize(int);
+ virtual void setDefaultTextEncodingName(const WebString&);
+ virtual void setJavaScriptEnabled(bool);
+ virtual void setWebSecurityEnabled(bool);
+ virtual void setJavaScriptCanOpenWindowsAutomatically(bool);
+ virtual void setLoadsImagesAutomatically(bool);
+ virtual void setPluginsEnabled(bool);
+ virtual void setDOMPasteAllowed(bool);
+ virtual void setDeveloperExtrasEnabled(bool);
+ virtual void setShrinksStandaloneImagesToFit(bool);
+ virtual void setUsesEncodingDetector(bool);
+ virtual void setTextAreasAreResizable(bool);
+ virtual void setJavaEnabled(bool);
+ virtual void setAllowScriptsToCloseWindows(bool);
+ virtual void setUserStyleSheetLocation(const WebURL&);
+ virtual void setUsesPageCache(bool);
+ virtual void setDownloadableBinaryFontsEnabled(bool);
+ virtual void setXSSAuditorEnabled(bool);
+ virtual void setLocalStorageEnabled(bool);
+ virtual void setEditableLinkBehaviorNeverLive();
+ virtual void setFontRenderingModeNormal();
+ virtual void setShouldPaintCustomScrollbars(bool);
+ virtual void setDatabasesEnabled(bool);
+ virtual void setAllowUniversalAccessFromFileURLs(bool);
+ virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
+ virtual void setOfflineWebApplicationCacheEnabled(bool);
+ virtual void setExperimentalWebGLEnabled(bool);
+
+private:
+ WebCore::Settings* m_settings;
+};
+
+} // namespace WebKit
+
+#endif
diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.cpp b/WebKit/chromium/src/WebSharedWorkerImpl.cpp
new file mode 100644
index 0000000..4547336
--- /dev/null
+++ b/WebKit/chromium/src/WebSharedWorkerImpl.cpp
@@ -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.
+ */
+
+#include "config.h"
+#include "WebSharedWorkerImpl.h"
+
+#include "GenericWorkerTask.h"
+#include "KURL.h"
+#include "MessageEvent.h"
+#include "MessagePortChannel.h"
+#include "PlatformMessagePortChannel.h"
+#include "ScriptExecutionContext.h"
+#include "SharedWorkerContext.h"
+#include "SharedWorkerThread.h"
+
+#include "WebMessagePortChannel.h"
+#include "WebString.h"
+#include "WebURL.h"
+
+using namespace WebCore;
+
+namespace WebKit {
+
+#if ENABLE(SHARED_WORKERS)
+
+WebSharedWorkerImpl::WebSharedWorkerImpl(WebCommonWorkerClient* client)
+ : m_client(client)
+{
+}
+
+WebSharedWorkerImpl::~WebSharedWorkerImpl()
+{
+}
+
+bool WebSharedWorkerImpl::isStarted()
+{
+ // Should not ever be called from the worker thread (this API is only called on WebSharedWorkerProxy on the renderer thread).
+ ASSERT_NOT_REACHED();
+ return workerThread();
+}
+
+void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel, ConnectListener* listener)
+{
+ // Convert the WebMessagePortChanel to a WebCore::MessagePortChannel.
+ RefPtr<PlatformMessagePortChannel> platform_channel =
+ PlatformMessagePortChannel::create(webChannel);
+ webChannel->setClient(platform_channel.get());
+ OwnPtr<MessagePortChannel> channel =
+ MessagePortChannel::create(platform_channel);
+
+ workerThread()->runLoop().postTask(
+ createCallbackTask(&connectTask, this, channel.release()));
+ if (listener)
+ listener->connected();
+}
+
+void WebSharedWorkerImpl::connectTask(ScriptExecutionContext* context, WebSharedWorkerImpl* worker, PassOwnPtr<MessagePortChannel> channel)
+{
+ // Wrap the passed-in channel in a MessagePort, and send it off via a connect event.
+ RefPtr<MessagePort> port = MessagePort::create(*context);
+ port->entangle(channel.release());
+ ASSERT(context->isWorkerContext());
+ WorkerContext* workerContext = static_cast<WorkerContext*>(context);
+ ASSERT(workerContext->isSharedWorkerContext());
+ workerContext->toSharedWorkerContext()->dispatchEvent(createConnectEvent(port));
+}
+
+void WebSharedWorkerImpl::startWorkerContext(const WebURL& url, const WebString& name, const WebString& userAgent, const WebString& sourceCode)
+{
+ initializeLoader(url);
+ setWorkerThread(SharedWorkerThread::create(name, url, userAgent, sourceCode, *this, *this));
+ workerThread()->start();
+}
+
+void WebSharedWorkerImpl::terminateWorkerContext()
+{
+ stopWorkerThread();
+}
+
+void WebSharedWorkerImpl::clientDestroyed()
+{
+ m_client = 0;
+}
+
+WebWorkerClient* WebSharedWorkerImpl::client()
+{
+ // We should never be asked for a WebWorkerClient (only dedicated workers have an associated WebWorkerClient).
+ // It should not be possible for SharedWorkerContext to generate an API call outside those supported by WebCommonWorkerClient.
+ ASSERT_NOT_REACHED();
+ return 0;
+}
+
+WebSharedWorker* WebSharedWorker::create(WebCommonWorkerClient* client)
+{
+ return new WebSharedWorkerImpl(client);
+}
+
+#endif // ENABLE(SHARED_WORKERS)
+
+} // namespace WebKit
diff --git a/WebKit/chromium/src/WebSharedWorkerImpl.h b/WebKit/chromium/src/WebSharedWorkerImpl.h
new file mode 100644
index 0000000..7c10d76
--- /dev/null
+++ b/WebKit/chromium/src/WebSharedWorkerImpl.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 WebSharedWorkerImpl_h
+#define WebSharedWorkerImpl_h
+
+#include "WebSharedWorker.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "ScriptExecutionContext.h"
+
+#include "WebWorkerBase.h"
+
+namespace WebKit {
+
+// This class is used by the worker process code to talk to the WebCore::SharedWorker implementation.
+// It can't use it directly since it uses WebKit types, so this class converts the data types.
+// When the WebCore::SharedWorker object wants to call WebCore::WorkerReportingProxy, this class will
+// convert to Chrome data types first and then call the supplied WebCommonWorkerClient.
+class WebSharedWorkerImpl : public WebWorkerBase, public WebSharedWorker {
+public:
+ explicit WebSharedWorkerImpl(WebCommonWorkerClient* client);
+
+ // WebSharedWorker methods:
+ virtual bool isStarted();
+ virtual void startWorkerContext(const WebURL&, const WebString& name, const WebString& userAgent, const WebString& sourceCode);
+ virtual void connect(WebMessagePortChannel*, ConnectListener*);
+ virtual void terminateWorkerContext();
+ virtual void clientDestroyed();
+
+ // WebWorkerBase methods:
+ WebWorkerClient* client();
+ WebCommonWorkerClient* commonClient() { return m_client; }
+
+private:
+ virtual ~WebSharedWorkerImpl();
+
+ static void connectTask(WebCore::ScriptExecutionContext*, WebSharedWorkerImpl*, PassOwnPtr<WebCore::MessagePortChannel>);
+
+ WebCommonWorkerClient* m_client;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(SHARED_WORKERS)
+
+#endif
diff --git a/WebKit/chromium/src/WebStorageAreaImpl.cpp b/WebKit/chromium/src/WebStorageAreaImpl.cpp
new file mode 100644
index 0000000..f24bee3
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageAreaImpl.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebStorageAreaImpl.h"
+
+#if ENABLE(DOM_STORAGE)
+
+#include "ExceptionCode.h"
+
+#include "WebString.h"
+#include "WebURL.h"
+
+namespace WebKit {
+
+const WebURL* WebStorageAreaImpl::storageEventURL = 0;
+
+WebStorageAreaImpl::WebStorageAreaImpl(PassRefPtr<WebCore::StorageArea> storageArea)
+ : m_storageArea(storageArea)
+{
+}
+
+WebStorageAreaImpl::~WebStorageAreaImpl()
+{
+}
+
+unsigned WebStorageAreaImpl::length()
+{
+ return m_storageArea->length();
+}
+
+WebString WebStorageAreaImpl::key(unsigned index)
+{
+ return m_storageArea->key(index);
+}
+
+WebString WebStorageAreaImpl::getItem(const WebString& key)
+{
+ return m_storageArea->getItem(key);
+}
+
+void WebStorageAreaImpl::setItem(const WebString& key, const WebString& value, const WebURL& url, bool& quotaException)
+{
+ int exceptionCode = 0;
+
+ ScopedStorageEventURL scope(url);
+ m_storageArea->setItem(key, value, exceptionCode, 0);
+
+ if (exceptionCode) {
+ ASSERT(exceptionCode == WebCore::QUOTA_EXCEEDED_ERR);
+ quotaException = true;
+ } else
+ quotaException = false;
+}
+
+void WebStorageAreaImpl::removeItem(const WebString& key, const WebURL& url)
+{
+ ScopedStorageEventURL scope(url);
+ m_storageArea->removeItem(key, 0);
+}
+
+void WebStorageAreaImpl::clear(const WebURL& url)
+{
+ ScopedStorageEventURL scope(url);
+ m_storageArea->clear(0);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
diff --git a/WebKit/chromium/src/WebStorageAreaImpl.h b/WebKit/chromium/src/WebStorageAreaImpl.h
new file mode 100644
index 0000000..e1f74e0
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageAreaImpl.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 WebStorageAreaImpl_h
+#define WebStorageAreaImpl_h
+
+#if ENABLE(DOM_STORAGE)
+
+#include "StorageAreaImpl.h"
+#include "WebStorageArea.h"
+
+namespace WebKit {
+
+class WebStorageAreaImpl : public WebStorageArea {
+public:
+ WebStorageAreaImpl(PassRefPtr<WebCore::StorageArea> storageArea);
+ virtual ~WebStorageAreaImpl();
+ virtual unsigned length();
+ virtual WebString key(unsigned index);
+ virtual WebString getItem(const WebString& key);
+ virtual void setItem(const WebString& key, const WebString& value, const WebURL& url, bool& quotaException);
+ virtual void removeItem(const WebString& key, const WebURL& url);
+ virtual void clear(const WebURL& url);
+
+ // For storage events in single-process mode and test shell.
+ static const WebURL* currentStorageEventURL() { return storageEventURL; }
+
+private:
+ class ScopedStorageEventURL {
+ public:
+ ScopedStorageEventURL(const WebURL& url)
+ {
+ // FIXME: Once storage events are fired async in WebKit (as they should
+ // be) this can be ASSERTed to be 0 rather than saved.
+ m_existingStorageEventURL = storageEventURL;
+ storageEventURL = &url;
+ }
+ ~ScopedStorageEventURL()
+ {
+ storageEventURL = m_existingStorageEventURL;
+ }
+
+ private:
+ const WebURL* m_existingStorageEventURL;
+ };
+
+ static const WebURL* storageEventURL;
+
+ RefPtr<WebCore::StorageArea> m_storageArea;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
+
+#endif // WebStorageAreaImpl_h
diff --git a/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
new file mode 100644
index 0000000..515a423
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebStorageEventDispatcherImpl.h"
+
+#if ENABLE(DOM_STORAGE)
+
+#include "KURL.h"
+#include "SecurityOrigin.h"
+
+#include "WebStorageAreaImpl.h"
+#include "WebURL.h"
+
+namespace WebKit {
+
+extern const char* pageGroupName;
+
+WebStorageEventDispatcher* WebStorageEventDispatcher::create()
+{
+ return new WebStorageEventDispatcherImpl();
+}
+
+WebStorageEventDispatcherImpl::WebStorageEventDispatcherImpl()
+ : m_eventDispatcher(new WebCore::StorageEventDispatcherImpl(pageGroupName))
+{
+ ASSERT(m_eventDispatcher);
+}
+
+void WebStorageEventDispatcherImpl::dispatchStorageEvent(const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebString& origin,
+ const WebURL& passedInURL, bool isLocalStorage)
+{
+ // Hack for single-process mode and test shell.
+ const WebURL* storageAreaImplURL = WebStorageAreaImpl::currentStorageEventURL();
+ const WebURL& url = storageAreaImplURL ? *storageAreaImplURL : passedInURL;
+
+ WebCore::StorageType storageType = isLocalStorage ? WebCore::LocalStorage : WebCore::SessionStorage;
+ RefPtr<WebCore::SecurityOrigin> securityOrigin = WebCore::SecurityOrigin::createFromString(origin);
+ m_eventDispatcher->dispatchStorageEvent(key, oldValue, newValue, securityOrigin.get(), url, storageType);
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
diff --git a/WebKit/chromium/src/WebStorageEventDispatcherImpl.h b/WebKit/chromium/src/WebStorageEventDispatcherImpl.h
new file mode 100644
index 0000000..6848b99
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageEventDispatcherImpl.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 WebStorageEventDispatcherImpl_h
+#define WebStorageEventDispatcherImpl_h
+
+#if ENABLE(DOM_STORAGE)
+
+#include "StorageEventDispatcherImpl.h"
+#include "WebStorageEventDispatcher.h"
+#include <wtf/OwnPtr.h>
+
+namespace WebKit {
+
+class WebStorageEventDispatcherImpl : public WebStorageEventDispatcher {
+public:
+ WebStorageEventDispatcherImpl();
+
+ virtual void dispatchStorageEvent(const WebString& key, const WebString& oldValue,
+ const WebString& newValue, const WebString& origin,
+ const WebURL&, bool isLocalStorage);
+
+private:
+ OwnPtr<WebCore::StorageEventDispatcherImpl> m_eventDispatcher;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
+
+#endif // WebStorageEventDispatcherImpl_h
diff --git a/WebKit/chromium/src/WebStorageNamespaceImpl.cpp b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp
new file mode 100644
index 0000000..94cb9b5
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageNamespaceImpl.cpp
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WebStorageNamespaceImpl.h"
+
+#if ENABLE(DOM_STORAGE)
+
+#include "SecurityOrigin.h"
+
+#include "WebStorageAreaImpl.h"
+#include "WebString.h"
+
+namespace WebKit {
+
+WebStorageNamespace* WebStorageNamespace::createLocalStorageNamespace(const WebString& path, unsigned quota)
+{
+ return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::localStorageNamespace(path, quota));
+}
+
+WebStorageNamespace* WebStorageNamespace::createSessionStorageNamespace()
+{
+ return new WebStorageNamespaceImpl(WebCore::StorageNamespaceImpl::sessionStorageNamespace());
+}
+
+WebStorageNamespaceImpl::WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace)
+ : m_storageNamespace(storageNamespace)
+{
+}
+
+WebStorageNamespaceImpl::~WebStorageNamespaceImpl()
+{
+}
+
+WebStorageArea* WebStorageNamespaceImpl::createStorageArea(const WebString& originString)
+{
+ RefPtr<WebCore::SecurityOrigin> origin = WebCore::SecurityOrigin::createFromString(originString);
+ return new WebStorageAreaImpl(m_storageNamespace->storageArea(origin.release()));
+}
+
+WebStorageNamespace* WebStorageNamespaceImpl::copy()
+{
+ return new WebStorageNamespaceImpl(m_storageNamespace->copy());
+}
+
+void WebStorageNamespaceImpl::close()
+{
+ m_storageNamespace->close();
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
diff --git a/WebKit/chromium/src/WebStorageNamespaceImpl.h b/WebKit/chromium/src/WebStorageNamespaceImpl.h
new file mode 100644
index 0000000..4e82c21
--- /dev/null
+++ b/WebKit/chromium/src/WebStorageNamespaceImpl.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef WebStorageNamespaceImpl_h
+#define WebStorageNamespaceImpl_h
+
+#if ENABLE(DOM_STORAGE)
+
+#include "StorageNamespaceImpl.h"
+#include "WebStorageNamespace.h"
+
+namespace WebKit {
+
+class WebStorageNamespaceImpl : public WebStorageNamespace {
+public:
+ WebStorageNamespaceImpl(PassRefPtr<WebCore::StorageNamespace> storageNamespace);
+ virtual ~WebStorageNamespaceImpl();
+ virtual WebStorageArea* createStorageArea(const WebString& origin);
+ virtual WebStorageNamespace* copy();
+ virtual void close();
+
+private:
+ RefPtr<WebCore::StorageNamespace> m_storageNamespace;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(DOM_STORAGE)
+
+#endif // WebStorageNamespaceImpl_h
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list