• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2018 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 CEF_LIBCEF_RENDERER_ALLOY_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_
6 #define CEF_LIBCEF_RENDERER_ALLOY_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_
7 
8 #include <memory>
9 #include <vector>
10 
11 #include "base/threading/thread_checker.h"
12 #include "third_party/blink/public/platform/url_loader_throttle_provider.h"
13 
14 // Instances must be constructed on the render thread, and then used and
15 // destructed on a single thread, which can be different from the render thread.
16 class CefURLLoaderThrottleProviderImpl
17     : public blink::URLLoaderThrottleProvider {
18  public:
19   explicit CefURLLoaderThrottleProviderImpl(
20       blink::URLLoaderThrottleProviderType type);
21 
22   CefURLLoaderThrottleProviderImpl& operator=(
23       const CefURLLoaderThrottleProviderImpl&) = delete;
24 
25   ~CefURLLoaderThrottleProviderImpl() override;
26 
27   // blink::URLLoaderThrottleProvider implementation.
28   std::unique_ptr<blink::URLLoaderThrottleProvider> Clone() override;
29   blink::WebVector<std::unique_ptr<blink::URLLoaderThrottle>> CreateThrottles(
30       int render_frame_id,
31       const blink::WebURLRequest& request) override;
32   void SetOnline(bool is_online) override;
33 
34  private:
35   // This copy constructor works in conjunction with Clone(), not intended for
36   // general use.
37   CefURLLoaderThrottleProviderImpl(
38       const CefURLLoaderThrottleProviderImpl& other);
39 
40   blink::URLLoaderThrottleProviderType type_;
41 
42   THREAD_CHECKER(thread_checker_);
43 };
44 
45 #endif  // CEF_LIBCEF_RENDERER_ALLOY_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_
46