| 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 "content/browser/frame_host/navigation_handle_impl.h" | 7 #include "content/browser/frame_host/navigation_handle_impl.h" |
| 8 #include "content/browser/frame_host/navigator.h" | 8 #include "content/browser/frame_host/navigator.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 WebContents* NavigationHandle::GetWebContents() { | 13 WebContents* NavigationHandle::GetWebContents() { |
| 14 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be | 14 // The NavigationHandleImpl cannot access the WebContentsImpl as it would be |
| 15 // a layering violation, hence the cast here. | 15 // a layering violation, hence the cast here. |
| 16 return static_cast<WebContentsImpl*>( | 16 return static_cast<WebContentsImpl*>( |
| 17 static_cast<NavigationHandleImpl*>(this)->delegate()); | 17 static_cast<NavigationHandleImpl*>(this)->delegate()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 // static | 20 // static |
| 21 scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( | 21 scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( |
| 22 const GURL& url, | 22 const GURL& url, |
| 23 bool is_main_frame, | 23 bool is_main_frame, |
| 24 WebContents* web_contents) { | 24 WebContents* web_contents) { |
| 25 scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create( | 25 scoped_ptr<NavigationHandleImpl> handle_impl = NavigationHandleImpl::Create( |
| 26 url, is_main_frame, static_cast<WebContentsImpl*>(web_contents)); | 26 url, is_main_frame, static_cast<WebContentsImpl*>(web_contents), -1); |
| 27 return scoped_ptr<NavigationHandle>(handle_impl.Pass()); | 27 return scoped_ptr<NavigationHandle>(handle_impl.Pass()); |
| 28 } | 28 } |
| 29 | 29 |
| 30 } // namespace content | 30 } // namespace content |
| OLD | NEW |