OLD | NEW |
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 | 13 |
14 namespace net { | 14 namespace net { |
15 struct RedirectInfo; | 15 struct RedirectInfo; |
16 } | 16 } |
17 | 17 |
18 namespace content { | 18 namespace content { |
19 | 19 |
20 class NavigationData; | 20 class NavigationData; |
21 class StreamHandle; | 21 class StreamHandle; |
22 struct ResourceResponse; | 22 struct ResourceResponse; |
| 23 struct SSLStatus; |
23 | 24 |
24 // PlzNavigate: The delegate interface to NavigationURLLoader. | 25 // PlzNavigate: The delegate interface to NavigationURLLoader. |
25 class CONTENT_EXPORT NavigationURLLoaderDelegate { | 26 class CONTENT_EXPORT NavigationURLLoaderDelegate { |
26 public: | 27 public: |
27 // Called when the request is redirected. Call FollowRedirect to continue | 28 // Called when the request is redirected. Call FollowRedirect to continue |
28 // processing the request. | 29 // processing the request. |
29 virtual void OnRequestRedirected( | 30 virtual void OnRequestRedirected( |
30 const net::RedirectInfo& redirect_info, | 31 const net::RedirectInfo& redirect_info, |
31 const scoped_refptr<ResourceResponse>& response) = 0; | 32 const scoped_refptr<ResourceResponse>& response) = 0; |
32 | 33 |
33 // Called when the request receives its response. No further calls will be | 34 // Called when the request receives its response. No further calls will be |
34 // made to the delegate. The response body is returned as a stream in | 35 // made to the delegate. The response body is returned as a stream in |
35 // |body_stream|. |navigation_data| is passed to the NavigationHandle. | 36 // |body_stream|. |navigation_data| is passed to the NavigationHandle. |
36 virtual void OnResponseStarted( | 37 virtual void OnResponseStarted( |
37 const scoped_refptr<ResourceResponse>& response, | 38 const scoped_refptr<ResourceResponse>& response, |
38 std::unique_ptr<StreamHandle> body_stream, | 39 std::unique_ptr<StreamHandle> body_stream, |
| 40 const SSLStatus& ssl_status, |
39 std::unique_ptr<NavigationData> navigation_data) = 0; | 41 std::unique_ptr<NavigationData> navigation_data) = 0; |
40 | 42 |
41 // Called if the request fails before receving a response. |net_error| is a | 43 // Called if the request fails before receving a response. |net_error| is a |
42 // network error code for the failure. |has_stale_copy_in_cache| is true if | 44 // network error code for the failure. |has_stale_copy_in_cache| is true if |
43 // there is a stale copy of the unreachable page in cache. | 45 // there is a stale copy of the unreachable page in cache. |
44 virtual void OnRequestFailed(bool has_stale_copy_in_cache, int net_error) = 0; | 46 virtual void OnRequestFailed(bool has_stale_copy_in_cache, int net_error) = 0; |
45 | 47 |
46 // Called after the network request has begun on the IO thread at time | 48 // Called after the network request has begun on the IO thread at time |
47 // |timestamp|. This is just a thread hop but is used to compare timing | 49 // |timestamp|. This is just a thread hop but is used to compare timing |
48 // against the pre-PlzNavigate codepath which didn't start the network request | 50 // against the pre-PlzNavigate codepath which didn't start the network request |
49 // until after the renderer was initialized. | 51 // until after the renderer was initialized. |
50 virtual void OnRequestStarted(base::TimeTicks timestamp) = 0; | 52 virtual void OnRequestStarted(base::TimeTicks timestamp) = 0; |
51 | 53 |
52 // Called when a ServiceWorker was found for the navigation. | 54 // Called when a ServiceWorker was found for the navigation. |
53 virtual void OnServiceWorkerEncountered() = 0; | 55 virtual void OnServiceWorkerEncountered() = 0; |
54 | 56 |
55 protected: | 57 protected: |
56 NavigationURLLoaderDelegate() {} | 58 NavigationURLLoaderDelegate() {} |
57 virtual ~NavigationURLLoaderDelegate() {} | 59 virtual ~NavigationURLLoaderDelegate() {} |
58 | 60 |
59 private: | 61 private: |
60 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderDelegate); | 62 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderDelegate); |
61 }; | 63 }; |
62 | 64 |
63 } // namespace content | 65 } // namespace content |
64 | 66 |
65 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_ | 67 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_ |
OLD | NEW |