| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/common/url_loader.mojom.h" | 11 #include "content/common/url_loader.mojom.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class ResourceContext; | 15 class ResourceContext; |
| 16 struct ResourceRequest; | 16 struct ResourceRequest; |
| 17 | 17 |
| 18 using StartLoaderCallback = | 18 using StartLoaderCallback = |
| 19 base::OnceCallback<void(mojom::URLLoaderAssociatedRequest request, | 19 base::OnceCallback<void(mojom::URLLoaderRequest request, |
| 20 mojom::URLLoaderClientPtr client)>; | 20 mojom::URLLoaderClientPtr client)>; |
| 21 | 21 |
| 22 using LoaderCallback = base::OnceCallback<void(StartLoaderCallback)>; | 22 using LoaderCallback = base::OnceCallback<void(StartLoaderCallback)>; |
| 23 | 23 |
| 24 // An instance of this class is a per-request object and kept around during | 24 // An instance of this class is a per-request object and kept around during |
| 25 // the lifetime of a request (including multiple redirect legs) on IO thread. | 25 // the lifetime of a request (including multiple redirect legs) on IO thread. |
| 26 class CONTENT_EXPORT URLLoaderRequestHandler { | 26 class CONTENT_EXPORT URLLoaderRequestHandler { |
| 27 public: | 27 public: |
| 28 URLLoaderRequestHandler() = default; | 28 URLLoaderRequestHandler() = default; |
| 29 virtual ~URLLoaderRequestHandler() = default; | 29 virtual ~URLLoaderRequestHandler() = default; |
| 30 | 30 |
| 31 // Calls |callback| with a non-null StartLoaderCallback if this handler | 31 // Calls |callback| with a non-null StartLoaderCallback if this handler |
| 32 // can handle the request, calls it with null callback otherwise. | 32 // can handle the request, calls it with null callback otherwise. |
| 33 virtual void MaybeCreateLoader(const ResourceRequest& resource_request, | 33 virtual void MaybeCreateLoader(const ResourceRequest& resource_request, |
| 34 ResourceContext* resource_context, | 34 ResourceContext* resource_context, |
| 35 LoaderCallback callback) = 0; | 35 LoaderCallback callback) = 0; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace content | 38 } // namespace content |
| 39 | 39 |
| 40 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ | 40 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ |
| OLD | NEW |