Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(363)

Side by Side Diff: content/browser/loader/navigation_url_loader_core.h

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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/macros.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/browser/loader/navigation_url_loader.h"
12
13 namespace net {
14 class URLRequest;
15 struct RedirectInfo;
16 }
17
18 namespace content {
19
20 class BrowserContext;
21 class FrameTreeNode;
22 class NavigationResourceHandler;
23 class ResourceContext;
24 class ResourceHandler;
25 class ResourceRequestBody;
26 class StreamHandle;
27 struct ResourceResponse;
28
29 // Part of the implementation of NavigationURLLoaderImpl. It is jointly owned by
30 // NavigationURLLoaderImpl on the UI thread and NavigationResourceHandler and IO
31 // thread. It bridges cross-thread between the two.
mmenke 2014/09/23 17:22:45 nit: "It bridges cross-thread between the two."
davidben 2014/10/03 16:27:52 Done.
32 class NavigationURLLoaderCore
33 : public base::RefCountedThreadSafe<NavigationURLLoaderCore> {
34 public:
35 NavigationURLLoaderCore();
36
37 // Called on the UI thread to start the request.
38 void StartRequest(BrowserContext* browser_context,
39 int64 frame_tree_node_id,
40 const NavigationRequestInfo& request_info,
41 ResourceRequestBody* request_body);
42
43 // Called on the UI thread to set the delegate.
44 void set_delegate(NavigationURLLoader::Delegate* delegate) {
45 delegate_ = delegate;
46 }
47
48 // Called on the UI thread to resume a deferred redirect.
49 void FollowRedirect();
50
51 // Called on the UI thread to cancel a request, if it has not completed. Note:
nasko 2014/09/24 21:15:34 nit: Note: on new line
davidben 2014/10/03 16:27:52 Done.
52 // if the response has been received, the request is considered completed from
nasko 2014/09/24 21:15:34 The full response or the response headers? Let's b
davidben 2014/10/03 16:27:52 Done.
53 // the perspective of NavigationURLLoader and ownership is transferred to the
54 // StreamHandle containing the body.
55 void Cancel();
56
57 // Called on the IO thread to set the resource handler.
58 void set_resource_handler(NavigationResourceHandler* resource_handler) {
59 resource_handler_ = resource_handler;
60 }
61
62 // Called on the IO thread when the request is redirected. The request will
63 // resume processing on the next call to FollowRedirect on the UI thread.
64 void RequestRedirectedOnIOThread(const net::RedirectInfo& redirect_info,
65 ResourceResponse* response);
66
67 // Called on the IO thread when the response started.
68 void ResponseStartedOnIOThread(ResourceResponse* response,
69 scoped_ptr<StreamHandle> body);
70
71 // Called on the IO thread if the request failed before giving a response.
72 void RequestFailedOnIOThread(int net_error);
73
74 private:
75 friend class base::RefCountedThreadSafe<NavigationURLLoaderCore>;
76
77 ~NavigationURLLoaderCore();
78
79 void StartRequestOnIOThread(ResourceContext* resource_context,
80 int64 frame_tree_node_id,
mmenke 2014/09/23 17:22:45 Should include basictypes.h, I believe, for int64
davidben 2014/10/03 16:27:52 Done.
81 const NavigationRequestInfo& request_info,
82 ResourceRequestBody* request_body);
83 void FollowRedirectOnIOThread();
84 void CancelOnIOThread();
85
86 void CallOnRequestRedirected(const net::RedirectInfo& redirect_info,
87 ResourceResponse* response);
88 void CallOnResponseStarted(ResourceResponse* response,
89 scoped_ptr<StreamHandle> body);
90 void CallOnRequestFailed(int net_error);
91
92 NavigationURLLoader::Delegate* delegate_;
93 NavigationResourceHandler* resource_handler_;
94
95 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderCore);
96 };
97
98 } // namespace content
99
100 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698