[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / browser / frame_host / navigator_delegate.h
blob14ab69b5733310c42105a3f534ea00dba2bf7680
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 NavigationHandle;
22 class RenderFrameHostImpl;
23 struct LoadCommittedDetails;
24 struct OpenURLParams;
26 // A delegate API used by Navigator to notify its embedder of navigation
27 // related events.
28 class CONTENT_EXPORT NavigatorDelegate {
29 public:
30 // Called when a navigation started. The same NavigationHandle will be
31 // provided for events related to the same navigation.
32 virtual void DidStartNavigation(NavigationHandle* navigation_handle) {}
34 // Called when a navigation was redirected.
35 virtual void DidRedirectNavigation(NavigationHandle* navigation_handle) {}
37 // Called when the navigation is about to be committed in a renderer.
38 virtual void ReadyToCommitNavigation(NavigationHandle* navigation_handle) {}
40 // Called when a navigation committed.
41 virtual void DidCommitNavigation(NavigationHandle* navigation_handle) {}
43 // Called when a document load resulting from the navigation stopped. Note
44 // that |navigation_handle| will be destroyed at the end of this call.
45 virtual void DidFinishNavigation(NavigationHandle* navigation_handle) {}
47 // TODO(clamy): all methods below that are related to navigation
48 // events should go away in favor of the ones above.
50 // The RenderFrameHost started a provisional load for the frame
51 // represented by |render_frame_host|.
52 virtual void DidStartProvisionalLoad(
53 RenderFrameHostImpl* render_frame_host,
54 const GURL& validated_url,
55 bool is_error_page,
56 bool is_iframe_srcdoc) {}
58 // A provisional load in |render_frame_host| failed.
59 virtual void DidFailProvisionalLoadWithError(
60 RenderFrameHostImpl* render_frame_host,
61 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {}
63 // Document load in |render_frame_host| failed.
64 virtual void DidFailLoadWithError(
65 RenderFrameHostImpl* render_frame_host,
66 const GURL& url,
67 int error_code,
68 const base::string16& error_description,
69 bool was_ignored_by_handler) {}
71 // A navigation was committed in |render_frame_host|.
72 virtual void DidCommitProvisionalLoad(
73 RenderFrameHostImpl* render_frame_host,
74 const GURL& url,
75 ui::PageTransition transition_type) {}
77 // Handles post-navigation tasks in navigation BEFORE the entry has been
78 // committed to the NavigationController.
79 virtual void DidNavigateMainFramePreCommit(bool navigation_is_within_page) {}
81 // Handles post-navigation tasks in navigation AFTER the entry has been
82 // committed to the NavigationController. Note that the NavigationEntry is
83 // not provided since it may be invalid/changed after being committed. The
84 // NavigationController's last committed entry is for this navigation.
85 virtual void DidNavigateMainFramePostCommit(
86 RenderFrameHostImpl* render_frame_host,
87 const LoadCommittedDetails& details,
88 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
89 virtual void DidNavigateAnyFramePostCommit(
90 RenderFrameHostImpl* render_frame_host,
91 const LoadCommittedDetails& details,
92 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
94 virtual void SetMainFrameMimeType(const std::string& mime_type) {}
95 virtual bool CanOverscrollContent() const;
97 // Notification to the Navigator embedder that navigation state has
98 // changed. This method corresponds to
99 // WebContents::NotifyNavigationStateChanged.
100 virtual void NotifyChangedNavigationState(InvalidateTypes changed_flags) {}
102 // Notifies the Navigator embedder that it is beginning to navigate a frame.
103 virtual void AboutToNavigateRenderFrame(
104 RenderFrameHostImpl* old_host,
105 RenderFrameHostImpl* new_host) {}
107 // Notifies the Navigator embedder that a navigation to the pending
108 // NavigationEntry has started in the browser process.
109 virtual void DidStartNavigationToPendingEntry(
110 const GURL& url,
111 NavigationController::ReloadType reload_type) {}
113 // Opens a URL with the given parameters. See PageNavigator::OpenURL, which
114 // this forwards to.
115 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
116 const OpenURLParams& params) {}
118 // Returns whether URLs for aborted browser-initiated navigations should be
119 // preserved in the omnibox. Defaults to false.
120 virtual bool ShouldPreserveAbortedURLs();
122 // A RenderFrameHost in the specified |frame_tree_node| started loading a new
123 // document. This correponds to Blink's notion of the throbber starting.
124 // |to_different_document| will be true unless the load is a fragment
125 // navigation, or triggered by history.pushState/replaceState.
126 virtual void DidStartLoading(FrameTreeNode* frame_tree_node,
127 bool to_different_document) {}
129 // A document stopped loading. This corresponds to Blink's notion of the
130 // throbber stopping.
131 virtual void DidStopLoading() {}
133 // The load progress was changed.
134 virtual void DidChangeLoadProgress() {}
137 } // namspace content
139 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_DELEGATE_H_