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_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "content/browser/loader/navigation_url_loader.h" |
| 13 |
| 14 namespace net { |
| 15 struct RedirectInfo; |
| 16 } |
| 17 |
| 18 namespace content { |
| 19 |
| 20 class NavigationURLLoaderImplCore; |
| 21 class StreamHandle; |
| 22 struct ResourceResponse; |
| 23 |
| 24 class NavigationURLLoaderImpl : public NavigationURLLoader { |
| 25 public: |
| 26 // The caller is responsible for ensuring that |delegate| outlives the loader. |
| 27 NavigationURLLoaderImpl(BrowserContext* browser_context, |
| 28 int64 frame_tree_node_id, |
| 29 const CommonNavigationParams& common_params, |
| 30 scoped_ptr<NavigationRequestInfo> request_info, |
| 31 ResourceRequestBody* request_body, |
| 32 NavigationURLLoaderDelegate* delegate); |
| 33 ~NavigationURLLoaderImpl() override; |
| 34 |
| 35 // Called in response to OnRequestRedirected to continue processing the |
| 36 // request. |
| 37 void FollowRedirect() override; |
| 38 |
| 39 private: |
| 40 friend class NavigationURLLoaderImplCore; |
| 41 |
| 42 // Notifies the delegate of a redirect. |
| 43 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, |
| 44 const scoped_refptr<ResourceResponse>& response); |
| 45 |
| 46 // Notifies the delegate that the response has started. |
| 47 void NotifyResponseStarted(const scoped_refptr<ResourceResponse>& response, |
| 48 scoped_ptr<StreamHandle> body); |
| 49 |
| 50 // Notifies the delegate the request failed to return a response. |
| 51 void NotifyRequestFailed(int net_error); |
| 52 |
| 53 NavigationURLLoaderDelegate* delegate_; |
| 54 |
| 55 // |core_| is deleted on the IO thread in a subsequent task when the |
| 56 // NavigationURLLoaderImpl goes out of scope. |
| 57 NavigationURLLoaderImplCore* core_; |
| 58 |
| 59 base::WeakPtrFactory<NavigationURLLoaderImpl> weak_factory_; |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImpl); |
| 62 }; |
| 63 |
| 64 } // namespace content |
| 65 |
| 66 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ |
OLD | NEW |