OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/public/browser/navigation_handle.h" | 5 #include "content/public/browser/navigation_handle.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "content/browser/frame_host/navigation_handle_impl.h" | 9 #include "content/browser/frame_host/navigation_handle_impl.h" |
8 #include "content/browser/frame_host/navigator.h" | 10 #include "content/browser/frame_host/navigator.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | 11 #include "content/browser/frame_host/render_frame_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 12 #include "content/browser/web_contents/web_contents_impl.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 WebContents* NavigationHandle::GetWebContents() { | 16 WebContents* NavigationHandle::GetWebContents() { |
15 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be | 17 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be |
16 // a layering violation, hence the cast here. | 18 // a layering violation, hence the cast here. |
17 return static_cast<WebContentsImpl*>( | 19 return static_cast<WebContentsImpl*>( |
18 static_cast<NavigationHandleImpl*>(this)->GetDelegate()); | 20 static_cast<NavigationHandleImpl*>(this)->GetDelegate()); |
19 } | 21 } |
20 | 22 |
21 // static | 23 // static |
22 scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( | 24 scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( |
23 const GURL& url, | 25 const GURL& url, |
24 RenderFrameHost* render_frame_host) { | 26 RenderFrameHost* render_frame_host) { |
25 scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create( | 27 scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create( |
26 url, | 28 url, |
27 static_cast<RenderFrameHostImpl*>(render_frame_host)->frame_tree_node(), | 29 static_cast<RenderFrameHostImpl*>(render_frame_host)->frame_tree_node(), |
28 base::TimeTicks::Now()); | 30 base::TimeTicks::Now()); |
29 return scoped_ptr<NavigationHandle>(handle_impl.Pass()); | 31 return scoped_ptr<NavigationHandle>(std::move(handle_impl)); |
30 } | 32 } |
31 | 33 |
32 } // namespace content | 34 } // namespace content |
OLD | NEW |