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
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/browser/frame_host/navigation_controller_impl.h"
10 #include "content/browser/frame_host/navigator.h"
11 #include "content/common/content_export.h"
15 class NavigationControllerImpl
;
16 class NavigatorDelegate
;
17 struct LoadCommittedDetails
;
19 // This class is an implementation of Navigator, responsible for managing
20 // navigations in regular browser tabs.
21 class CONTENT_EXPORT NavigatorImpl
: public Navigator
{
23 NavigatorImpl(NavigationControllerImpl
* navigation_controller
,
24 NavigatorDelegate
* delegate
);
26 // Navigator implementation.
27 virtual void DidStartProvisionalLoad(RenderFrameHostImpl
* render_frame_host
,
28 int parent_routing_id
,
29 const GURL
& url
) OVERRIDE
;
30 virtual void DidFailProvisionalLoadWithError(
31 RenderFrameHostImpl
* render_frame_host
,
32 const FrameHostMsg_DidFailProvisionalLoadWithError_Params
& params
)
34 virtual void DidFailLoadWithError(
35 RenderFrameHostImpl
* render_frame_host
,
38 const base::string16
& error_description
) OVERRIDE
;
39 virtual void DidRedirectProvisionalLoad(
40 RenderFrameHostImpl
* render_frame_host
,
42 const GURL
& source_url
,
43 const GURL
& target_url
) OVERRIDE
;
44 virtual void DidNavigate(
45 RenderFrameHostImpl
* render_frame_host
,
46 const FrameHostMsg_DidCommitProvisionalLoad_Params
&
47 input_params
) OVERRIDE
;
48 virtual bool NavigateToPendingEntry(
49 RenderFrameHostImpl
* render_frame_host
,
50 NavigationController::ReloadType reload_type
) OVERRIDE
;
51 virtual base::TimeTicks
GetCurrentLoadStart() OVERRIDE
;
52 virtual void RequestOpenURL(RenderFrameHostImpl
* render_frame_host
,
54 const Referrer
& referrer
,
55 WindowOpenDisposition disposition
,
56 bool should_replace_current_entry
,
57 bool user_gesture
) OVERRIDE
;
58 virtual void RequestTransferURL(
59 RenderFrameHostImpl
* render_frame_host
,
61 const std::vector
<GURL
>& redirect_chain
,
62 const Referrer
& referrer
,
63 PageTransition page_transition
,
64 WindowOpenDisposition disposition
,
65 const GlobalRequestID
& transferred_global_request_id
,
66 bool should_replace_current_entry
,
67 bool user_gesture
) OVERRIDE
;
70 virtual ~NavigatorImpl() {}
72 // Navigates to the given entry, which must be the pending entry. Private
73 // because all callers should use NavigateToPendingEntry.
75 RenderFrameHostImpl
* render_frame_host
,
76 const NavigationEntryImpl
& entry
,
77 NavigationController::ReloadType reload_type
);
79 bool ShouldAssignSiteForURL(const GURL
& url
);
81 // The NavigationController that will keep track of session history for all
82 // RenderFrameHost objects using this NavigatorImpl.
83 // TODO(nasko): Move ownership of the NavigationController from
84 // WebContentsImpl to this class.
85 NavigationControllerImpl
* controller_
;
87 // Used to notify the object embedding this Navigator about navigation
88 // events. Can be NULL in tests.
89 NavigatorDelegate
* delegate_
;
91 // System time at which the current load was started.
92 base::TimeTicks current_load_start_
;
94 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl
);
97 } // namespace content
99 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_