Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1509)

Unified Diff: Source/weborigin/SchemeRegistry.cpp

Issue 54053006: Move weborigin/ under platform/ so that it may someday call platform APIs (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Stale refernence to weboriginexport in .gpyi Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/weborigin/SchemeRegistry.h ('k') | Source/weborigin/SecurityOrigin.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/weborigin/SchemeRegistry.cpp
diff --git a/Source/weborigin/SchemeRegistry.cpp b/Source/weborigin/SchemeRegistry.cpp
deleted file mode 100644
index 7679fce8a1524426e16d083fc5c2af41ebf6f9a4..0000000000000000000000000000000000000000
--- a/Source/weborigin/SchemeRegistry.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. 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. ``AS IS'' AND ANY
- * EXPRESS OR 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 COMPUTER, INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (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 "weborigin/SchemeRegistry.h"
-
-#include "wtf/MainThread.h"
-
-namespace WebCore {
-
-static URLSchemesMap& localURLSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, localSchemes, ());
-
- if (localSchemes.isEmpty())
- localSchemes.add("file");
-
- return localSchemes;
-}
-
-static URLSchemesMap& displayIsolatedURLSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, displayIsolatedSchemes, ());
- return displayIsolatedSchemes;
-}
-
-static URLSchemesMap& secureSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, secureSchemes, ());
-
- if (secureSchemes.isEmpty()) {
- secureSchemes.add("https");
- secureSchemes.add("about");
- secureSchemes.add("data");
- }
-
- return secureSchemes;
-}
-
-static URLSchemesMap& schemesWithUniqueOrigins()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, schemesWithUniqueOrigins, ());
-
- if (schemesWithUniqueOrigins.isEmpty()) {
- schemesWithUniqueOrigins.add("about");
- schemesWithUniqueOrigins.add("javascript");
- // This is a willful violation of HTML5.
- // See https://bugs.webkit.org/show_bug.cgi?id=11885
- schemesWithUniqueOrigins.add("data");
- }
-
- return schemesWithUniqueOrigins;
-}
-
-static URLSchemesMap& emptyDocumentSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, emptyDocumentSchemes, ());
-
- if (emptyDocumentSchemes.isEmpty())
- emptyDocumentSchemes.add("about");
-
- return emptyDocumentSchemes;
-}
-
-static HashSet<String>& schemesForbiddenFromDomainRelaxation()
-{
- DEFINE_STATIC_LOCAL(HashSet<String>, schemes, ());
- return schemes;
-}
-
-static URLSchemesMap& canDisplayOnlyIfCanRequestSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, canDisplayOnlyIfCanRequestSchemes, ());
-
- if (canDisplayOnlyIfCanRequestSchemes.isEmpty()) {
- canDisplayOnlyIfCanRequestSchemes.add("blob");
- canDisplayOnlyIfCanRequestSchemes.add("filesystem");
- }
-
- return canDisplayOnlyIfCanRequestSchemes;
-}
-
-static URLSchemesMap& notAllowingJavascriptURLsSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, notAllowingJavascriptURLsSchemes, ());
- return notAllowingJavascriptURLsSchemes;
-}
-
-void SchemeRegistry::registerURLSchemeAsLocal(const String& scheme)
-{
- localURLSchemes().add(scheme);
-}
-
-void SchemeRegistry::removeURLSchemeRegisteredAsLocal(const String& scheme)
-{
- if (scheme == "file")
- return;
- localURLSchemes().remove(scheme);
-}
-
-const URLSchemesMap& SchemeRegistry::localSchemes()
-{
- return localURLSchemes();
-}
-
-static URLSchemesMap& CORSEnabledSchemes()
-{
- // FIXME: http://bugs.webkit.org/show_bug.cgi?id=77160
- DEFINE_STATIC_LOCAL(URLSchemesMap, CORSEnabledSchemes, ());
-
- if (CORSEnabledSchemes.isEmpty()) {
- CORSEnabledSchemes.add("http");
- CORSEnabledSchemes.add("https");
- }
-
- return CORSEnabledSchemes;
-}
-
-static URLSchemesMap& ContentSecurityPolicyBypassingSchemes()
-{
- DEFINE_STATIC_LOCAL(URLSchemesMap, schemes, ());
- return schemes;
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsLocal(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return localURLSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsNoAccess(const String& scheme)
-{
- schemesWithUniqueOrigins().add(scheme);
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsNoAccess(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return schemesWithUniqueOrigins().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsDisplayIsolated(const String& scheme)
-{
- displayIsolatedURLSchemes().add(scheme);
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsDisplayIsolated(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return displayIsolatedURLSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsSecure(const String& scheme)
-{
- secureSchemes().add(scheme);
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsSecure(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return secureSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsEmptyDocument(const String& scheme)
-{
- emptyDocumentSchemes().add(scheme);
-}
-
-bool SchemeRegistry::shouldLoadURLSchemeAsEmptyDocument(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return emptyDocumentSchemes().contains(scheme);
-}
-
-void SchemeRegistry::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const String& scheme)
-{
- if (scheme.isEmpty())
- return;
-
- if (forbidden)
- schemesForbiddenFromDomainRelaxation().add(scheme);
- else
- schemesForbiddenFromDomainRelaxation().remove(scheme);
-}
-
-bool SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return schemesForbiddenFromDomainRelaxation().contains(scheme);
-}
-
-bool SchemeRegistry::canDisplayOnlyIfCanRequest(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return canDisplayOnlyIfCanRequestSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerAsCanDisplayOnlyIfCanRequest(const String& scheme)
-{
- canDisplayOnlyIfCanRequestSchemes().add(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs(const String& scheme)
-{
- notAllowingJavascriptURLsSchemes().add(scheme);
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return notAllowingJavascriptURLsSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsCORSEnabled(const String& scheme)
-{
- CORSEnabledSchemes().add(scheme);
-}
-
-bool SchemeRegistry::shouldTreatURLSchemeAsCORSEnabled(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return CORSEnabledSchemes().contains(scheme);
-}
-
-void SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme)
-{
- ContentSecurityPolicyBypassingSchemes().add(scheme);
-}
-
-void SchemeRegistry::removeURLSchemeRegisteredAsBypassingContentSecurityPolicy(const String& scheme)
-{
- ContentSecurityPolicyBypassingSchemes().remove(scheme);
-}
-
-bool SchemeRegistry::schemeShouldBypassContentSecurityPolicy(const String& scheme)
-{
- if (scheme.isEmpty())
- return false;
- return ContentSecurityPolicyBypassingSchemes().contains(scheme);
-}
-
-} // namespace WebCore
« no previous file with comments | « Source/weborigin/SchemeRegistry.h ('k') | Source/weborigin/SecurityOrigin.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698