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_IMPL_CORE_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ |
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ | 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "content/browser/loader/navigation_url_loader_impl.h" | 12 #include "content/browser/loader/navigation_url_loader_impl.h" |
13 | 13 |
14 namespace net { | 14 namespace net { |
15 class URLRequest; | 15 class URLRequest; |
16 struct RedirectInfo; | 16 struct RedirectInfo; |
17 } | 17 } |
18 | 18 |
19 namespace content { | 19 namespace content { |
20 | 20 |
21 class FrameTreeNode; | 21 class FrameTreeNode; |
22 class NavigationResourceHandler; | 22 class NavigationResourceHandler; |
23 class ResourceContext; | 23 class ResourceContext; |
24 class ResourceHandler; | 24 class ResourceHandler; |
25 class ResourceRequestBody; | 25 class ResourceRequestBody; |
| 26 class ServiceWorkerContext; |
| 27 class ServiceWorkerContextWrapper; |
26 class StreamHandle; | 28 class StreamHandle; |
27 struct ResourceResponse; | 29 struct ResourceResponse; |
28 | 30 |
29 // The IO-thread counterpart to the NavigationURLLoaderImpl. It lives on the IO | 31 // The IO-thread counterpart to the NavigationURLLoaderImpl. It lives on the IO |
30 // thread and is owned by the UI-thread NavigationURLLoaderImpl. | 32 // thread and is owned by the UI-thread NavigationURLLoaderImpl. |
31 // NavigationURLLoaderImplCore interacts with the ResourceDispatcherHost stack | 33 // NavigationURLLoaderImplCore interacts with the ResourceDispatcherHost stack |
32 // and forwards signals back to the loader on the UI thread. | 34 // and forwards signals back to the loader on the UI thread. |
33 class NavigationURLLoaderImplCore { | 35 class NavigationURLLoaderImplCore { |
34 public: | 36 public: |
35 // Creates a new NavigationURLLoaderImplCore that forwards signals back to | 37 // Creates a new NavigationURLLoaderImplCore that forwards signals back to |
36 // |loader| on the UI thread. | 38 // |loader| on the UI thread. |
37 explicit NavigationURLLoaderImplCore( | 39 explicit NavigationURLLoaderImplCore( |
38 const base::WeakPtr<NavigationURLLoaderImpl>& loader); | 40 const base::WeakPtr<NavigationURLLoaderImpl>& loader, |
| 41 ServiceWorkerContext* service_worker_context); |
39 ~NavigationURLLoaderImplCore(); | 42 ~NavigationURLLoaderImplCore(); |
40 | 43 |
41 // Starts the request. | 44 // Starts the request. |
42 void Start(ResourceContext* resource_context, | 45 void Start(ResourceContext* resource_context, |
43 scoped_ptr<NavigationRequestInfo> request_info); | 46 scoped_ptr<NavigationRequestInfo> request_info); |
44 | 47 |
45 // Follows the current pending redirect. | 48 // Follows the current pending redirect. |
46 void FollowRedirect(); | 49 void FollowRedirect(); |
47 | 50 |
48 void set_resource_handler(NavigationResourceHandler* resource_handler) { | 51 void set_resource_handler(NavigationResourceHandler* resource_handler) { |
49 resource_handler_ = resource_handler; | 52 resource_handler_ = resource_handler; |
50 } | 53 } |
51 | 54 |
52 // Notifies |loader_| on the UI thread that the request was redirected. | 55 // Notifies |loader_| on the UI thread that the request was redirected. |
53 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, | 56 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, |
54 ResourceResponse* response); | 57 ResourceResponse* response); |
55 | 58 |
56 // Notifies |loader_| on the UI thread that the response started. | 59 // Notifies |loader_| on the UI thread that the response started. |
57 void NotifyResponseStarted(ResourceResponse* response, | 60 void NotifyResponseStarted(ResourceResponse* response, |
58 scoped_ptr<StreamHandle> body); | 61 scoped_ptr<StreamHandle> body); |
59 | 62 |
60 // Notifies |loader_| on the UI thread that the request failed. | 63 // Notifies |loader_| on the UI thread that the request failed. |
61 void NotifyRequestFailed(bool in_cache, int net_error); | 64 void NotifyRequestFailed(bool in_cache, int net_error); |
62 | 65 |
63 private: | 66 private: |
64 base::WeakPtr<NavigationURLLoaderImpl> loader_; | 67 base::WeakPtr<NavigationURLLoaderImpl> loader_; |
65 NavigationResourceHandler* resource_handler_; | 68 NavigationResourceHandler* resource_handler_; |
| 69 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context_; |
66 | 70 |
67 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImplCore); | 71 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImplCore); |
68 }; | 72 }; |
69 | 73 |
70 } // namespace content | 74 } // namespace content |
71 | 75 |
72 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ | 76 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ |
OLD | NEW |