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