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

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

Issue 2481093003: Introduce ResourceRequesterInfo to abstract the requester of resource request (Closed)
Patch Set: incorporated yhirano & kinuko's comment 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "content/common/content_export.h"
10 #include "content/public/common/resource_type.h"
11
12 namespace net {
13 class URLRequestContext;
14 } // namespace net
15
16 namespace storage {
17 class FileSystemContext;
18 } // namespace storage
19
20 namespace content {
21 class BrowserMessageFilter;
22 class ChromeAppCacheService;
23 class ChromeBlobStorageContext;
24 class ResourceContext;
25 class ResourceMessageFilter;
26 class ServiceWorkerContextWrapper;
27
28 // This class represents the type of resource request.
29 // Currently there are three types:
30 // - Resource request from renderer processes.
31 // - Resource request for browser side navigation. (PlzNavigate).
32 // - Download request of page save request.
mmenke 2016/11/11 21:19:59 A downloads also use this path, no?
horo 2016/11/14 08:28:50 It was a typo. Fixed.
33 class CONTENT_EXPORT ResourceRequesterInfo {
34 public:
35 // Creates a ResourceRequesterInfo for renderer process initiated request.
36 // |filter| can't be null.
37 static std::unique_ptr<ResourceRequesterInfo> CreateForRenderer(
mmenke 2016/11/11 21:19:59 include <memory>
horo 2016/11/14 08:28:50 Done.
38 base::WeakPtr<ResourceMessageFilter> filter);
39
40 // Creates a ResourceRequesterInfo for renderer process initiated request
41 // without ResourceMessageFilter for unittests.
42 static std::unique_ptr<ResourceRequesterInfo> CreateForRendererTesting(
43 int child_id);
44
45 // Creates a ResourceRequesterInfo for browser side navigation request which
mmenke 2016/11/11 21:19:59 Need an article here, or make it plural. Same for
horo 2016/11/14 08:28:50 Done.
46 // is initiated by browser process.
47 static std::unique_ptr<ResourceRequesterInfo> CreateForBrowserSideNavigation(
48 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context);
49
50 // Creates a ResourceRequesterInfo for download or page save request.
51 static std::unique_ptr<ResourceRequesterInfo> CreateForDownloadOrPageSave(
52 int child_id);
53
54 virtual ~ResourceRequesterInfo() {}
55
56 virtual std::unique_ptr<ResourceRequesterInfo> clone() const = 0;
57
58 virtual bool IsRenderer() const = 0;
59 virtual bool IsBrowserSideNavigation() const = 0;
60
61 // Returns the renderer process associated with the request. Returns -1 for
62 // browser side navigation requests.
63 virtual int child_id() const = 0;
mmenke 2016/11/11 21:19:59 virtual methods shouldn't use this naming scheme.
horo 2016/11/14 08:28:50 Done.
64
65 // Returns the filter for sending IPC messages to the renderer process. This
66 // may return null if the process eixted. This method is available only for
67 // renderer requests.
68 virtual BrowserMessageFilter* filter() const = 0;
69
70 // Returns the ResourceContext and URLRequestContext associated to the
71 // request. Currently this method is available only for renderer requests.
72 virtual void GetContexts(ResourceType resource_type,
73 ResourceContext** resource_context,
74 net::URLRequestContext** request_context) const = 0;
mmenke 2016/11/11 21:19:59 This method and those below it all crash if the fi
horo 2016/11/14 08:28:50 Done.
75
76 // Returns the ChromeAppCacheService associated with the request. Currently
77 // this method is available only for renderer requests.
78 virtual ChromeAppCacheService* appcache_service() const = 0;
79
80 // Returns the ChromeBlobStorageContext associated with the request. Currently
81 // this method is available only for renderer requests.
82 virtual ChromeBlobStorageContext* blob_storage_context() const = 0;
83
84 // Returns the FileSystemContext associated with the request. Currently this
85 // method is available only for renderer requests.
86 virtual storage::FileSystemContext* file_system_context() const = 0;
87
88 // Returns the ServiceWorkerContext associated with the request. Currently
89 // this method is available for renderer requests and browser side navigation
90 // requests.
91 virtual ServiceWorkerContextWrapper* service_worker_context() const = 0;
92 };
93
94 } // namespace content
95
96 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUESTER_INFO_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698