Chromium Code Reviews| Index: url/url_util.cc |
| diff --git a/url/url_util.cc b/url/url_util.cc |
| index a79e114fed36ae6fdd9822ebdb9a0c49a948ee26..a17ec4d86d4c1269af1858fe695bfc064310a4b4 100644 |
| --- a/url/url_util.cc |
| +++ b/url/url_util.cc |
| @@ -81,6 +81,10 @@ const char* kWebStorageSchemes[] = { |
| kWssScheme, |
| }; |
| +const char* kEmptyDocumentSchemes[] = { |
| + kAboutScheme, |
|
brettw
2017/03/23 22:02:13
Indenting.
jam
2017/03/23 22:36:04
I'll do this in a followup if you don't mind, just
|
| +}; |
| + |
| bool initialized = false; |
| // Lists of the currently installed standard and referrer schemes. These lists |
| @@ -96,6 +100,7 @@ std::vector<std::string>* no_access_schemes = nullptr; |
| std::vector<std::string>* cors_enabled_schemes = nullptr; |
| std::vector<std::string>* web_storage_schemes = nullptr; |
| std::vector<std::string>* csp_bypassing_schemes = nullptr; |
| +std::vector<std::string>* empty_document_schemes = nullptr; |
| // See the LockSchemeRegistries declaration in the header. |
| bool scheme_registries_locked = false; |
| @@ -525,6 +530,8 @@ void Initialize() { |
| InitSchemes(&web_storage_schemes, kWebStorageSchemes, |
| arraysize(kWebStorageSchemes)); |
| InitSchemes(&csp_bypassing_schemes, nullptr, 0); |
| + InitSchemes(&empty_document_schemes, kEmptyDocumentSchemes, |
| + arraysize(kEmptyDocumentSchemes)); |
| initialized = true; |
| } |
| @@ -546,6 +553,8 @@ void Shutdown() { |
| web_storage_schemes = nullptr; |
| delete csp_bypassing_schemes; |
| csp_bypassing_schemes = nullptr; |
| + delete empty_document_schemes; |
| + empty_document_schemes = nullptr; |
| } |
| void AddStandardScheme(const char* new_scheme, SchemeType type) { |
| @@ -618,6 +627,16 @@ const std::vector<std::string>& GetCSPBypassingSchemes() { |
| return *csp_bypassing_schemes; |
| } |
| +void AddEmptyDocumentScheme(const char* new_scheme) { |
| + Initialize(); |
| + DoAddScheme(new_scheme, empty_document_schemes); |
| +} |
| + |
| +const std::vector<std::string>& GetEmptyDocumentSchemes() { |
| + Initialize(); |
| + return *empty_document_schemes; |
| +} |
| + |
| void LockSchemeRegistries() { |
| scheme_registries_locked = true; |
| } |