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

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

Issue 648813002: PlzNavigate: Add first version of NavigationURLLoader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@plz-navigate-prepare
Patch Set: rebase, OVERRIDE -> override, NULL -> nullptr Created 6 years, 2 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 #include "content/browser/frame_host/navigation_request.h" 5 #include "content/browser/frame_host/navigation_request.h"
6 6
7 #include "content/browser/frame_host/frame_tree_node.h"
7 #include "content/browser/frame_host/navigation_request_info.h" 8 #include "content/browser/frame_host/navigation_request_info.h"
9 #include "content/browser/frame_host/navigator.h"
8 #include "content/common/resource_request_body.h" 10 #include "content/common/resource_request_body.h"
11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/stream_handle.h"
13 #include "net/url_request/redirect_info.h"
9 14
10 namespace content { 15 namespace content {
11 16
12 NavigationRequest::NavigationRequest( 17 NavigationRequest::NavigationRequest(
13 FrameTreeNode* frame_tree_node, 18 FrameTreeNode* frame_tree_node,
14 const CommonNavigationParams& common_params, 19 const CommonNavigationParams& common_params,
15 const CommitNavigationParams& commit_params) 20 const CommitNavigationParams& commit_params)
16 : frame_tree_node_(frame_tree_node), 21 : frame_tree_node_(frame_tree_node),
17 common_params_(common_params), 22 common_params_(common_params),
18 commit_params_(commit_params) { 23 commit_params_(commit_params) {
19 } 24 }
20 25
21 NavigationRequest::~NavigationRequest() { 26 NavigationRequest::~NavigationRequest() {
22 } 27 }
23 28
24 void NavigationRequest::BeginNavigation( 29 void NavigationRequest::BeginNavigation(
25 scoped_ptr<NavigationRequestInfo> info, 30 scoped_ptr<NavigationRequestInfo> info,
26 scoped_refptr<ResourceRequestBody> request_body) { 31 scoped_refptr<ResourceRequestBody> request_body) {
27 info_ = info.Pass(); 32 DCHECK(!loader_);
33 loader_ = NavigationURLLoader::Create(
34 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
35 frame_tree_node_->frame_tree_node_id(), common_params_, info.Pass(),
36 request_body.get(), this);
37
38 // TODO(davidben): Fire (and add as necessary) observer methods such as
39 // DidStartProvisionalLoadForFrame for the navigation.
40 }
41
42 void NavigationRequest::OnRequestRedirected(
43 const net::RedirectInfo& redirect_info,
44 ResourceResponse* response) {
45 // TODO(davidben): Track other changes from redirects. These are important
46 // for, e.g., reloads.
47 common_params_.url = redirect_info.new_url;
48
49 // TODO(davidben): This where prerender and navigation_interceptor should be
50 // integrated. For now, just always follow all redirects.
51 loader_->FollowRedirect();
52 }
53
54 void NavigationRequest::OnResponseStarted(ResourceResponse* response,
55 scoped_ptr<StreamHandle> body) {
56 frame_tree_node_->navigator()->CommitNavigation(frame_tree_node_,
57 response, body.Pass());
58 }
59
60 void NavigationRequest::OnRequestFailed(int net_error) {
61 // TODO(davidben): Network failures should display a network error page.
28 NOTIMPLEMENTED(); 62 NOTIMPLEMENTED();
29 } 63 }
30 64
31 } // namespace content 65 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698