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

Side by Side Diff: content/common/content_security_policy/csp_directive.cc

Issue 2910573002: Implement upgrade-insecure-requests in browser for frame requests (Closed)
Patch Set: rebase Created 3 years, 6 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
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/content_security_policy/csp_directive.h" 5 #include "content/common/content_security_policy/csp_directive.h"
6 6
7 namespace content { 7 namespace content {
8 8
9 CSPDirective::CSPDirective() = default; 9 CSPDirective::CSPDirective() = default;
10 10
(...skipping 10 matching lines...) Expand all
21 std::string CSPDirective::NameToString(CSPDirective::Name name) { 21 std::string CSPDirective::NameToString(CSPDirective::Name name) {
22 switch (name) { 22 switch (name) {
23 case DefaultSrc: 23 case DefaultSrc:
24 return "default-src"; 24 return "default-src";
25 case ChildSrc: 25 case ChildSrc:
26 return "child-src"; 26 return "child-src";
27 case FrameSrc: 27 case FrameSrc:
28 return "frame-src"; 28 return "frame-src";
29 case FormAction: 29 case FormAction:
30 return "form-action"; 30 return "form-action";
31 case UpgradeInsecureRequests:
32 return "upgrade-insecure-requests";
31 case Unknown: 33 case Unknown:
32 return ""; 34 return "";
33 } 35 }
34 NOTREACHED(); 36 NOTREACHED();
35 return ""; 37 return "";
36 } 38 }
37 39
38 // static 40 // static
39 CSPDirective::Name CSPDirective::StringToName(const std::string& name) { 41 CSPDirective::Name CSPDirective::StringToName(const std::string& name) {
40 if (name == "default-src") 42 if (name == "default-src")
41 return CSPDirective::DefaultSrc; 43 return CSPDirective::DefaultSrc;
42 if (name == "child-src") 44 if (name == "child-src")
43 return CSPDirective::ChildSrc; 45 return CSPDirective::ChildSrc;
44 if (name == "frame-src") 46 if (name == "frame-src")
45 return CSPDirective::FrameSrc; 47 return CSPDirective::FrameSrc;
46 if (name == "form-action") 48 if (name == "form-action")
47 return CSPDirective::FormAction; 49 return CSPDirective::FormAction;
50 if (name == "upgrade-insecure-requests")
51 return CSPDirective::UpgradeInsecureRequests;
48 return CSPDirective::Unknown; 52 return CSPDirective::Unknown;
49 } 53 }
50 54
51 } // namespace content 55 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698