summaryrefslogtreecommitdiffstats
path: root/webkit/api
diff options
context:
space:
mode:
authormhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 14:09:27 +0000
committermhm@chromium.org <mhm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-21 14:09:27 +0000
commit9e5be41af9f9946ae195920c13a6cdebddc989c2 (patch)
tree1b39d0900c7b463e43bf2ef5f381bf2610bc5da2 /webkit/api
parent762a91816bcce1e9d406251ec0db132e645bacad (diff)
downloadchromium_src-9e5be41af9f9946ae195920c13a6cdebddc989c2.zip
chromium_src-9e5be41af9f9946ae195920c13a6cdebddc989c2.tar.gz
chromium_src-9e5be41af9f9946ae195920c13a6cdebddc989c2.tar.bz2
TBR: darin
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29642 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/api')
-rw-r--r--webkit/api/public/WebKit.h18
-rwxr-xr-xwebkit/api/public/WebSecurityPolicy.h64
-rw-r--r--webkit/api/src/WebKit.cpp28
-rwxr-xr-xwebkit/api/src/WebSecurityPolicy.cpp69
4 files changed, 46 insertions, 133 deletions
diff --git a/webkit/api/public/WebKit.h b/webkit/api/public/WebKit.h
index 3be1abe5..cf2cea1 100644
--- a/webkit/api/public/WebKit.h
+++ b/webkit/api/public/WebKit.h
@@ -32,9 +32,11 @@
#define WebKit_h
#include "WebCommon.h"
+#include "WebURL.h"
namespace WebKit {
class WebKitClient;
+ class WebString;
// Must be called on the thread that will be the main WebKit thread before
// using any other WebKit APIs. The provided WebKitClient must be non-null
@@ -54,6 +56,16 @@ namespace WebKit {
WEBKIT_API void setLayoutTestMode(bool);
WEBKIT_API bool layoutTestMode();
+ // Registers a URL scheme to be treated as a local scheme (i.e., with the
+ // same security rules as those applied to "file" URLs). This means that
+ // normal pages cannot link to or access URLs of this scheme.
+ WEBKIT_API void registerURLSchemeAsLocal(const WebString&);
+
+ // Registers a URL scheme to be treated as a noAccess scheme. This means
+ // that pages loaded with this URL scheme cannot access pages loaded with
+ // any other URL scheme.
+ WEBKIT_API void registerURLSchemeAsNoAccess(const WebString&);
+
// Enables HTML5 media support.
WEBKIT_API void enableMediaPlayer();
@@ -65,6 +77,12 @@ namespace WebKit {
WEBKIT_API void enableDatabases();
WEBKIT_API bool databasesEnabled();
+ // Support for whitelisting access to origins beyond the same-origin policy.
+ WEBKIT_API void whiteListAccessFromOrigin(
+ const WebURL& sourceOrigin, const WebString& destinationProtocol,
+ const WebString& destinationHost, bool allowDestinationSubdomains);
+ WEBKIT_API void resetOriginAccessWhiteLists();
+
// Enables HTML5 Web Sockets support.
WEBKIT_API void enableWebSockets();
WEBKIT_API bool webSocketsEnabled();
diff --git a/webkit/api/public/WebSecurityPolicy.h b/webkit/api/public/WebSecurityPolicy.h
deleted file mode 100755
index b0c0ad7..0000000
--- a/webkit/api/public/WebSecurityPolicy.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef WebSecurityPolicy_h
-#define WebSecurityPolicy_h
-
-#include "WebCommon.h"
-
-namespace WebKit {
- class WebString;
- class WebURL;
-
- class WebSecurityPolicy {
- public:
- // Registers a URL scheme to be treated as a local scheme (i.e., with the
- // same security rules as those applied to "file" URLs). This means that
- // normal pages cannot link to or access URLs of this scheme.
- WEBKIT_API static void registerURLSchemeAsLocal(const WebString&);
-
- // Registers a URL scheme to be treated as a noAccess scheme. This means
- // that pages loaded with this URL scheme cannot access pages loaded with
- // any other URL scheme.
- WEBKIT_API static void registerURLSchemeAsNoAccess(const WebString&);
-
- // Support for whitelisting access to origins beyond the same-origin policy.
- WEBKIT_API static void whiteListAccessFromOrigin(
- const WebURL& sourceOrigin, const WebString& destinationProtocol,
- const WebString& destinationHost, bool allowDestinationSubdomains);
- WEBKIT_API static void resetOriginAccessWhiteLists();
-
- private:
- WebSecurityPolicy();
- };
-
-} // namespace WebKit
-
-#endif
diff --git a/webkit/api/src/WebKit.cpp b/webkit/api/src/WebKit.cpp
index 7a04fe6..c0ea7a3 100644
--- a/webkit/api/src/WebKit.cpp
+++ b/webkit/api/src/WebKit.cpp
@@ -32,10 +32,13 @@
#include "WebKit.h"
#include "WebMediaPlayerClientImpl.h"
+#include "WebString.h"
#include "AtomicString.h"
#include "DOMTimer.h"
+#include "FrameLoader.h"
#include "Page.h"
+#include "SecurityOrigin.h"
#include "TextEncoding.h"
#include "WebSocket.h"
#include "WorkerContextExecutionProxy.h"
@@ -94,6 +97,16 @@ bool layoutTestMode()
return s_layoutTestMode;
}
+void registerURLSchemeAsLocal(const WebString& scheme)
+{
+ WebCore::SecurityOrigin::registerURLSchemeAsLocal(scheme);
+}
+
+void registerURLSchemeAsNoAccess(const WebString& scheme)
+{
+ WebCore::SecurityOrigin::registerURLSchemeAsNoAccess(scheme);
+}
+
void enableMediaPlayer()
{
#if ENABLE(VIDEO)
@@ -118,6 +131,21 @@ bool databasesEnabled()
return s_databasesEnabled;
}
+void whiteListAccessFromOrigin(const WebURL& sourceOrigin,
+ const WebString& destinationProtocol,
+ const WebString& destinationHost,
+ bool allowDestinationSubdomains)
+{
+ WebCore::SecurityOrigin::whiteListAccessFromOrigin(
+ *WebCore::SecurityOrigin::create(sourceOrigin), destinationProtocol,
+ destinationHost, allowDestinationSubdomains);
+}
+
+void resetOriginAccessWhiteLists()
+{
+ WebCore::SecurityOrigin::resetOriginAccessWhiteLists();
+}
+
void enableWebSockets()
{
#if ENABLE(WEB_SOCKETS)
diff --git a/webkit/api/src/WebSecurityPolicy.cpp b/webkit/api/src/WebSecurityPolicy.cpp
deleted file mode 100755
index 8218381..0000000
--- a/webkit/api/src/WebSecurityPolicy.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2009 Google Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following disclaimer
- * in the documentation and/or other materials provided with the
- * distribution.
- * * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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 "WebString.h"
-#include "WebURL.h"
-
-#include "FrameLoader.h"
-#include "SecurityOrigin.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