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 IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ | 5 #ifndef IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ |
6 #define IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ | 6 #define IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ |
7 | 7 |
8 #include "ios/net/clients/crn_forwarding_network_client.h" | 8 #import "ios/net/clients/crn_forwarding_network_client.h" |
9 | 9 |
10 namespace web { | 10 namespace web { |
11 // Used for UMA histogram and must be kept in sync with the histograms.xml file. | 11 // Used for UMA histogram and must be kept in sync with the histograms.xml file. |
12 enum class InjectionResult : int { | 12 enum class InjectionResult : int { |
13 SUCCESS_INJECTED, | 13 SUCCESS_INJECTED, |
14 FAIL_FIND_INJECTION_LOCATION, | 14 FAIL_FIND_INJECTION_LOCATION, |
15 FAIL_INSUFFICIENT_CONTENT_LENGTH, | 15 FAIL_INSUFFICIENT_CONTENT_LENGTH, |
16 FAIL_SELF_REFERRER, | 16 FAIL_SELF_REFERRER, |
17 | 17 |
18 INJECTION_RESULT_COUNT | 18 INJECTION_RESULT_COUNT |
19 // INJECTION_RESULT_COUNT must always be the last element in this enum | 19 // INJECTION_RESULT_COUNT must always be the last element in this enum |
20 }; | 20 }; |
21 } // namespace web | 21 } // namespace web |
22 | 22 |
23 // Network client that injects a script tag into HTML and XHTML documents. | 23 // Network client that injects a script tag into HTML and XHTML documents. |
24 @interface CRWJSInjectionNetworkClient : CRNForwardingNetworkClient | 24 @interface CRWJSInjectionNetworkClient : CRNForwardingNetworkClient |
25 | 25 |
26 // Returns YES if |response| has a "Content-Type" header approriate for | 26 // Returns YES if |response| has a "Content-Type" header approriate for |
27 // injection. At this time this means if the "Content-Type" header is HTML | 27 // injection. At this time this means if the "Content-Type" header is HTML |
28 // or XHTML. | 28 // or XHTML. |
29 + (BOOL)canHandleResponse:(NSURLResponse*)response; | 29 + (BOOL)canHandleResponse:(NSURLResponse*)response; |
30 | 30 |
31 @end | 31 @end |
32 | 32 |
33 #endif // IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ | 33 #endif // IOS_WEB_NET_CLIENTS_CRW_JS_INJECTION_NETWORK_CLIENT_H_ |
OLD | NEW |