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

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

Issue 818853005: Store NavigationEntryImpl data into NavigationRequest for later usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Minor change rebase. Created 5 years, 11 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
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "content/browser/frame_host/navigation_entry_impl.h"
11 #include "content/browser/loader/navigation_url_loader_delegate.h" 12 #include "content/browser/loader/navigation_url_loader_delegate.h"
12 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
13 #include "content/common/navigation_params.h" 14 #include "content/common/navigation_params.h"
14 15
15 namespace content { 16 namespace content {
16 17
17 class FrameTreeNode; 18 class FrameTreeNode;
18 class NavigationURLLoader; 19 class NavigationURLLoader;
19 class ResourceRequestBody; 20 class ResourceRequestBody;
21 class SiteInstanceImpl;
20 struct NavigationRequestInfo; 22 struct NavigationRequestInfo;
21 23
22 // PlzNavigate 24 // PlzNavigate
23 // A UI thread object that owns a navigation request until it commits. It 25 // A UI thread object that owns a navigation request until it commits. It
24 // ensures the UI thread can start a navigation request in the 26 // ensures the UI thread can start a navigation request in the
25 // ResourceDispatcherHost (that lives on the IO thread). 27 // ResourceDispatcherHost (that lives on the IO thread).
26 // TODO(clamy): Describe the interactions between the UI and IO thread during 28 // TODO(clamy): Describe the interactions between the UI and IO thread during
27 // the navigation following its refactoring. 29 // the navigation following its refactoring.
28 class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate { 30 class CONTENT_EXPORT NavigationRequest : public NavigationURLLoaderDelegate {
29 public: 31 public:
(...skipping 14 matching lines...) Expand all
44 // is one of the two final states for the request. 46 // is one of the two final states for the request.
45 RESPONSE_STARTED, 47 RESPONSE_STARTED,
46 48
47 // The request failed on the IO thread and an error page should be 49 // The request failed on the IO thread and an error page should be
48 // displayed. This is one of the two final states for the request. 50 // displayed. This is one of the two final states for the request.
49 FAILED, 51 FAILED,
50 }; 52 };
51 53
52 NavigationRequest(FrameTreeNode* frame_tree_node, 54 NavigationRequest(FrameTreeNode* frame_tree_node,
53 const CommonNavigationParams& common_params, 55 const CommonNavigationParams& common_params,
54 const CommitNavigationParams& commit_params); 56 const CommitNavigationParams& commit_params,
57 const NavigationEntryImpl* navitation_entry);
55 58
56 ~NavigationRequest() override; 59 ~NavigationRequest() override;
57 60
58 // Called on the UI thread by the RenderFrameHostManager which owns the 61 // Called on the UI thread by the RenderFrameHostManager which owns the
59 // NavigationRequest. Takes ownership of |info|. After calling this function, 62 // NavigationRequest. Takes ownership of |info|. After calling this function,
60 // |body| can no longer be manipulated on the UI thread. 63 // |body| can no longer be manipulated on the UI thread.
61 void BeginNavigation(scoped_ptr<NavigationRequestInfo> info, 64 void BeginNavigation(scoped_ptr<NavigationRequestInfo> info,
62 scoped_refptr<ResourceRequestBody> body); 65 scoped_refptr<ResourceRequestBody> body);
63 66
64 CommonNavigationParams& common_params() { return common_params_; } 67 CommonNavigationParams& common_params() { return common_params_; }
65 68
69 const CommonNavigationParams& common_params() const { return common_params_; }
70
66 const CommitNavigationParams& commit_params() const { return commit_params_; } 71 const CommitNavigationParams& commit_params() const { return commit_params_; }
67 72
68 NavigationURLLoader* loader_for_testing() const { return loader_.get(); } 73 NavigationURLLoader* loader_for_testing() const { return loader_.get(); }
69 74
70 NavigationState state() const { return state_; } 75 NavigationState state() const { return state_; }
71 76
77 SiteInstanceImpl* source_site_instance() const {
78 return source_site_instance_.get();
79 }
80
81 SiteInstanceImpl* dest_site_instance() const {
82 return dest_site_instance_.get();
83 }
84
85 NavigationEntryImpl::RestoreType restore_type() const {
86 return restore_type_;
87 };
88
89 bool is_view_source() const { return is_view_source_; };
90
91 int bindings() const { return bindings_; };
92
72 void SetWaitingForRendererResponse() { 93 void SetWaitingForRendererResponse() {
73 DCHECK(state_ == NOT_STARTED); 94 DCHECK(state_ == NOT_STARTED);
74 state_ = WAITING_FOR_RENDERER_RESPONSE; 95 state_ = WAITING_FOR_RENDERER_RESPONSE;
75 } 96 }
76 97
77 private: 98 private:
78 // NavigationURLLoaderDelegate implementation. 99 // NavigationURLLoaderDelegate implementation.
79 void OnRequestRedirected( 100 void OnRequestRedirected(
80 const net::RedirectInfo& redirect_info, 101 const net::RedirectInfo& redirect_info,
81 const scoped_refptr<ResourceResponse>& response) override; 102 const scoped_refptr<ResourceResponse>& response) override;
82 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, 103 void OnResponseStarted(const scoped_refptr<ResourceResponse>& response,
83 scoped_ptr<StreamHandle> body) override; 104 scoped_ptr<StreamHandle> body) override;
84 void OnRequestFailed(int net_error) override; 105 void OnRequestFailed(int net_error) override;
85 106
86 FrameTreeNode* frame_tree_node_; 107 FrameTreeNode* frame_tree_node_;
87 108
88 // Initialized on creation of the NavigationRequest. Sent to the renderer when 109 // Initialized on creation of the NavigationRequest. Sent to the renderer when
89 // the navigation is ready to commit. 110 // the navigation is ready to commit.
90 // Note: When the navigation is ready to commit, the url in |common_params| 111 // Note: When the navigation is ready to commit, the url in |common_params|
91 // will be set to the final navigation url, obtained after following all 112 // will be set to the final navigation url, obtained after following all
92 // redirects. 113 // redirects.
93 CommonNavigationParams common_params_; 114 CommonNavigationParams common_params_;
94 const CommitNavigationParams commit_params_; 115 const CommitNavigationParams commit_params_;
95 116
96 NavigationState state_; 117 NavigationState state_;
97 118
98 scoped_ptr<NavigationURLLoader> loader_; 119 scoped_ptr<NavigationURLLoader> loader_;
99 120
121 // These next items are used in browser-initiated navigations to store
122 // information from the NavigationEntryImpl that is required after request
123 // creation time.
124 scoped_refptr<SiteInstanceImpl> source_site_instance_;
125 scoped_refptr<SiteInstanceImpl> dest_site_instance_;
126 NavigationEntryImpl::RestoreType restore_type_;
127 bool is_view_source_;
128 int bindings_;
129
100 DISALLOW_COPY_AND_ASSIGN(NavigationRequest); 130 DISALLOW_COPY_AND_ASSIGN(NavigationRequest);
101 }; 131 };
102 132
103 } // namespace content 133 } // namespace content
104 134
105 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_ 135 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATION_REQUEST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/frame_host/navigation_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698