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

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

Issue 2982363002: Add support for fallback content for the frame. This includes main and subframes. (Closed)
Patch Set: rebase to tip Created 3 years, 4 months 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_REQUEST_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_
6 #define CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ 6 #define CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include "base/callback_forward.h" 9 #include "base/callback_forward.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "content/public/common/url_loader.mojom.h" 11 #include "content/public/common/url_loader.mojom.h"
12 #include "content/public/common/url_loader_factory.mojom.h" 12 #include "content/public/common/url_loader_factory.mojom.h"
13 #include "net/url_request/redirect_info.h"
13 14
14 namespace content { 15 namespace content {
15 16
16 class ResourceContext; 17 class ResourceContext;
17 struct ResourceRequest; 18 struct ResourceRequest;
18 19
19 using StartLoaderCallback = 20 using StartLoaderCallback =
20 base::OnceCallback<void(mojom::URLLoaderRequest request, 21 base::OnceCallback<void(mojom::URLLoaderRequest request,
21 mojom::URLLoaderClientPtr client)>; 22 mojom::URLLoaderClientPtr client)>;
22 23
23 using LoaderCallback = base::OnceCallback<void(StartLoaderCallback)>; 24 using LoaderCallback = base::OnceCallback<void(StartLoaderCallback)>;
24 25
25 // An instance of this class is a per-request object and kept around during 26 // An instance of this class is a per-request object and kept around during
26 // the lifetime of a request (including multiple redirect legs) on IO thread. 27 // the lifetime of a request (including multiple redirect legs) on IO thread.
27 class CONTENT_EXPORT URLLoaderRequestHandler { 28 class CONTENT_EXPORT URLLoaderRequestHandler {
28 public: 29 public:
29 URLLoaderRequestHandler() = default; 30 URLLoaderRequestHandler() = default;
30 virtual ~URLLoaderRequestHandler() = default; 31 virtual ~URLLoaderRequestHandler() = default;
31 32
32 // Calls |callback| with a non-null StartLoaderCallback if this handler 33 // Calls |callback| with a non-null StartLoaderCallback if this handler
33 // can handle the request, calls it with null callback otherwise. 34 // can handle the request, calls it with null callback otherwise.
34 virtual void MaybeCreateLoader(const ResourceRequest& resource_request, 35 virtual void MaybeCreateLoader(const ResourceRequest& resource_request,
35 ResourceContext* resource_context, 36 ResourceContext* resource_context,
36 LoaderCallback callback) = 0; 37 LoaderCallback callback) = 0;
37 38
38 // Returns the URLLoaderFactory if any to be used for subsequent URL requests 39 // Returns the URLLoaderFactory if any to be used for subsequent URL requests
39 // going forward. Subclasses who want to handle subresource requests etc may 40 // going forward. Subclasses who want to handle subresource requests etc may
40 // want to override this to return a custom factory. 41 // want to override this to return a custom factory.
41 virtual mojom::URLLoaderFactoryPtr MaybeCreateSubresourceFactory(); 42 virtual mojom::URLLoaderFactoryPtr MaybeCreateSubresourceFactory();
43
44 // Returns true if the handler creates a loader for the |response| passed.
45 // An example of where this is used is AppCache, where the handler returns
46 // fallback content for the response passed in.
47 // The URLLoader interface pointer is returned in the |loader| parameter.
48 // The interface request for the URLLoaderClient is returned in the
49 // |client_request| parameter.
50 virtual bool MaybeCreateLoaderForResponse(
51 const ResourceResponseHead& response,
52 mojom::URLLoaderPtr* loader,
53 mojom::URLLoaderClientRequest* client_request);
42 }; 54 };
43 55
44 } // namespace content 56 } // namespace content
45 57
46 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_ 58 #endif // CONTENT_BROWSER_LOADER_URL_LOADER_REQUEST_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_network_service.cc ('k') | content/browser/loader/url_loader_request_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698