OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "content/public/browser/navigation_handle.h" | |
6 | |
7 #include "content/browser/frame_host/navigation_handle_impl.h" | |
8 #include "content/browser/frame_host/navigator.h" | |
9 #include "content/browser/web_contents/web_contents_impl.h" | |
10 | |
11 namespace content { | |
12 | |
13 WebContents* NavigationHandle::GetWebContents() { | |
14 // The NavigationHandleImpl cannot access the WebContentsImpl a it would be a | |
Charlie Reis
2015/09/18 05:40:02
nit: s/a/as/
clamy
2015/09/18 17:35:39
Done.
| |
15 // layering violation, hence the cast here. | |
16 return static_cast<WebContentsImpl*>( | |
17 static_cast<NavigationHandleImpl*>(this)->delegate()); | |
18 } | |
19 | |
20 // static | |
21 scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( | |
22 const GURL& url, | |
23 bool is_main_frame, | |
24 WebContents* web_contents) { | |
25 scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create( | |
26 url, is_main_frame, static_cast<WebContentsImpl*>(web_contents) | |
27 ->GetMainFrame() | |
28 ->frame_tree_node() | |
29 ->navigator() | |
30 ->GetDelegate()); | |
nasko
2015/09/17 21:10:25
Uh, this is a fairly long chain. Why not use the R
Charlie Reis
2015/09/18 05:40:02
I'm not sure we know the RFH at the time (e.g., in
clamy
2015/09/18 17:35:39
Done.
| |
31 return scoped_ptr<NavigationHandle>(handle_impl.Pass()); | |
32 } | |
33 | |
34 } // namespace content | |
OLD | NEW |