blob: c5202ae71d89d47990394423a87c943af488d66c [file]
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
#define CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_
#include "content/common/content_export.h"
namespace content {
class NavigationHandle;
// A NavigationThrottle tracks and allows interaction with a navigation on the
// UI thread.
class CONTENT_EXPORT NavigationThrottle {
public:
// This is returned to the NavigationHandle to allow the navigation to
// proceed, or to cancel it.
enum ThrottleCheckResult {
PROCEED,
DEFER,
CANCEL_AND_IGNORE,
};
NavigationThrottle(NavigationHandle* navigation_handle);
virtual ~NavigationThrottle();
// Called when a network request is about to be made for this navigation.
virtual ThrottleCheckResult WillStartRequest();
// Called when a server redirect is received by the navigation.
virtual ThrottleCheckResult WillRedirectRequest();
// The NavigationHandle that is tracking the information related to this
// navigation.
NavigationHandle* navigation_handle() const { return navigation_handle_; }
private:
NavigationHandle* navigation_handle_;
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_NAVIGATION_THROTTLE_H_