| 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" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
| 13 | 13 |
| 14 namespace content { | 14 namespace content { |
| 15 | 15 |
| 16 class ResourceMessageFilter; | 16 class ResourceMessageFilter; |
| 17 | 17 |
| 18 // This class is an implementation of mojom::URLLoaderFactory that creates | 18 // This class is an implementation of mojom::URLLoaderFactory that creates |
| 19 // a mojom::URLLoader. | 19 // a mojom::URLLoader. |
| 20 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { | 20 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { |
| 21 public: | 21 public: |
| 22 ~URLLoaderFactoryImpl() override; | 22 ~URLLoaderFactoryImpl() override; |
| 23 | 23 |
| 24 void CreateLoaderAndStart(mojom::URLLoaderRequest request, | 24 void CreateLoaderAndStart(mojom::URLLoaderRequest request, |
| 25 int32_t routing_id, | 25 int32_t routing_id, |
| 26 int32_t request_id, | 26 int32_t request_id, |
| 27 const ResourceRequest& url_request, | 27 const ResourceRequest& url_request, |
| 28 mojom::URLLoaderClientPtr client) override; | 28 mojom::URLLoaderClientPtr client) override; |
| 29 void SyncLoad(int32_t routing_id, |
| 30 int32_t request_id, |
| 31 const ResourceRequest& request, |
| 32 const SyncLoadCallback& callback) override; |
| 29 | 33 |
| 30 // Creates a URLLoaderFactoryImpl instance. The instance is held by the | 34 // Creates a URLLoaderFactoryImpl instance. The instance is held by the |
| 31 // StrongBinding in it, so this function doesn't return the instance. | 35 // StrongBinding in it, so this function doesn't return the instance. |
| 32 CONTENT_EXPORT static void Create( | 36 CONTENT_EXPORT static void Create( |
| 33 scoped_refptr<ResourceMessageFilter> resource_message_filter, | 37 scoped_refptr<ResourceMessageFilter> resource_message_filter, |
| 34 mojom::URLLoaderFactoryRequest request); | 38 mojom::URLLoaderFactoryRequest request); |
| 35 | 39 |
| 36 private: | 40 private: |
| 37 explicit URLLoaderFactoryImpl( | 41 explicit URLLoaderFactoryImpl( |
| 38 scoped_refptr<ResourceMessageFilter> resource_message_filter); | 42 scoped_refptr<ResourceMessageFilter> resource_message_filter); |
| 39 | 43 |
| 40 scoped_refptr<ResourceMessageFilter> resource_message_filter_; | 44 scoped_refptr<ResourceMessageFilter> resource_message_filter_; |
| 41 | 45 |
| 42 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); | 46 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); |
| 43 }; | 47 }; |
| 44 | 48 |
| 45 } // namespace content | 49 } // namespace content |
| 46 | 50 |
| 47 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ | 51 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ |
| OLD | NEW |