Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / frame_host / navigator_impl.h
blobb461ae05cc6e2630c26f9e11cc7f51f854d2961a
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;
15 namespace content {
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 {
24 public:
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,
38 const GURL& url,
39 bool is_transition_navigation) OVERRIDE;
40 virtual void DidFailProvisionalLoadWithError(
41 RenderFrameHostImpl* render_frame_host,
42 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params)
43 OVERRIDE;
44 virtual void DidFailLoadWithError(
45 RenderFrameHostImpl* render_frame_host,
46 const GURL& url,
47 int error_code,
48 const base::string16& error_description) OVERRIDE;
49 virtual void DidRedirectProvisionalLoad(
50 RenderFrameHostImpl* render_frame_host,
51 int32 page_id,
52 const GURL& source_url,
53 const GURL& target_url) OVERRIDE;
54 virtual void DidNavigate(
55 RenderFrameHostImpl* render_frame_host,
56 const FrameHostMsg_DidCommitProvisionalLoad_Params&
57 input_params) OVERRIDE;
58 virtual bool NavigateToPendingEntry(
59 RenderFrameHostImpl* render_frame_host,
60 NavigationController::ReloadType reload_type) OVERRIDE;
61 virtual base::TimeTicks GetCurrentLoadStart() OVERRIDE;
62 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
63 const GURL& url,
64 const Referrer& referrer,
65 WindowOpenDisposition disposition,
66 bool should_replace_current_entry,
67 bool user_gesture) OVERRIDE;
68 virtual void RequestTransferURL(
69 RenderFrameHostImpl* render_frame_host,
70 const GURL& url,
71 const std::vector<GURL>& redirect_chain,
72 const Referrer& referrer,
73 PageTransition page_transition,
74 WindowOpenDisposition disposition,
75 const GlobalRequestID& transferred_global_request_id,
76 bool should_replace_current_entry,
77 bool user_gesture) OVERRIDE;
78 virtual void CommitNavigation(
79 RenderFrameHostImpl* render_frame_host,
80 const NavigationBeforeCommitInfo& info) OVERRIDE;
82 private:
83 virtual ~NavigatorImpl() {}
85 // Navigates to the given entry, which must be the pending entry. Private
86 // because all callers should use NavigateToPendingEntry.
87 bool NavigateToEntry(
88 RenderFrameHostImpl* render_frame_host,
89 const NavigationEntryImpl& entry,
90 NavigationController::ReloadType reload_type);
92 bool ShouldAssignSiteForURL(const GURL& url);
94 void CheckWebUIRendererDoesNotDisplayNormalURL(
95 RenderFrameHostImpl* render_frame_host,
96 const GURL& url);
98 // The NavigationController that will keep track of session history for all
99 // RenderFrameHost objects using this NavigatorImpl.
100 // TODO(nasko): Move ownership of the NavigationController from
101 // WebContentsImpl to this class.
102 NavigationControllerImpl* controller_;
104 // Used to notify the object embedding this Navigator about navigation
105 // events. Can be NULL in tests.
106 NavigatorDelegate* delegate_;
108 // System time at which the current load was started.
109 base::TimeTicks current_load_start_;
111 DISALLOW_COPY_AND_ASSIGN(NavigatorImpl);
114 } // namespace content
116 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_IMPL_H_