summaryrefslogtreecommitdiff
path: root/chromium/extensions/browser/extension_navigation_throttle.h
blob: afcb9e076c6919e1cefb976f49dc9533dc305940 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2016 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 EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_
#define EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_

#include "base/macros.h"
#include "content/public/browser/navigation_throttle.h"

namespace content {
class NavigationHandle;
}

namespace extensions {

// This class allows the extensions subsystem to have control over navigations
// and optionally cancel/block them. This is a UI thread class.
class ExtensionNavigationThrottle : public content::NavigationThrottle {
 public:
  explicit ExtensionNavigationThrottle(
      content::NavigationHandle* navigation_handle);
  ~ExtensionNavigationThrottle() override;

  // content::NavigationThrottle implementation:
  ThrottleCheckResult WillStartRequest() override;
  ThrottleCheckResult WillRedirectRequest() override;
  ThrottleCheckResult WillProcessResponse() override;
  const char* GetNameForLogging() override;

 private:
  // Shared throttle handler.
  ThrottleCheckResult WillStartOrRedirectRequest();

  DISALLOW_COPY_AND_ASSIGN(ExtensionNavigationThrottle);
};

}  // namespace extensions

#endif  // EXTENSIONS_BROWSER_EXTENSION_NAVIGATION_THROTTLE_H_