Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / browser / frame_host / navigator_delegate.h
blob75df9c412db63e02f05b14c2a2bc0eb719713d24
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_DELEGATE_H_
6 #define CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_DELEGATE_H_
8 #include "base/strings/string16.h"
9 #include "content/public/browser/invalidate_type.h"
10 #include "content/public/browser/navigation_controller.h"
11 #include "ui/base/page_transition_types.h"
12 #include "ui/base/window_open_disposition.h"
14 class GURL;
15 struct FrameHostMsg_DidCommitProvisionalLoad_Params;
16 struct FrameHostMsg_DidFailProvisionalLoadWithError_Params;
18 namespace content {
20 class FrameTreeNode;
21 class RenderFrameHostImpl;
22 struct LoadCommittedDetails;
23 struct OpenURLParams;
25 // A delegate API used by Navigator to notify its embedder of navigation
26 // related events.
27 class CONTENT_EXPORT NavigatorDelegate {
28 public:
29 // The RenderFrameHost started a provisional load for the frame
30 // represented by |render_frame_host|.
31 virtual void DidStartProvisionalLoad(
32 RenderFrameHostImpl* render_frame_host,
33 const GURL& validated_url,
34 bool is_error_page,
35 bool is_iframe_srcdoc) {}
37 // The |render_frame_host| started a transition-flagged navigation.
38 virtual void DidStartNavigationTransition(
39 RenderFrameHostImpl* render_frame_host) {}
41 // A provisional load in |render_frame_host| failed.
42 virtual void DidFailProvisionalLoadWithError(
43 RenderFrameHostImpl* render_frame_host,
44 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {}
46 // Document load in |render_frame_host| failed.
47 virtual void DidFailLoadWithError(
48 RenderFrameHostImpl* render_frame_host,
49 const GURL& url,
50 int error_code,
51 const base::string16& error_description) {}
53 // A navigation was committed in |render_frame_host|.
54 virtual void DidCommitProvisionalLoad(
55 RenderFrameHostImpl* render_frame_host,
56 const GURL& url,
57 ui::PageTransition transition_type) {}
59 // Handles post-navigation tasks in navigation BEFORE the entry has been
60 // committed to the NavigationController.
61 virtual void DidNavigateMainFramePreCommit(bool navigation_is_within_page) {}
63 // Handles post-navigation tasks in navigation AFTER the entry has been
64 // committed to the NavigationController. Note that the NavigationEntry is
65 // not provided since it may be invalid/changed after being committed. The
66 // NavigationController's last committed entry is for this navigation.
67 virtual void DidNavigateMainFramePostCommit(
68 RenderFrameHostImpl* render_frame_host,
69 const LoadCommittedDetails& details,
70 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
71 virtual void DidNavigateAnyFramePostCommit(
72 RenderFrameHostImpl* render_frame_host,
73 const LoadCommittedDetails& details,
74 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
76 virtual void SetMainFrameMimeType(const std::string& mime_type) {}
77 virtual bool CanOverscrollContent() const;
79 // Notification to the Navigator embedder that navigation state has
80 // changed. This method corresponds to
81 // WebContents::NotifyNavigationStateChanged.
82 virtual void NotifyChangedNavigationState(InvalidateTypes changed_flags) {}
84 // Notifies the Navigator embedder that it is beginning to navigate a frame.
85 virtual void AboutToNavigateRenderFrame(
86 RenderFrameHostImpl* old_host,
87 RenderFrameHostImpl* new_host) {}
89 // Notifies the Navigator embedder that a navigation to the pending
90 // NavigationEntry has started in the browser process.
91 virtual void DidStartNavigationToPendingEntry(
92 const GURL& url,
93 NavigationController::ReloadType reload_type) {}
95 // Opens a URL with the given parameters. See PageNavigator::OpenURL, which
96 // this forwards to.
97 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
98 const OpenURLParams& params) {}
100 // Returns whether URLs for aborted browser-initiated navigations should be
101 // preserved in the omnibox. Defaults to false.
102 virtual bool ShouldPreserveAbortedURLs();
104 // A RenderFrameHost in the specified |frame_tree_node| started loading a new
105 // document. This correponds to Blink's notion of the throbber starting.
106 // |to_different_document| will be true unless the load is a fragment
107 // navigation, or triggered by history.pushState/replaceState.
108 virtual void DidStartLoading(FrameTreeNode* frame_tree_node,
109 bool to_different_document) {}
111 // A document stopped loading. This corresponds to Blink's notion of the
112 // throbber stopping.
113 virtual void DidStopLoading() {}
115 // The load progress was changed.
116 virtual void DidChangeLoadProgress() {}
119 } // namspace content
121 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_DELEGATE_H_