OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/interstitial_page_navigator_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_navigator_impl.h" |
6 | 6 |
7 #include "content/browser/frame_host/interstitial_page_impl.h" | 7 #include "content/browser/frame_host/interstitial_page_impl.h" |
8 #include "content/browser/frame_host/navigation_controller_impl.h" | 8 #include "content/browser/frame_host/navigation_controller_impl.h" |
9 #include "content/browser/frame_host/navigator_delegate.h" | 9 #include "content/browser/frame_host/navigator_delegate.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 InterstitialPageNavigatorImpl::InterstitialPageNavigatorImpl( | 14 InterstitialPageNavigatorImpl::InterstitialPageNavigatorImpl( |
15 InterstitialPageImpl* interstitial, | 15 InterstitialPageImpl* interstitial, |
16 NavigationControllerImpl* navigation_controller) | 16 NavigationControllerImpl* navigation_controller) |
17 : interstitial_(interstitial), | 17 : interstitial_(interstitial), |
18 controller_(navigation_controller) {} | 18 controller_(navigation_controller) {} |
19 | 19 |
| 20 InterstitialPageNavigatorImpl::~InterstitialPageNavigatorImpl() {} |
| 21 |
20 NavigatorDelegate* InterstitialPageNavigatorImpl::GetDelegate() { | 22 NavigatorDelegate* InterstitialPageNavigatorImpl::GetDelegate() { |
21 return interstitial_; | 23 return interstitial_; |
22 } | 24 } |
23 | 25 |
24 NavigationController* InterstitialPageNavigatorImpl::GetController() { | 26 NavigationController* InterstitialPageNavigatorImpl::GetController() { |
25 return controller_; | 27 return controller_; |
26 } | 28 } |
27 | 29 |
| 30 void InterstitialPageNavigatorImpl::DidStartProvisionalLoad( |
| 31 RenderFrameHostImpl* render_frame_host, |
| 32 const GURL& url, |
| 33 const base::TimeTicks& navigation_start) { |
| 34 // The interstitial page should only navigate once. |
| 35 DCHECK(!navigation_handle_.get()); |
| 36 navigation_handle_ = |
| 37 NavigationHandleImpl::Create(url, render_frame_host->frame_tree_node(), |
| 38 false, // is_renderer_initiated |
| 39 false, // is_synchronous |
| 40 false, // is_srcdoc |
| 41 navigation_start, |
| 42 0); // pending_nav_entry_id |
| 43 } |
| 44 |
28 void InterstitialPageNavigatorImpl::DidNavigate( | 45 void InterstitialPageNavigatorImpl::DidNavigate( |
29 RenderFrameHostImpl* render_frame_host, | 46 RenderFrameHostImpl* render_frame_host, |
30 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) { | 47 const FrameHostMsg_DidCommitProvisionalLoad_Params& input_params) { |
| 48 if (navigation_handle_) { |
| 49 navigation_handle_->DidCommitNavigation(input_params, false, |
| 50 render_frame_host); |
| 51 navigation_handle_.reset(); |
| 52 } |
| 53 |
31 // TODO(nasko): Move implementation here, but for the time being call out | 54 // TODO(nasko): Move implementation here, but for the time being call out |
32 // to the interstitial page code. | 55 // to the interstitial page code. |
33 interstitial_->DidNavigate( | 56 interstitial_->DidNavigate(render_frame_host->render_view_host(), |
34 render_frame_host->render_view_host(), input_params); | 57 input_params); |
| 58 } |
| 59 |
| 60 NavigationHandleImpl* |
| 61 InterstitialPageNavigatorImpl::GetNavigationHandleForFrameHost( |
| 62 RenderFrameHostImpl* render_frame_host) { |
| 63 return navigation_handle_.get(); |
35 } | 64 } |
36 | 65 |
37 } // namespace content | 66 } // namespace content |
OLD | NEW |