| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_FACTORY_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ | 6 #define CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
| 11 #include "content/common/url_loader_factory.mojom.h" | 11 #include "content/common/url_loader_factory.mojom.h" |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | |
| 13 | 12 |
| 14 namespace content { | 13 namespace content { |
| 15 | 14 |
| 16 class ResourceMessageFilter; | 15 class ResourceMessageFilter; |
| 17 | 16 |
| 18 // This class is an implementation of mojom::URLLoaderFactory that creates | 17 // This class is an implementation of mojom::URLLoaderFactory that creates |
| 19 // a mojom::URLLoader. | 18 // a mojom::URLLoader. |
| 20 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { | 19 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { |
| 21 public: | 20 public: |
| 22 ~URLLoaderFactoryImpl() override; | 21 ~URLLoaderFactoryImpl() override; |
| 23 | 22 |
| 24 void CreateLoaderAndStart(mojom::URLLoaderRequest request, | 23 void CreateLoaderAndStart( |
| 25 int32_t routing_id, | 24 mojom::URLLoaderAssociatedRequest request, |
| 26 int32_t request_id, | 25 int32_t routing_id, |
| 27 const ResourceRequest& url_request, | 26 int32_t request_id, |
| 28 mojom::URLLoaderClientPtr client) override; | 27 const ResourceRequest& url_request, |
| 28 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info) override; |
| 29 void SyncLoad(int32_t routing_id, | 29 void SyncLoad(int32_t routing_id, |
| 30 int32_t request_id, | 30 int32_t request_id, |
| 31 const ResourceRequest& request, | 31 const ResourceRequest& request, |
| 32 const SyncLoadCallback& callback) override; | 32 const SyncLoadCallback& callback) override; |
| 33 | 33 |
| 34 static void CreateLoaderAndStart(mojom::URLLoaderRequest request, | 34 static void CreateLoaderAndStart( |
| 35 int32_t routing_id, | 35 mojom::URLLoaderAssociatedRequest request, |
| 36 int32_t request_id, | 36 int32_t routing_id, |
| 37 const ResourceRequest& url_request, | 37 int32_t request_id, |
| 38 mojom::URLLoaderClientPtr client, | 38 const ResourceRequest& url_request, |
| 39 ResourceMessageFilter* filter); | 39 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info, |
| 40 ResourceMessageFilter* filter); |
| 40 static void SyncLoad(int32_t routing_id, | 41 static void SyncLoad(int32_t routing_id, |
| 41 int32_t request_id, | 42 int32_t request_id, |
| 42 const ResourceRequest& request, | 43 const ResourceRequest& request, |
| 43 const SyncLoadCallback& callback, | 44 const SyncLoadCallback& callback, |
| 44 ResourceMessageFilter* filter); | 45 ResourceMessageFilter* filter); |
| 45 | 46 |
| 46 // Creates a URLLoaderFactoryImpl instance. The instance is held by the | 47 // Creates a URLLoaderFactoryImpl instance. The instance is held by the |
| 47 // StrongBinding in it, so this function doesn't return the instance. | 48 // StrongBinding in it, so this function doesn't return the instance. |
| 48 CONTENT_EXPORT static void Create( | 49 CONTENT_EXPORT static void Create( |
| 49 scoped_refptr<ResourceMessageFilter> resource_message_filter, | 50 scoped_refptr<ResourceMessageFilter> resource_message_filter, |
| 50 mojom::URLLoaderFactoryRequest request); | 51 mojom::URLLoaderFactoryRequest request); |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 explicit URLLoaderFactoryImpl( | 54 explicit URLLoaderFactoryImpl( |
| 54 scoped_refptr<ResourceMessageFilter> resource_message_filter); | 55 scoped_refptr<ResourceMessageFilter> resource_message_filter); |
| 55 | 56 |
| 56 scoped_refptr<ResourceMessageFilter> resource_message_filter_; | 57 scoped_refptr<ResourceMessageFilter> resource_message_filter_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); | 59 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace content | 62 } // namespace content |
| 62 | 63 |
| 63 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ | 64 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ |
| OLD | NEW |