| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/csp_validator.h" | 5 #include "chrome/common/extensions/csp_validator.h" |
| 6 | 6 |
| 7 #include "base/strings/string_split.h" | 7 #include "base/strings/string_split.h" |
| 8 #include "base/strings/string_tokenizer.h" | 8 #include "base/strings/string_tokenizer.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 | 10 |
| 11 namespace extensions { | 11 namespace extensions { |
| 12 | 12 |
| 13 namespace csp_validator { | 13 namespace csp_validator { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 const char kDefaultSrc[] = "default-src"; | 17 const char kDefaultSrc[] = "default-src"; |
| 18 const char kScriptSrc[] = "script-src"; | 18 const char kScriptSrc[] = "script-src"; |
| 19 const char kObjectSrc[] = "object-src"; | 19 const char kObjectSrc[] = "object-src"; |
| 20 | 20 |
| 21 const char kSandboxDirectiveName[] = "sandbox"; | 21 const char kSandboxDirectiveName[] = "sandbox"; |
| 22 const char kAllowSameOriginToken[] = "allow-same-origin"; | 22 const char kAllowSameOriginToken[] = "allow-same-origin"; |
| 23 const char kAllowTopNavigation[] = "allow-top-navigation"; | 23 const char kAllowTopNavigation[] = "allow-top-navigation"; |
| 24 const char kAllowPopups[] = "allow-popups"; | |
| 25 | 24 |
| 26 struct DirectiveStatus { | 25 struct DirectiveStatus { |
| 27 explicit DirectiveStatus(const char* name) | 26 explicit DirectiveStatus(const char* name) |
| 28 : directive_name(name) | 27 : directive_name(name) |
| 29 , seen_in_policy(false) | 28 , seen_in_policy(false) |
| 30 , is_secure(false) { | 29 , is_secure(false) { |
| 31 } | 30 } |
| 32 | 31 |
| 33 const char* directive_name; | 32 const char* directive_name; |
| 34 bool seen_in_policy; | 33 bool seen_in_policy; |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 191 } |
| 193 } | 192 } |
| 194 } | 193 } |
| 195 | 194 |
| 196 return seen_sandbox; | 195 return seen_sandbox; |
| 197 } | 196 } |
| 198 | 197 |
| 199 } // csp_validator | 198 } // csp_validator |
| 200 | 199 |
| 201 } // extensions | 200 } // extensions |
| OLD | NEW |