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_ | |
nasko
2016/04/12 22:21:19
Mismatched include guard and file path/name.
Mike West
2016/04/13 13:28:08
Done, thanks!
nasko
2016/04/29 18:56:02
Hmm, I must be getting really old. I don't see thi
Mike West
2016/05/02 09:37:51
Yeah. Sorry. I'm old too and forgot. :/
| |
6 #define CHROME_BROWSER_SECURITY_ANCESTOR_THROTTLE_H_ | |
7 | |
8 #include <memory> | |
9 | |
10 #include "base/gtest_prod_util.h" | |
11 #include "base/macros.h" | |
12 #include "content/public/browser/navigation_throttle.h" | |
13 | |
14 namespace content { | |
15 class NavigationHandle; | |
16 } | |
17 | |
18 namespace net { | |
19 class HttpResponseHeaders; | |
20 } | |
21 | |
22 namespace content { | |
23 | |
24 // An AncestorThrottle is responsible for enforcing a resource's embedding | |
25 // rules, and blocking requests which violate them. | |
26 class CONTENT_EXPORT AncestorThrottle : public NavigationThrottle { | |
27 public: | |
28 enum HeaderDisposition { | |
29 NONE, | |
30 DENY, | |
31 SAMEORIGIN, | |
32 ALLOWALL, | |
33 INVALID, | |
34 CONFLICT | |
35 }; | |
36 | |
37 static std::unique_ptr<NavigationThrottle> MaybeCreateThrottleFor( | |
38 NavigationHandle* handle); | |
39 | |
40 explicit AncestorThrottle(NavigationHandle* handle); | |
41 ~AncestorThrottle() override; | |
42 | |
43 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override; | |
44 | |
45 private: | |
46 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, Parsing); | |
47 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, ParseErrors); | |
48 | |
49 void ParseError(const std::string& value, HeaderDisposition disposition); | |
50 void ConsoleError(HeaderDisposition disposition); | |
51 | |
52 // Parses an 'X-Frame-Options' header. If the result is either CONFLICT | |
53 // or INVALID, |header_value| will be populated with the value which caused | |
54 // the parse error. | |
55 HeaderDisposition ParseHeader(const net::HttpResponseHeaders* headers, | |
56 std::string* header_value); | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(AncestorThrottle); | |
59 }; | |
60 | |
61 } // namespace content | |
62 | |
63 #endif // CHROME_BROWSER_SECURITY_Ancestor_THROTTLE_H_ | |
OLD | NEW |