Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / platform / weborigin / SchemeRegistry.cpp
index 079beaa..6c01ee1 100644 (file)
@@ -142,6 +142,18 @@ static URLSchemesMap& CORSEnabledSchemes()
     return CORSEnabledSchemes;
 }
 
+static URLSchemesMap& LegacySchemes()
+{
+    DEFINE_STATIC_LOCAL(URLSchemesMap, LegacySchemes, ());
+
+    if (LegacySchemes.isEmpty()) {
+        LegacySchemes.add("ftp");
+        LegacySchemes.add("gopher");
+    }
+
+    return LegacySchemes;
+}
+
 static URLSchemesMap& ContentSecurityPolicyBypassingSchemes()
 {
     DEFINE_STATIC_LOCAL(URLSchemesMap, schemes, ());
@@ -265,7 +277,7 @@ String SchemeRegistry::listOfCORSEnabledURLSchemes()
     bool addSeparator = false;
     for (URLSchemesMap::const_iterator it = corsEnabledSchemes.begin(); it != corsEnabledSchemes.end(); ++it) {
         if (addSeparator)
-            builder.append(", ");
+            builder.appendLiteral(", ");
         else
             addSeparator = true;
 
@@ -274,6 +286,18 @@ String SchemeRegistry::listOfCORSEnabledURLSchemes()
     return builder.toString();
 }
 
+void SchemeRegistry::registerURLSchemeAsLegacy(const String& scheme)
+{
+    LegacySchemes().add(scheme);
+}
+
+bool SchemeRegistry::shouldTreatURLSchemeAsLegacy(const String& scheme)
+{
+    if (scheme.isEmpty())
+        return false;
+    return LegacySchemes().contains(scheme);
+}
+
 void SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(const String& scheme)
 {
     ContentSecurityPolicyBypassingSchemes().add(scheme);