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