Retry: Win Video Capture: Create an STA |video_capture_thread_| from MediaStreamManager.
[chromium-blink-merge.git] / content / browser / frame_host / navigation_request.cc
blob57f5479727c1c55f65e29f88a442875a0aa623f8
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.
5 #include "content/browser/frame_host/navigation_request.h"
7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/frame_host/navigation_request_info.h"
9 #include "content/browser/frame_host/navigator.h"
10 #include "content/browser/loader/navigation_url_loader.h"
11 #include "content/common/resource_request_body.h"
12 #include "content/public/browser/navigation_controller.h"
13 #include "content/public/browser/stream_handle.h"
14 #include "net/url_request/redirect_info.h"
16 namespace content {
18 NavigationRequest::NavigationRequest(
19 FrameTreeNode* frame_tree_node,
20 const CommonNavigationParams& common_params,
21 const CommitNavigationParams& commit_params)
22 : frame_tree_node_(frame_tree_node),
23 common_params_(common_params),
24 commit_params_(commit_params) {
27 NavigationRequest::~NavigationRequest() {
30 void NavigationRequest::BeginNavigation(
31 scoped_ptr<NavigationRequestInfo> info,
32 scoped_refptr<ResourceRequestBody> request_body) {
33 DCHECK(!loader_);
34 loader_ = NavigationURLLoader::Create(
35 frame_tree_node_->navigator()->GetController()->GetBrowserContext(),
36 frame_tree_node_->frame_tree_node_id(), common_params_, info.Pass(),
37 request_body.get(), this);
39 // TODO(davidben): Fire (and add as necessary) observer methods such as
40 // DidStartProvisionalLoadForFrame for the navigation.
43 void NavigationRequest::OnRequestRedirected(
44 const net::RedirectInfo& redirect_info,
45 const scoped_refptr<ResourceResponse>& response) {
46 // TODO(davidben): Track other changes from redirects. These are important
47 // for, e.g., reloads.
48 common_params_.url = redirect_info.new_url;
50 // TODO(davidben): This where prerender and navigation_interceptor should be
51 // integrated. For now, just always follow all redirects.
52 loader_->FollowRedirect();
55 void NavigationRequest::OnResponseStarted(
56 const scoped_refptr<ResourceResponse>& response,
57 scoped_ptr<StreamHandle> body) {
58 frame_tree_node_->navigator()->CommitNavigation(frame_tree_node_,
59 response.get(), body.Pass());
62 void NavigationRequest::OnRequestFailed(int net_error) {
63 // TODO(davidben): Network failures should display a network error page.
64 NOTIMPLEMENTED();
67 } // namespace content