nasko | b9164c4 | 2016-06-07 01:21:35 | [diff] [blame] | 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 EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_ |
| 6 | #define EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | #include "content/public/browser/navigation_throttle.h" |
| 10 | |
| 11 | namespace content { |
| 12 | class NavigationHandle; |
| 13 | } |
| 14 | |
| 15 | namespace extensions { |
| 16 | |
nasko | b9164c4 | 2016-06-07 01:21:35 | [diff] [blame] | 17 | // This class allows the extensions subsystem to have control over navigations |
| 18 | // and optionally cancel/block them. This is a UI thread class. |
| 19 | class ExtensionNavigationThrottle : public content::NavigationThrottle { |
| 20 | public: |
| 21 | explicit ExtensionNavigationThrottle( |
| 22 | content::NavigationHandle* navigation_handle); |
| 23 | ~ExtensionNavigationThrottle() override; |
| 24 | |
| 25 | // content::NavigationThrottle implementation: |
| 26 | ThrottleCheckResult WillStartRequest() override; |
nick | 7a719cd | 2017-05-23 20:51:26 | [diff] [blame] | 27 | ThrottleCheckResult WillRedirectRequest() override; |
nasko | d818557 | 2017-04-24 17:17:17 | [diff] [blame] | 28 | const char* GetNameForLogging() override; |
nasko | b9164c4 | 2016-06-07 01:21:35 | [diff] [blame] | 29 | |
| 30 | private: |
nick | 7a719cd | 2017-05-23 20:51:26 | [diff] [blame] | 31 | // Shared throttle handler. |
| 32 | ThrottleCheckResult WillStartOrRedirectRequest(); |
| 33 | |
nasko | b9164c4 | 2016-06-07 01:21:35 | [diff] [blame] | 34 | DISALLOW_COPY_AND_ASSIGN(ExtensionNavigationThrottle); |
| 35 | }; |
| 36 | |
| 37 | } // namespace extensions |
| 38 | |
| 39 | #endif // EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_ |