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_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ |
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ | 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
| 15 class AppCacheNavigationHandle; |
15 class BrowserContext; | 16 class BrowserContext; |
16 class NavigationUIData; | 17 class NavigationUIData; |
17 class NavigationURLLoaderDelegate; | 18 class NavigationURLLoaderDelegate; |
18 class NavigationURLLoaderFactory; | 19 class NavigationURLLoaderFactory; |
19 class ServiceWorkerNavigationHandle; | 20 class ServiceWorkerNavigationHandle; |
20 struct NavigationRequestInfo; | 21 struct NavigationRequestInfo; |
21 | 22 |
22 // PlzNavigate: The navigation logic's UI thread entry point into the resource | 23 // PlzNavigate: The navigation logic's UI thread entry point into the resource |
23 // loading stack. It exposes an interface to control the request prior to | 24 // loading stack. It exposes an interface to control the request prior to |
24 // receiving the response. If the NavigationURLLoader is destroyed before | 25 // receiving the response. If the NavigationURLLoader is destroyed before |
25 // OnResponseStarted is called, the request is aborted. | 26 // OnResponseStarted is called, the request is aborted. |
26 class CONTENT_EXPORT NavigationURLLoader { | 27 class CONTENT_EXPORT NavigationURLLoader { |
27 public: | 28 public: |
28 // Creates a NavigationURLLoader. The caller is responsible for ensuring that | 29 // Creates a NavigationURLLoader. The caller is responsible for ensuring that |
29 // |delegate| outlives the loader. |request_body| must not be accessed on the | 30 // |delegate| outlives the loader. |request_body| must not be accessed on the |
30 // UI thread after this point. | 31 // UI thread after this point. |
31 // | 32 // |
32 // TODO(davidben): When navigation is disentangled from the loader, the | 33 // TODO(davidben): When navigation is disentangled from the loader, the |
33 // request parameters should not come in as a navigation-specific | 34 // request parameters should not come in as a navigation-specific |
34 // structure. Information like has_user_gesture and | 35 // structure. Information like has_user_gesture and |
35 // should_replace_current_entry shouldn't be needed at this layer. | 36 // should_replace_current_entry shouldn't be needed at this layer. |
36 static std::unique_ptr<NavigationURLLoader> Create( | 37 static std::unique_ptr<NavigationURLLoader> Create( |
37 BrowserContext* browser_context, | 38 BrowserContext* browser_context, |
38 std::unique_ptr<NavigationRequestInfo> request_info, | 39 std::unique_ptr<NavigationRequestInfo> request_info, |
39 std::unique_ptr<NavigationUIData> navigation_ui_data, | 40 std::unique_ptr<NavigationUIData> navigation_ui_data, |
40 ServiceWorkerNavigationHandle* service_worker_handle, | 41 ServiceWorkerNavigationHandle* service_worker_handle, |
| 42 AppCacheNavigationHandle* appcache_handle, |
41 NavigationURLLoaderDelegate* delegate); | 43 NavigationURLLoaderDelegate* delegate); |
42 | 44 |
43 // For testing purposes; sets the factory for use in testing. | 45 // For testing purposes; sets the factory for use in testing. |
44 static void SetFactoryForTesting(NavigationURLLoaderFactory* factory); | 46 static void SetFactoryForTesting(NavigationURLLoaderFactory* factory); |
45 | 47 |
46 virtual ~NavigationURLLoader() {} | 48 virtual ~NavigationURLLoader() {} |
47 | 49 |
48 // Called in response to OnRequestRedirected to continue processing the | 50 // Called in response to OnRequestRedirected to continue processing the |
49 // request. | 51 // request. |
50 virtual void FollowRedirect() = 0; | 52 virtual void FollowRedirect() = 0; |
51 | 53 |
52 // Called in response to OnResponseStarted to process the response. | 54 // Called in response to OnResponseStarted to process the response. |
53 virtual void ProceedWithResponse() = 0; | 55 virtual void ProceedWithResponse() = 0; |
54 | 56 |
55 protected: | 57 protected: |
56 NavigationURLLoader() {} | 58 NavigationURLLoader() {} |
57 | 59 |
58 private: | 60 private: |
59 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoader); | 61 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoader); |
60 }; | 62 }; |
61 | 63 |
62 } // namespace content | 64 } // namespace content |
63 | 65 |
64 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ | 66 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ |
OLD | NEW |