Chromium Code Reviews| Index: components/navigation_interception/intercept_navigation_throttle.h |
| diff --git a/components/navigation_interception/intercept_navigation_throttle.h b/components/navigation_interception/intercept_navigation_throttle.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..23e53759846b5dfc1ea8702fb430f53939a62dde |
| --- /dev/null |
| +++ b/components/navigation_interception/intercept_navigation_throttle.h |
| @@ -0,0 +1,53 @@ |
| +// 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 COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |
| +#define COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback.h" |
| +#include "base/memory/weak_ptr.h" |
| +#include "content/public/browser/navigation_throttle.h" |
| + |
| +class GURL; |
| + |
| +namespace content { |
| +class NavigationHandle; |
| +class WebContents; |
| +} |
| + |
| +namespace navigation_interception { |
| + |
| +class NavigationParams; |
| + |
| +// This class allows the provider of the Callback to selectively ignore top |
| +// level navigations. |
| +class InterceptNavigationThrottle : public content::NavigationThrottle { |
| + public: |
| + typedef base::Callback<bool(content::WebContents* /* source */, |
| + const NavigationParams& /* navigation_params */)> |
|
carlosk
2015/08/28 16:40:24
For a future change we should consider replacing t
clamy
2015/09/03 15:30:51
Nope because they get converted to an equivalent j
|
| + CheckCallback; |
| + |
| + InterceptNavigationThrottle(content::NavigationHandle* navigation_handle, |
| + content::WebContents* web_contents, |
|
nasko
2015/08/31 23:25:15
I'd put web_contents as the first parameter, as it
clamy
2015/09/03 15:30:51
Done.
|
| + CheckCallback should_ignore_callback); |
| + ~InterceptNavigationThrottle() override; |
| + |
| + // content::NavigationThrottle implementation: |
| + ThrottleCheckResult WillStartRequest() override; |
| + ThrottleCheckResult WillRedirectRequest() override; |
| + |
| + private: |
| + ThrottleCheckResult CheckIfShouldIgnoreNavigation(bool is_redirect); |
| + |
| + content::WebContents* web_contents_; |
| + CheckCallback should_ignore_callback_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InterceptNavigationThrottle); |
| +}; |
| + |
| +} // namespace navigation_interception |
| + |
| +#endif // COMPONENTS_NAVIGATION_INTERCEPTION_INTERCEPT_NAVIGATION_THROTTLE_H_ |