Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / browser / navigation_throttle.h
blobae5883b5e85828827cd63eba9fe5c87c2a72c167
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.
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
8 #include "content/common/content_export.h"
10 namespace content {
11 class NavigationHandle;
13 // A NavigationThrottle tracks and allows interaction with a navigation on the
14 // UI thread.
15 class CONTENT_EXPORT NavigationThrottle {
16 public:
17 // This is returned to the NavigationHandle to allow the navigation to
18 // proceed, or to cancel it.
19 enum ThrottleCheckResult {
20 PROCEED,
21 CANCEL_AND_IGNORE,
24 NavigationThrottle(NavigationHandle* navigation_handle);
25 virtual ~NavigationThrottle();
27 // Called when a network request is about to be made for this navigation.
28 virtual ThrottleCheckResult WillStartRequest();
30 // Called when a server redirect is received by the navigation.
31 virtual ThrottleCheckResult WillRedirectRequest();
33 // The NavigationHandle that is tracking the information related to this
34 // navigation.
35 NavigationHandle* navigation_handle() const { return navigation_handle_; }
37 private:
38 NavigationHandle* navigation_handle_;
41 } // namespace content
43 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_