1 // Copyright 2019 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 CONTENT_BROWSER_ABOUT_URL_LOADER_FACTORY_H_ 6 #define CONTENT_BROWSER_ABOUT_URL_LOADER_FACTORY_H_ 7 8 #include "base/macros.h" 9 #include "content/public/browser/non_network_url_loader_factory_base.h" 10 #include "mojo/public/cpp/bindings/pending_receiver.h" 11 #include "mojo/public/cpp/bindings/pending_remote.h" 12 13 namespace content { 14 15 // URLLoaderFactory for handling about: URLs. This treats everything as 16 // about:blank since no other about: features should be available to web 17 // content. 18 class AboutURLLoaderFactory : public NonNetworkURLLoaderFactoryBase { 19 public: 20 // Returns mojo::PendingRemote to a newly constructed AboutURLLoadedFactory. 21 // The factory is self-owned - it will delete itself once there are no more 22 // receivers (including the receiver associated with the returned 23 // mojo::PendingRemote and the receivers bound by the Clone method). 24 static mojo::PendingRemote<network::mojom::URLLoaderFactory> Create(); 25 26 private: 27 explicit AboutURLLoaderFactory( 28 mojo::PendingReceiver<network::mojom::URLLoaderFactory> factory_receiver); 29 30 // network::mojom::URLLoaderFactory: 31 ~AboutURLLoaderFactory() override; 32 void CreateLoaderAndStart( 33 mojo::PendingReceiver<network::mojom::URLLoader> loader, 34 int32_t routing_id, 35 int32_t request_id, 36 uint32_t options, 37 const network::ResourceRequest& request, 38 mojo::PendingRemote<network::mojom::URLLoaderClient> client, 39 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) 40 override; 41 42 DISALLOW_COPY_AND_ASSIGN(AboutURLLoaderFactory); 43 }; 44 45 } // namespace content 46 47 #endif // CONTENT_BROWSER_ABOUT_URL_LOADER_FACTORY_H_ 48