OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/common/csp_validator.h" | 5 #include "extensions/common/csp_validator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 | 12 |
Lei Zhang
2014/05/29 05:21:24
no blank line here
| |
13 #include "content/public/common/url_constants.h" | |
14 #include "extensions/common/constants.h" | |
15 | |
13 namespace extensions { | 16 namespace extensions { |
14 | 17 |
15 namespace csp_validator { | 18 namespace csp_validator { |
16 | 19 |
17 namespace { | 20 namespace { |
18 | 21 |
19 const char kDefaultSrc[] = "default-src"; | 22 const char kDefaultSrc[] = "default-src"; |
20 const char kScriptSrc[] = "script-src"; | 23 const char kScriptSrc[] = "script-src"; |
21 const char kObjectSrc[] = "object-src"; | 24 const char kObjectSrc[] = "object-src"; |
22 | 25 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 if (source == "'self'" || | 67 if (source == "'self'" || |
65 source == "'none'" || | 68 source == "'none'" || |
66 source == "http://127.0.0.1" || | 69 source == "http://127.0.0.1" || |
67 LowerCaseEqualsASCII(source, "blob:") || | 70 LowerCaseEqualsASCII(source, "blob:") || |
68 LowerCaseEqualsASCII(source, "filesystem:") || | 71 LowerCaseEqualsASCII(source, "filesystem:") || |
69 LowerCaseEqualsASCII(source, "http://localhost") || | 72 LowerCaseEqualsASCII(source, "http://localhost") || |
70 StartsWithASCII(source, "http://127.0.0.1:", false) || | 73 StartsWithASCII(source, "http://127.0.0.1:", false) || |
71 StartsWithASCII(source, "http://localhost:", false) || | 74 StartsWithASCII(source, "http://localhost:", false) || |
72 StartsWithASCII(source, "https://", true) || | 75 StartsWithASCII(source, "https://", true) || |
73 StartsWithASCII(source, "chrome://", true) || | 76 StartsWithASCII(source, "chrome://", true) || |
74 StartsWithASCII(source, "chrome-extension://", true) || | 77 StartsWithASCII(source, std::string(extensions::kExtensionScheme) + |
78 content::kStandardSchemeSeparator, true) || | |
75 StartsWithASCII(source, "chrome-extension-resource:", true)) { | 79 StartsWithASCII(source, "chrome-extension-resource:", true)) { |
76 continue; | 80 continue; |
77 } | 81 } |
78 | 82 |
79 // crbug.com/146487 | 83 // crbug.com/146487 |
80 if (type == Manifest::TYPE_EXTENSION || | 84 if (type == Manifest::TYPE_EXTENSION || |
81 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { | 85 type == Manifest::TYPE_LEGACY_PACKAGED_APP) { |
82 if (source == "'unsafe-eval'") | 86 if (source == "'unsafe-eval'") |
83 continue; | 87 continue; |
84 } | 88 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
193 } | 197 } |
194 } | 198 } |
195 } | 199 } |
196 | 200 |
197 return seen_sandbox; | 201 return seen_sandbox; |
198 } | 202 } |
199 | 203 |
200 } // namespace csp_validator | 204 } // namespace csp_validator |
201 | 205 |
202 } // namespace extensions | 206 } // namespace extensions |
OLD | NEW |