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"
13 struct FrameMsg_Navigate_Params;
17 class NavigationControllerImpl;
18 class NavigatorDelegate;
19 struct LoadCommittedDetails;
21 // This class is an implementation of Navigator, responsible for managing
22 // navigations in regular browser tabs.
23 class CONTENT_EXPORT NavigatorImpl : public Navigator {
25 NavigatorImpl(NavigationControllerImpl* navigation_controller,
26 NavigatorDelegate* delegate);
28 // Fills in |params| based on the content of |entry|.
29 static void MakeNavigateParams(const NavigationEntryImpl& entry,
30 const NavigationControllerImpl& controller,
31 NavigationController::ReloadType reload_type,
32 base::TimeTicks navigation_start,
33 FrameMsg_Navigate_Params* params);
35 // Navigator implementation.
36 virtual NavigationController* GetController() OVERRIDE;
37 virtual void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host,
39 bool is_transition_navigation) OVERRIDE;
40 virtual void DidFailProvisionalLoadWithError(
41 RenderFrameHostImpl* render_frame_host,
42 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
44 virtual void DidFailLoadWithError(
45 RenderFrameHostImpl* render_frame_host,
48 const base::string16& error_description) OVERRIDE;
49 virtual void DidNavigate(
50 RenderFrameHostImpl* render_frame_host,
51 const FrameHostMsg_DidCommitProvisionalLoad_Params&
52 input_params) OVERRIDE;
53 virtual bool NavigateToPendingEntry(
54 RenderFrameHostImpl* render_frame_host,
55 NavigationController::ReloadType reload_type) OVERRIDE;
56 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
58 const Referrer& referrer,
59 WindowOpenDisposition disposition,
60 bool should_replace_current_entry,
61 bool user_gesture) OVERRIDE;
62 virtual void RequestTransferURL(
63 RenderFrameHostImpl* render_frame_host,
65 const std::vector<GURL>& redirect_chain,
66 const Referrer& referrer,
67 ui::PageTransition page_transition,
68 WindowOpenDisposition disposition,
69 const GlobalRequestID& transferred_global_request_id,
70 bool should_replace_current_entry,
71 bool user_gesture) OVERRIDE;
72 virtual void CommitNavigation(
73 RenderFrameHostImpl* render_frame_host,
74 const NavigationBeforeCommitInfo& info) OVERRIDE;
77 virtual ~NavigatorImpl() {}
79 // Navigates to the given entry, which must be the pending entry. Private
80 // because all callers should use NavigateToPendingEntry.
82 RenderFrameHostImpl* render_frame_host,
83 const NavigationEntryImpl& entry,
84 NavigationController::ReloadType reload_type);
86 bool ShouldAssignSiteForURL(const GURL& url);
88 void CheckWebUIRendererDoesNotDisplayNormalURL(
89 RenderFrameHostImpl* render_frame_host,
92 // The NavigationController that will keep track of session history for all
93 // RenderFrameHost objects using this NavigatorImpl.
94 // TODO(nasko): Move ownership of the NavigationController from
95 // WebContentsImpl to this class.
96 NavigationControllerImpl* controller_;
98 // Used to notify the object embedding this Navigator about navigation
99 // events. Can be NULL in tests.
100 NavigatorDelegate* delegate_;
102 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
105 } // namespace content
107 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_