OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 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_XFO_THROTTLE_H_ |
| 6 #define CHROME_BROWSER_SECURITY_XFO_THROTTLE_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "content/public/browser/navigation_throttle.h" |
| 10 |
| 11 namespace content { |
| 12 class NavigationHandle; |
| 13 } |
| 14 |
| 15 namespace net { |
| 16 class HttpResponseHeaders; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class CONTENT_EXPORT XFOThrottle : public NavigationThrottle { |
| 22 public: |
| 23 enum HeaderDisposition { |
| 24 NOT_PRESENT, |
| 25 DENY, |
| 26 SAMEORIGIN, |
| 27 ALLOWALL, |
| 28 INVALID, |
| 29 CONFLICT |
| 30 }; |
| 31 |
| 32 explicit XFOThrottle(NavigationHandle* handle); |
| 33 ~XFOThrottle() override; |
| 34 |
| 35 NavigationThrottle::ThrottleCheckResult WillProcessResponse() override; |
| 36 static scoped_ptr<NavigationThrottle> MaybeCreateThrottleFor( |
| 37 NavigationHandle* handle); |
| 38 |
| 39 // Parses an 'X-Frame-Options' header. If the result is either CONFLICT |
| 40 // or INVALID, |failed_parse| will be populated with the value which caused |
| 41 // the parse error. |
| 42 static HeaderDisposition ParseHeader(const net::HttpResponseHeaders* headers, |
| 43 std::string* failed_parse); |
| 44 |
| 45 private: |
| 46 void ParseError(const std::string& value, HeaderDisposition disposition); |
| 47 void ConsoleError(HeaderDisposition disposition); |
| 48 |
| 49 DISALLOW_COPY_AND_ASSIGN(XFOThrottle); |
| 50 }; |
| 51 |
| 52 } // namespace content |
| 53 |
| 54 #endif // CHROME_BROWSER_SECURITY_XFO_THROTTLE_H_ |
OLD | NEW |