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

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

Issue 2797443005: PlzNavigate data pipe
Patch Set: cleanup Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_NAVIGATION_URL_LOADER_DELEGATE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "mojo/public/cpp/system/data_pipe.h"
13 14
14 namespace net { 15 namespace net {
15 struct RedirectInfo; 16 struct RedirectInfo;
16 } 17 }
17 18
18 namespace content { 19 namespace content {
19 20
20 class NavigationData; 21 class NavigationData;
21 class StreamHandle;
22 struct GlobalRequestID; 22 struct GlobalRequestID;
23 struct ResourceResponse; 23 struct ResourceResponse;
24 struct SSLStatus; 24 struct SSLStatus;
25 25
26 // PlzNavigate: The delegate interface to NavigationURLLoader. 26 // PlzNavigate: The delegate interface to NavigationURLLoader.
27 class CONTENT_EXPORT NavigationURLLoaderDelegate { 27 class CONTENT_EXPORT NavigationURLLoaderDelegate {
28 public: 28 public:
29 // Called when the request is redirected. Call FollowRedirect to continue 29 // Called when the request is redirected. Call FollowRedirect to continue
30 // processing the request. 30 // processing the request.
31 virtual void OnRequestRedirected( 31 virtual void OnRequestRedirected(
32 const net::RedirectInfo& redirect_info, 32 const net::RedirectInfo& redirect_info,
33 const scoped_refptr<ResourceResponse>& response) = 0; 33 const scoped_refptr<ResourceResponse>& response) = 0;
34 34
35 // Called when the request receives its response. No further calls will be 35 // Called when the request receives its response. No further calls will be
36 // made to the delegate. The response body is returned as a stream in 36 // made to the delegate. The response body is returned as a stream in
37 // |body_stream|. |navigation_data| is passed to the NavigationHandle. 37 // |body_stream|. |navigation_data| is passed to the NavigationHandle.
38 virtual void OnResponseStarted( 38 virtual void OnResponseStarted(
39 const scoped_refptr<ResourceResponse>& response, 39 const scoped_refptr<ResourceResponse>& response,
40 std::unique_ptr<StreamHandle> body_stream, 40 mojo::ScopedDataPipeConsumerHandle consumer_handle,
41 const SSLStatus& ssl_status, 41 const SSLStatus& ssl_status,
42 std::unique_ptr<NavigationData> navigation_data, 42 std::unique_ptr<NavigationData> navigation_data,
43 const GlobalRequestID& request_id, 43 const GlobalRequestID& request_id,
44 bool is_download, 44 bool is_download,
45 bool is_stream) = 0; 45 bool is_stream) = 0;
46 46
47 // Called if the request fails before receving a response. |net_error| is a 47 // Called if the request fails before receving a response. |net_error| is a
48 // network error code for the failure. |has_stale_copy_in_cache| is true if 48 // network error code for the failure. |has_stale_copy_in_cache| is true if
49 // there is a stale copy of the unreachable page in cache. 49 // there is a stale copy of the unreachable page in cache.
50 virtual void OnRequestFailed(bool has_stale_copy_in_cache, int net_error) = 0; 50 virtual void OnRequestFailed(bool has_stale_copy_in_cache, int net_error) = 0;
51 51
52 // Called after the network request has begun on the IO thread at time 52 // Called after the network request has begun on the IO thread at time
53 // |timestamp|. This is just a thread hop but is used to compare timing 53 // |timestamp|. This is just a thread hop but is used to compare timing
54 // against the pre-PlzNavigate codepath which didn't start the network request 54 // against the pre-PlzNavigate codepath which didn't start the network request
55 // until after the renderer was initialized. 55 // until after the renderer was initialized.
56 virtual void OnRequestStarted(base::TimeTicks timestamp) = 0; 56 virtual void OnRequestStarted(base::TimeTicks timestamp) = 0;
57 57
58 protected: 58 protected:
59 NavigationURLLoaderDelegate() {} 59 NavigationURLLoaderDelegate() {}
60 virtual ~NavigationURLLoaderDelegate() {} 60 virtual ~NavigationURLLoaderDelegate() {}
61 61
62 private: 62 private:
63 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderDelegate); 63 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderDelegate);
64 }; 64 };
65 65
66 } // namespace content 66 } // namespace content
67 67
68 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_ 68 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_resource_handler.cc ('k') | content/browser/loader/navigation_url_loader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698