OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_SECURITY_ANCESTOR_THROTTLE_H_ | |
6 #define CHROME_BROWSER_SECURITY_ANCESTOR_THROTTLE_H_ | |
7 | |
8 #include "base/gtest_prod_util.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 #include "content/public/browser/navigation_throttle.h" | |
11 | |
12 namespace content { | |
13 class NavigationHandle; | |
14 } | |
15 | |
16 namespace net { | |
17 class HttpResponseHeaders; | |
18 } | |
19 | |
20 namespace content { | |
21 | |
22 // An AncestorThrottle is responsible for enforcing a resource's embedding | |
23 // rules, and blocking requests which violate them. | |
24 class CONTENT_EXPORT AncestorThrottle : public NavigationThrottle { | |
25 public: | |
26 enum HeaderDisposition { | |
27 NONE, | |
28 DENY, | |
29 SAMEORIGIN, | |
30 ALLOWALL, | |
31 INVALID, | |
32 CONFLICT | |
33 }; | |
34 | |
35 static scoped_ptr<NavigationThrottle> MaybeCreateThrottleFor( | |
36 NavigationHandle* handle); | |
37 | |
38 explicit AncestorThrottle(NavigationHandle* handle); | |
39 ~AncestorThrottle() override; | |
40 | |
41 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override; | |
42 | |
43 private: | |
44 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, Parsing); | |
45 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, ParseErrors); | |
46 | |
47 void ParseError(const std::string& value, HeaderDisposition disposition); | |
48 void ConsoleError(HeaderDisposition disposition); | |
49 | |
50 // Parses an 'X-Frame-Options' header. If the result is either CONFLICT | |
51 // or INVALID, |failed_parse| will be populated with the value which caused | |
52 // the parse error. | |
53 HeaderDisposition ParseHeader(const net::HttpResponseHeaders* headers, | |
54 std::string* failed_parse); | |
nasko
2016/02/12 23:21:40
nit: failed_parsing?
Mike West
2016/04/12 20:13:30
Renamed to match implementation.
| |
55 | |
56 DISALLOW_COPY_AND_ASSIGN(AncestorThrottle); | |
57 }; | |
58 | |
59 } // namespace content | |
60 | |
61 #endif // CHROME_BROWSER_SECURITY_Ancestor_THROTTLE_H_ | |
OLD | NEW |