Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / frame_host / navigator.h
blob5d7b904689fdbe204820593a0fc4bb6681b049f5
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_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_
8 #include "base/memory/ref_counted.h"
9 #include "content/common/content_export.h"
10 #include "content/public/browser/navigation_controller.h"
11 #include "ui/base/window_open_disposition.h"
13 class GURL;
14 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
15 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params;
17 namespace base {
18 class TimeTicks;
21 namespace content {
23 class NavigationControllerImpl;
24 class NavigationEntryImpl;
25 class NavigatorDelegate;
26 class RenderFrameHostImpl;
28 // Implementations of this interface are responsible for performing navigations
29 // in a node of the FrameTree. Its lifetime is bound to all FrameTreeNode
30 // objects that are using it and will be released once all nodes that use it are
31 // freed. The Navigator is bound to a single frame tree and cannot be used by
32 // multiple instances of FrameTree.
33 // TODO(nasko): Move all navigation methods, such as didStartProvisionalLoad
34 // from WebContentsImpl to this interface.
35 class CONTENT_EXPORT Navigator : public base::RefCounted<Navigator> {
36 public:
37 // The RenderFrameHostImpl started a provisional load.
38 virtual void DidStartProvisionalLoad(RenderFrameHostImpl* render_frame_host,
39 int parent_routing_id,
40 const GURL& url) {};
42 // The RenderFrameHostImpl has failed a provisional load.
43 virtual void DidFailProvisionalLoadWithError(
44 RenderFrameHostImpl* render_frame_host,
45 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {};
47 // The RenderFrameHostImpl has failed to load the document.
48 virtual void DidFailLoadWithError(
49 RenderFrameHostImpl* render_frame_host,
50 const GURL& url,
51 int error_code,
52 const base::string16& error_description) {}
54 // The RenderFrameHostImpl processed a redirect during a provisional load.
56 // TODO(creis): Remove this method and have the pre-rendering code listen to
57 // WebContentsObserver::DidGetRedirectForResourceRequest instead.
58 // See http://crbug.com/78512.
59 virtual void DidRedirectProvisionalLoad(
60 RenderFrameHostImpl* render_frame_host,
61 int32 page_id,
62 const GURL& source_url,
63 const GURL& target_url) {}
65 // The RenderFrameHostImpl has committed a navigation.
66 virtual void DidNavigate(
67 RenderFrameHostImpl* render_frame_host,
68 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
70 // Called by the NavigationController to cause the Navigator to navigate
71 // to the current pending entry. The NavigationController should be called
72 // back with RendererDidNavigate on success or DiscardPendingEntry on failure.
73 // The callbacks can be inside of this function, or at some future time.
75 // The entry has a PageID of -1 if newly created (corresponding to navigation
76 // to a new URL).
78 // If this method returns false, then the navigation is discarded (equivalent
79 // to calling DiscardPendingEntry on the NavigationController).
81 // TODO(nasko): Remove this method from the interface, since Navigator and
82 // NavigationController know about each other. This will be possible once
83 // initialization of Navigator and NavigationController is properly done.
84 virtual bool NavigateToPendingEntry(
85 RenderFrameHostImpl* render_frame_host,
86 NavigationController::ReloadType reload_type);
88 virtual base::TimeTicks GetCurrentLoadStart();
90 // The RenderFrameHostImpl has received a request to open a URL with the
91 // specified |disposition|.
92 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
93 const GURL& url,
94 const Referrer& referrer,
95 WindowOpenDisposition disposition,
96 bool should_replace_current_entry,
97 bool user_gesture) {}
99 // The RenderFrameHostImpl wants to transfer the request to a new renderer.
100 // |redirect_chain| contains any redirect URLs (excluding |url|) that happened
101 // before the transfer.
102 virtual void RequestTransferURL(
103 RenderFrameHostImpl* render_frame_host,
104 const GURL& url,
105 const std::vector<GURL>& redirect_chain,
106 const Referrer& referrer,
107 PageTransition page_transition,
108 WindowOpenDisposition disposition,
109 const GlobalRequestID& transferred_global_request_id,
110 bool should_replace_current_entry,
111 bool user_gesture) {}
113 protected:
114 friend class base::RefCounted<Navigator>;
115 virtual ~Navigator() {}
118 } // namespace content
120 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_H_