Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: content/browser/loader/url_loader_factory_impl.h

Issue 2481093003: Introduce ResourceRequesterInfo to abstract the requester of resource request (Closed)
Patch Set: fix URLLoaderFactoryImplTest/URLLoaderFactoryImplTest.GetFailedResponse2 Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 12
13 namespace content { 13 namespace content {
14 14
15 class ResourceMessageFilter; 15 class ResourceRequesterInfo;
16 16
17 // This class is an implementation of mojom::URLLoaderFactory that creates 17 // This class is an implementation of mojom::URLLoaderFactory that creates
18 // a mojom::URLLoader. 18 // a mojom::URLLoader. This class is instantiated only for Service Worker
19 // navigation preload or test caseses.
19 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { 20 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory {
20 public: 21 public:
21 ~URLLoaderFactoryImpl() override; 22 ~URLLoaderFactoryImpl() override;
22 23
23 void CreateLoaderAndStart( 24 void CreateLoaderAndStart(
24 mojom::URLLoaderAssociatedRequest request, 25 mojom::URLLoaderAssociatedRequest request,
25 int32_t routing_id, 26 int32_t routing_id,
26 int32_t request_id, 27 int32_t request_id,
27 const ResourceRequest& url_request, 28 const ResourceRequest& url_request,
28 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info) override; 29 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info) override;
29 void SyncLoad(int32_t routing_id, 30 void SyncLoad(int32_t routing_id,
30 int32_t request_id, 31 int32_t request_id,
31 const ResourceRequest& request, 32 const ResourceRequest& request,
32 const SyncLoadCallback& callback) override; 33 const SyncLoadCallback& callback) override;
33 34
34 static void CreateLoaderAndStart( 35 static void CreateLoaderAndStart(
36 ResourceRequesterInfo* requester_info,
35 mojom::URLLoaderAssociatedRequest request, 37 mojom::URLLoaderAssociatedRequest request,
36 int32_t routing_id, 38 int32_t routing_id,
37 int32_t request_id, 39 int32_t request_id,
38 const ResourceRequest& url_request, 40 const ResourceRequest& url_request,
39 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info, 41 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info);
40 ResourceMessageFilter* filter); 42 static void SyncLoad(ResourceRequesterInfo* requester_info,
41 static void SyncLoad(int32_t routing_id, 43 int32_t routing_id,
42 int32_t request_id, 44 int32_t request_id,
43 const ResourceRequest& request, 45 const ResourceRequest& request,
44 const SyncLoadCallback& callback, 46 const SyncLoadCallback& callback);
45 ResourceMessageFilter* filter);
46 47
47 // Creates a URLLoaderFactoryImpl instance. The instance is held by the 48 // Creates a URLLoaderFactoryImpl instance. The instance is held by the
48 // StrongBinding in it, so this function doesn't return the instance. 49 // StrongBinding in it, so this function doesn't return the instance.
49 CONTENT_EXPORT static void Create( 50 CONTENT_EXPORT static void Create(
50 scoped_refptr<ResourceMessageFilter> resource_message_filter, 51 scoped_refptr<ResourceRequesterInfo> requester_info,
51 mojom::URLLoaderFactoryRequest request); 52 mojom::URLLoaderFactoryRequest request);
52 53
53 private: 54 private:
54 explicit URLLoaderFactoryImpl( 55 explicit URLLoaderFactoryImpl(
55 scoped_refptr<ResourceMessageFilter> resource_message_filter); 56 scoped_refptr<ResourceRequesterInfo> requester_info);
56 57
57 scoped_refptr<ResourceMessageFilter> resource_message_filter_; 58 scoped_refptr<ResourceRequesterInfo> requester_info_;
58 59
59 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); 60 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
60 }; 61 };
61 62
62 } // namespace content 63 } // namespace content
63 64
64 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ 65 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_
OLDNEW
« no previous file with comments | « content/browser/loader/sync_resource_handler.cc ('k') | content/browser/loader/url_loader_factory_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698