| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ |
| 6 #define EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/callback.h" |
| 11 #include "net/url_request/url_request_job_factory.h" | 12 #include "net/url_request/url_request_job_factory.h" |
| 12 | 13 |
| 13 namespace base { | 14 namespace base { |
| 15 class FilePath; |
| 14 class Time; | 16 class Time; |
| 15 } | 17 } |
| 16 | 18 |
| 17 namespace net { | 19 namespace net { |
| 20 class URLRequest; |
| 21 class URLRequestJob; |
| 18 class HttpResponseHeaders; | 22 class HttpResponseHeaders; |
| 19 } | 23 } |
| 20 | 24 |
| 21 namespace extensions { | 25 namespace extensions { |
| 26 class InfoMap; |
| 22 | 27 |
| 23 class InfoMap; | 28 using ExtensionProtocolTestHandler = |
| 29 base::Callback<net::URLRequestJob*(net::URLRequest*, |
| 30 net::NetworkDelegate*, |
| 31 const base::FilePath&)>; |
| 24 | 32 |
| 25 // Builds HTTP headers for an extension request. Hashes the time to avoid | 33 // Builds HTTP headers for an extension request. Hashes the time to avoid |
| 26 // exposing the exact user installation time of the extension. | 34 // exposing the exact user installation time of the extension. |
| 27 net::HttpResponseHeaders* BuildHttpHeaders( | 35 net::HttpResponseHeaders* BuildHttpHeaders( |
| 28 const std::string& content_security_policy, | 36 const std::string& content_security_policy, |
| 29 bool send_cors_header, | 37 bool send_cors_header, |
| 30 const base::Time& last_modified_time); | 38 const base::Time& last_modified_time); |
| 31 | 39 |
| 32 // Creates the handlers for the chrome-extension:// scheme. Pass true for | 40 // Creates the handlers for the chrome-extension:// scheme. Pass true for |
| 33 // |is_incognito| only for incognito profiles and not for Chrome OS guest mode | 41 // |is_incognito| only for incognito profiles and not for Chrome OS guest mode |
| 34 // profiles. | 42 // profiles. |
| 35 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> | 43 std::unique_ptr<net::URLRequestJobFactory::ProtocolHandler> |
| 36 CreateExtensionProtocolHandler(bool is_incognito, InfoMap* extension_info_map); | 44 CreateExtensionProtocolHandler(bool is_incognito, InfoMap* extension_info_map); |
| 37 | 45 |
| 46 // Allows tests to set a special handler for chrome-extension:// urls. Note |
| 47 // that this goes through all the normal security checks; it's essentially a |
| 48 // way to map extra resources to be included in extensions. |
| 49 void SetExtensionProtocolTestHandler(ExtensionProtocolTestHandler* handler); |
| 50 |
| 38 } // namespace extensions | 51 } // namespace extensions |
| 39 | 52 |
| 40 #endif // EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ | 53 #endif // EXTENSIONS_BROWSER_EXTENSION_PROTOCOLS_H_ |
| OLD | NEW |