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

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.CancelFromRenderer Created 4 years, 1 month 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.
kinuko 2016/11/18 01:29:21 nit: not really related to this CL but I felt it'd
horo 2016/11/18 02:02:51 Done.
19 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory { 19 class URLLoaderFactoryImpl final : public mojom::URLLoaderFactory {
20 public: 20 public:
21 ~URLLoaderFactoryImpl() override; 21 ~URLLoaderFactoryImpl() override;
22 22
23 void CreateLoaderAndStart( 23 void CreateLoaderAndStart(
24 mojom::URLLoaderAssociatedRequest request, 24 mojom::URLLoaderAssociatedRequest 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::URLLoaderClientAssociatedPtrInfo client_ptr_info) override; 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( 34 static void CreateLoaderAndStart(
35 const ResourceRequesterInfo* requester_info,
35 mojom::URLLoaderAssociatedRequest request, 36 mojom::URLLoaderAssociatedRequest request,
36 int32_t routing_id, 37 int32_t routing_id,
37 int32_t request_id, 38 int32_t request_id,
38 const ResourceRequest& url_request, 39 const ResourceRequest& url_request,
39 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info, 40 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info);
40 ResourceMessageFilter* filter); 41 static void SyncLoad(const ResourceRequesterInfo* requester_info,
41 static void SyncLoad(int32_t routing_id, 42 int32_t routing_id,
42 int32_t request_id, 43 int32_t request_id,
43 const ResourceRequest& request, 44 const ResourceRequest& request,
44 const SyncLoadCallback& callback, 45 const SyncLoadCallback& callback);
45 ResourceMessageFilter* filter);
46 46
47 // Creates a URLLoaderFactoryImpl instance. The instance is held by the 47 // Creates a URLLoaderFactoryImpl instance. The instance is held by the
48 // StrongBinding in it, so this function doesn't return the instance. 48 // StrongBinding in it, so this function doesn't return the instance.
49 CONTENT_EXPORT static void Create( 49 CONTENT_EXPORT static void Create(const ResourceRequesterInfo* requester_info,
50 scoped_refptr<ResourceMessageFilter> resource_message_filter, 50 mojom::URLLoaderFactoryRequest request);
51 mojom::URLLoaderFactoryRequest request);
52 51
53 private: 52 private:
54 explicit URLLoaderFactoryImpl( 53 explicit URLLoaderFactoryImpl(const ResourceRequesterInfo* requester_info);
55 scoped_refptr<ResourceMessageFilter> resource_message_filter);
56 54
57 scoped_refptr<ResourceMessageFilter> resource_message_filter_; 55 scoped_refptr<const ResourceRequesterInfo> requester_info_;
58 56
59 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl); 57 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryImpl);
60 }; 58 };
61 59
62 } // namespace content 60 } // namespace content
63 61
64 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_ 62 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_FACTORY_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698