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

Side by Side Diff: content/browser/frame_host/navigation_request.h

Issue 519533002: Initial PlzNavigate RDH-side logic. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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_FRAME_HOST_NAVIGATION_REQUEST_H_ 5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/browser/frame_host/navigation_request_info.h" 10 #include "content/browser/frame_host/navigation_request_info.h"
11 #include "content/browser/loader/navigation_url_loader.h"
11 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "url/gurl.h"
12 14
13 namespace content { 15 namespace content {
16
17 class BrowserContext;
18 class FrameTreeNode;
14 class ResourceRequestBody; 19 class ResourceRequestBody;
15 20
16 // PlzNavigate 21 // PlzNavigate
17 // A UI thread object that owns a navigation request until it commits. It 22 // A UI thread object that owns a navigation request until it commits. It
18 // ensures the UI thread can start a navigation request in the 23 // ensures the UI thread can start a navigation request in the
19 // ResourceDispatcherHost (that lives on the IO thread). 24 // ResourceDispatcherHost (that lives on the IO thread).
20 // TODO(clamy): Describe the interactions between the UI and IO thread during 25 // TODO(clamy): Describe the interactions between the UI and IO thread during
21 // the navigation following its refactoring. 26 // the navigation following its refactoring.
22 class NavigationRequest { 27 class NavigationRequest : public NavigationURLLoader::Delegate {
23 public: 28 public:
24 NavigationRequest(const NavigationRequestInfo& info, 29 NavigationRequest(const NavigationRequestInfo& info,
25 int64 frame_tree_node_id); 30 BrowserContext* browser_context,
31 FrameTreeNode* frame_tree_node);
26 32
27 ~NavigationRequest(); 33 virtual ~NavigationRequest();
28 34
29 // Called on the UI thread by the RenderFrameHostManager which owns the 35 // Called on the UI thread by the RenderFrameHostManager which owns the
30 // NavigationRequest. After calling this function, |body| can no longer be 36 // NavigationRequest. After calling this function, |body| can no longer be
31 // manipulated on the UI thread. 37 // manipulated on the UI thread.
32 void BeginNavigation(scoped_refptr<ResourceRequestBody> body); 38 void BeginNavigation(scoped_refptr<ResourceRequestBody> body);
33 39
34 // Called on the UI thread by the RenderFrameHostManager which owns the
35 // NavigationRequest whenever this navigation request should be canceled.
36 void CancelNavigation();
37
38 const NavigationRequestInfo& info() const { return info_; } 40 const NavigationRequestInfo& info() const { return info_; }
39 41
40 int64 frame_tree_node_id() const { return frame_tree_node_id_; } 42 FrameTreeNode* frame_tree_node() const { return frame_tree_node_; }
41 43
42 int64 navigation_request_id() const { return navigation_request_id_; } 44 NavigationURLLoader* loader_for_testing() const { return loader_.get(); }
43 45
44 private: 46 private:
45 const int64 navigation_request_id_; 47 // NavigationURLLoader::Delegate implementation.
48 virtual void OnRequestRedirected(const net::RedirectInfo& redirect_info,
49 ResourceResponse* response) OVERRIDE;
50 virtual void OnResponseStarted(ResourceResponse* response,
51 scoped_ptr<StreamHandle> body) OVERRIDE;
52 virtual void OnRequestFailed(int net_error) OVERRIDE;
53
46 const NavigationRequestInfo info_; 54 const NavigationRequestInfo info_;
47 const int64 frame_tree_node_id_; 55 BrowserContext* browser_context_;
56 FrameTreeNode* frame_tree_node_;
57
58 GURL final_url_;
59 scoped_ptr<NavigationURLLoader> loader_;
48 60
49 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); 61 DISALLOW_COPY_AND_ASSIGN(NavigationRequest);
50 }; 62 };
51 63
52 } // namespace content 64 } // namespace content
53 65
54 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 66 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698