Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_CORE_H_ | |
| 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_CORE_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/weak_ptr.h" | |
| 12 #include "content/browser/loader/navigation_url_loader_impl.h" | |
| 13 | |
| 14 namespace net { | |
| 15 class URLRequest; | |
| 16 struct RedirectInfo; | |
| 17 } | |
| 18 | |
| 19 namespace content { | |
| 20 | |
| 21 class FrameTreeNode; | |
| 22 class NavigationResourceHandler; | |
| 23 class ResourceContext; | |
| 24 class ResourceHandler; | |
| 25 class ResourceRequestBody; | |
| 26 class StreamHandle; | |
| 27 struct ResourceResponse; | |
| 28 | |
| 29 // The IO-thread counterpart to the NavigationURLLoaderImpl. It lives on the IO | |
| 30 // thread and is owned by the UI-thread | |
| 31 // NavigationURLLoaderImpl. NavigationURLLoaderCore interacts with the | |
| 32 // ResourceDispatcherHost stack and forwards signals back to the loader on the | |
| 33 // UI thread. | |
| 34 class NavigationURLLoaderCore { | |
|
mmenke
2014/10/22 15:32:58
Think "NavigationURLLoaderImplCore" is clearer.
davidben
2014/10/22 20:58:04
Done. (So long...)
| |
| 35 public: | |
| 36 // Creates a new NavigationURLLoaderCore that forwards signals back to | |
| 37 // |loader| on the UI thread. | |
| 38 NavigationURLLoaderCore(const base::WeakPtr<NavigationURLLoaderImpl>& loader); | |
|
mmenke
2014/10/22 15:32:58
explicit
davidben
2014/10/22 20:58:04
Done.
| |
| 39 ~NavigationURLLoaderCore(); | |
| 40 | |
| 41 // Starts the request. | |
| 42 void Start(ResourceContext* resource_context, | |
| 43 int64 frame_tree_node_id, | |
| 44 const CommonNavigationParams& common_params, | |
| 45 scoped_ptr<NavigationRequestInfo> request_info, | |
| 46 ResourceRequestBody* request_body); | |
| 47 | |
| 48 // After a redirect to follow the redirect. | |
|
mmenke
2014/10/22 15:32:58
nit: Grammar seems a bit weird here. Maybe just
davidben
2014/10/22 20:58:04
Done.
| |
| 49 void FollowRedirect(); | |
| 50 | |
| 51 void set_resource_handler(NavigationResourceHandler* resource_handler) { | |
| 52 resource_handler_ = resource_handler; | |
| 53 } | |
| 54 | |
| 55 // Notifies |loader_| on the UI thread that the request was redirected. | |
| 56 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, | |
| 57 ResourceResponse* response); | |
| 58 | |
| 59 // Notifies |loader_| on the UI thread that the response started. | |
| 60 void NotifyResponseStarted(ResourceResponse* response, | |
| 61 scoped_ptr<StreamHandle> body); | |
| 62 | |
| 63 // Notifies |loader_| on the UI thread that the request failed. | |
| 64 void NotifyRequestFailed(int net_error); | |
| 65 | |
| 66 private: | |
| 67 base::WeakPtr<NavigationURLLoaderImpl> loader_; | |
| 68 NavigationResourceHandler* resource_handler_; | |
| 69 | |
| 70 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderCore); | |
| 71 }; | |
| 72 | |
| 73 } // namespace content | |
| 74 | |
| 75 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_ | |
| OLD | NEW |