url_request_context_owner.h 1.1 KB

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