Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / Source / web / WebSecurityPolicy.cpp
blob2f2b5d388e3b6c5330f0e4f38ab53741181a41b4
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the
13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 #include "config.h"
32 #include "public/web/WebSecurityPolicy.h"
34 #include "core/loader/FrameLoader.h"
35 #include "platform/weborigin/SchemeRegistry.h"
36 #include "platform/weborigin/SecurityOrigin.h"
37 #include "platform/weborigin/SecurityPolicy.h"
38 #include "public/platform/WebSecurityOrigin.h"
39 #include "public/platform/WebString.h"
40 #include "public/platform/WebURL.h"
42 namespace blink {
44 void WebSecurityPolicy::registerURLSchemeAsLocal(const WebString& scheme)
46 SchemeRegistry::registerURLSchemeAsLocal(scheme);
49 void WebSecurityPolicy::registerURLSchemeAsNoAccess(const WebString& scheme)
51 SchemeRegistry::registerURLSchemeAsNoAccess(scheme);
54 void WebSecurityPolicy::registerURLSchemeAsDisplayIsolated(const WebString& scheme)
56 SchemeRegistry::registerURLSchemeAsDisplayIsolated(scheme);
59 void WebSecurityPolicy::registerURLSchemeAsRestrictingMixedContent(const WebString& scheme)
61 SchemeRegistry::registerURLSchemeAsRestrictingMixedContent(scheme);
64 void WebSecurityPolicy::registerURLSchemeAsSecure(const WebString& scheme)
66 SchemeRegistry::registerURLSchemeAsSecure(scheme);
69 bool WebSecurityPolicy::shouldTreatURLSchemeAsSecure(const WebString& scheme)
71 return SchemeRegistry::shouldTreatURLSchemeAsSecure(scheme);
74 void WebSecurityPolicy::registerURLSchemeAsCORSEnabled(const WebString& scheme)
76 SchemeRegistry::registerURLSchemeAsCORSEnabled(scheme);
79 void WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(const WebString& scheme)
81 SchemeRegistry::registerURLSchemeAsAllowingServiceWorkers(scheme);
84 void WebSecurityPolicy::registerURLSchemeAsSupportingFetchAPI(const WebString& scheme)
86 SchemeRegistry::registerURLSchemeAsSupportingFetchAPI(scheme);
89 void WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(const WebString& scheme)
91 SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(scheme);
94 void WebSecurityPolicy::registerURLSchemeAsBypassingContentSecurityPolicy(const WebString& scheme, PolicyAreas policyAreas)
96 SchemeRegistry::registerURLSchemeAsBypassingContentSecurityPolicy(scheme, static_cast<SchemeRegistry::PolicyAreas>(policyAreas));
99 void WebSecurityPolicy::registerURLSchemeAsFirstPartyWhenTopLevel(const WebString& scheme)
101 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel(scheme);
104 void WebSecurityPolicy::registerURLSchemeAsEmptyDocument(const WebString& scheme)
106 SchemeRegistry::registerURLSchemeAsEmptyDocument(scheme);
109 void WebSecurityPolicy::addOriginAccessWhitelistEntry(
110 const WebURL& sourceOrigin,
111 const WebString& destinationProtocol,
112 const WebString& destinationHost,
113 bool allowDestinationSubdomains)
115 SecurityPolicy::addOriginAccessWhitelistEntry(
116 *SecurityOrigin::create(sourceOrigin), destinationProtocol,
117 destinationHost, allowDestinationSubdomains);
120 void WebSecurityPolicy::removeOriginAccessWhitelistEntry(
121 const WebURL& sourceOrigin,
122 const WebString& destinationProtocol,
123 const WebString& destinationHost,
124 bool allowDestinationSubdomains)
126 SecurityPolicy::removeOriginAccessWhitelistEntry(
127 *SecurityOrigin::create(sourceOrigin), destinationProtocol,
128 destinationHost, allowDestinationSubdomains);
131 void WebSecurityPolicy::resetOriginAccessWhitelists()
133 SecurityPolicy::resetOriginAccessWhitelists();
136 void WebSecurityPolicy::addOriginTrustworthyWhiteList(const WebSecurityOrigin& origin)
138 SecurityPolicy::addOriginTrustworthyWhiteList(origin);
141 WebString WebSecurityPolicy::generateReferrerHeader(WebReferrerPolicy referrerPolicy, const WebURL& url, const WebString& referrer)
143 return SecurityPolicy::generateReferrer(static_cast<ReferrerPolicy>(referrerPolicy), url, referrer).referrer;
146 void WebSecurityPolicy::registerURLSchemeAsNotAllowingJavascriptURLs(const WebString& scheme)
148 SchemeRegistry::registerURLSchemeAsNotAllowingJavascriptURLs(scheme);
151 } // namespace blink