1 // Copyright 2017 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 SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_ 6 #define SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_ 7 8 #include <memory> 9 10 #include "base/component_export.h" 11 12 class PrefService; 13 14 namespace net { 15 class URLRequestContext; 16 } 17 18 namespace network { 19 20 // This owns a net::URLRequestContext and other state that's used with it. COMPONENT_EXPORT(NETWORK_SERVICE)21struct COMPONENT_EXPORT(NETWORK_SERVICE) URLRequestContextOwner { 22 URLRequestContextOwner(); 23 URLRequestContextOwner( 24 std::unique_ptr<PrefService> pref_service, 25 std::unique_ptr<net::URLRequestContext> url_request_context); 26 ~URLRequestContextOwner(); 27 URLRequestContextOwner(URLRequestContextOwner&& other); 28 URLRequestContextOwner& operator=(URLRequestContextOwner&& other); 29 30 // This needs to be destroyed after the URLRequestContext. 31 std::unique_ptr<PrefService> pref_service; 32 33 std::unique_ptr<net::URLRequestContext> url_request_context; 34 }; 35 36 } // namespace network 37 38 #endif // SERVICES_NETWORK_URL_REQUEST_CONTEXT_OWNER_H_ 39