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

Side by Side Diff: third_party/WebKit/Source/web/WebSecurityPolicy.cpp

Issue 2883793003: Move detached files from web/ to (core/modules)/exported. (Closed)
Patch Set: Created 3 years, 7 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met:
7 *
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.
17 *
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.
29 */
30
31 #include "public/web/WebSecurityPolicy.h"
32
33 #include "core/loader/FrameLoader.h"
34 #include "platform/weborigin/SchemeRegistry.h"
35 #include "platform/weborigin/SecurityOrigin.h"
36 #include "platform/weborigin/SecurityPolicy.h"
37 #include "public/platform/WebSecurityOrigin.h"
38 #include "public/platform/WebString.h"
39 #include "public/platform/WebURL.h"
40
41 namespace blink {
42
43 void WebSecurityPolicy::RegisterURLSchemeAsDisplayIsolated(
44 const WebString& scheme) {
45 SchemeRegistry::RegisterURLSchemeAsDisplayIsolated(scheme);
46 }
47
48 void WebSecurityPolicy::RegisterURLSchemeAsAllowingServiceWorkers(
49 const WebString& scheme) {
50 SchemeRegistry::RegisterURLSchemeAsAllowingServiceWorkers(scheme);
51 }
52
53 void WebSecurityPolicy::RegisterURLSchemeAsSupportingFetchAPI(
54 const WebString& scheme) {
55 SchemeRegistry::RegisterURLSchemeAsSupportingFetchAPI(scheme);
56 }
57
58 void WebSecurityPolicy::RegisterURLSchemeAsFirstPartyWhenTopLevel(
59 const WebString& scheme) {
60 SchemeRegistry::RegisterURLSchemeAsFirstPartyWhenTopLevel(scheme);
61 }
62
63 void WebSecurityPolicy::AddOriginAccessWhitelistEntry(
64 const WebURL& source_origin,
65 const WebString& destination_protocol,
66 const WebString& destination_host,
67 bool allow_destination_subdomains) {
68 SecurityPolicy::AddOriginAccessWhitelistEntry(
69 *SecurityOrigin::Create(source_origin), destination_protocol,
70 destination_host, allow_destination_subdomains);
71 }
72
73 void WebSecurityPolicy::RemoveOriginAccessWhitelistEntry(
74 const WebURL& source_origin,
75 const WebString& destination_protocol,
76 const WebString& destination_host,
77 bool allow_destination_subdomains) {
78 SecurityPolicy::RemoveOriginAccessWhitelistEntry(
79 *SecurityOrigin::Create(source_origin), destination_protocol,
80 destination_host, allow_destination_subdomains);
81 }
82
83 void WebSecurityPolicy::ResetOriginAccessWhitelists() {
84 SecurityPolicy::ResetOriginAccessWhitelists();
85 }
86
87 void WebSecurityPolicy::AddOriginTrustworthyWhiteList(
88 const WebSecurityOrigin& origin) {
89 SecurityPolicy::AddOriginTrustworthyWhiteList(origin);
90 }
91
92 void WebSecurityPolicy::AddSchemeToBypassSecureContextWhitelist(
93 const WebString& scheme) {
94 SchemeRegistry::RegisterURLSchemeBypassingSecureContextCheck(scheme);
95 }
96
97 WebString WebSecurityPolicy::GenerateReferrerHeader(
98 WebReferrerPolicy referrer_policy,
99 const WebURL& url,
100 const WebString& referrer) {
101 return SecurityPolicy::GenerateReferrer(
102 static_cast<ReferrerPolicy>(referrer_policy), url, referrer)
103 .referrer;
104 }
105
106 void WebSecurityPolicy::RegisterURLSchemeAsNotAllowingJavascriptURLs(
107 const WebString& scheme) {
108 SchemeRegistry::RegisterURLSchemeAsNotAllowingJavascriptURLs(scheme);
109 }
110
111 void WebSecurityPolicy::RegisterURLSchemeAsAllowedForReferrer(
112 const WebString& scheme) {
113 SchemeRegistry::RegisterURLSchemeAsAllowedForReferrer(scheme);
114 }
115
116 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698