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() override; 23 24 // blink::URLLoaderThrottleProvider implementation. 25 std::unique_ptr<blink::URLLoaderThrottleProvider> Clone() override; 26 blink::WebVector<std::unique_ptr<blink::URLLoaderThrottle>> CreateThrottles( 27 int render_frame_id, 28 const blink::WebURLRequest& request) override; 29 void SetOnline(bool is_online) override; 30 31 private: 32 // This copy constructor works in conjunction with Clone(), not intended for 33 // general use. 34 CefURLLoaderThrottleProviderImpl( 35 const CefURLLoaderThrottleProviderImpl& other); 36 37 blink::URLLoaderThrottleProviderType type_; 38 39 THREAD_CHECKER(thread_checker_); 40 41 DISALLOW_ASSIGN(CefURLLoaderThrottleProviderImpl); 42 }; 43 44 #endif // CEF_LIBCEF_RENDERER_ALLOY_URL_LOADER_THROTTLE_PROVIDER_IMPL_H_ 45