Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(169)

Side by Side Diff: content/browser/frame_host/ancestor_throttle.h

Issue 1617043002: Introduce AncestorThrottle, which will process 'X-Frame-Options' headers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@block-response
Patch Set: Hrm. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 <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 IGNORE
36 };
37
38 static std::unique_ptr<NavigationThrottle> MaybeCreateThrottleFor(
39 NavigationHandle* handle);
40
41 explicit AncestorThrottle(NavigationHandle* handle);
42 ~AncestorThrottle() override;
43
44 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override;
45
46 private:
47 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, ParsingXFrameOptions);
48 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest, ErrorsParsingXFrameOptions);
49 FRIEND_TEST_ALL_PREFIXES(AncestorThrottleTest,
50 IgnoreWhenFrameAncestorsPresent);
51
52 void ParseError(const std::string& value, HeaderDisposition disposition);
53 void ConsoleError(HeaderDisposition disposition);
54
55 // Parses an 'X-Frame-Options' header. If the result is either CONFLICT
56 // or INVALID, |header_value| will be populated with the value which caused
57 // the parse error.
58 HeaderDisposition ParseHeader(const net::HttpResponseHeaders* headers,
59 std::string* header_value);
60
61 DISALLOW_COPY_AND_ASSIGN(AncestorThrottle);
62 };
63
64 } // namespace content
65
66 #endif // CHROME_BROWSER_SECURITY_Ancestor_THROTTLE_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/ancestor_throttle.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698