Battery Status API: add UMA logging for Linux.
[chromium-blink-merge.git] / content / browser / frame_host / navigator_delegate.h
blob718c3b8cfd2831b9cf4e3d0839e4b8baa9ab0318
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 "content/public/common/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 RenderFrameHostImpl;
21 struct LoadCommittedDetails;
22 struct OpenURLParams;
24 // A delegate API used by Navigator to notify its embedder of navigation
25 // related events.
26 class CONTENT_EXPORT NavigatorDelegate {
27 public:
28 // The RenderFrameHost started a provisional load for the frame
29 // represented by |render_frame_host|.
30 virtual void DidStartProvisionalLoad(
31 RenderFrameHostImpl* render_frame_host,
32 const GURL& validated_url,
33 bool is_error_page,
34 bool is_iframe_srcdoc) {}
36 // The |render_frame_host| started a transition-flagged navigation.
37 virtual void DidStartNavigationTransition(
38 RenderFrameHostImpl* render_frame_host) {}
40 // A provisional load in |render_frame_host| failed.
41 virtual void DidFailProvisionalLoadWithError(
42 RenderFrameHostImpl* render_frame_host,
43 const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) {}
45 // Document load in |render_frame_host| failed.
46 virtual void DidFailLoadWithError(
47 RenderFrameHostImpl* render_frame_host,
48 const GURL& url,
49 int error_code,
50 const base::string16& error_description) {}
52 // A redirect was processed in |render_frame_host| during a provisional load.
53 virtual void DidRedirectProvisionalLoad(
54 RenderFrameHostImpl* render_frame_host,
55 const GURL& validated_target_url) {}
57 // A navigation was committed in |render_frame_host|.
58 virtual void DidCommitProvisionalLoad(
59 RenderFrameHostImpl* render_frame_host,
60 const GURL& url,
61 PageTransition transition_type) {}
63 // Handles post-navigation tasks in navigation BEFORE the entry has been
64 // committed to the NavigationController.
65 virtual void DidNavigateMainFramePreCommit(bool navigation_is_within_page) {}
67 // Handles post-navigation tasks in navigation AFTER the entry has been
68 // committed to the NavigationController. Note that the NavigationEntry is
69 // not provided since it may be invalid/changed after being committed. The
70 // NavigationController's last committed entry is for this navigation.
71 virtual void DidNavigateMainFramePostCommit(
72 const LoadCommittedDetails& details,
73 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
74 virtual void DidNavigateAnyFramePostCommit(
75 RenderFrameHostImpl* render_frame_host,
76 const LoadCommittedDetails& details,
77 const FrameHostMsg_DidCommitProvisionalLoad_Params& params) {}
79 virtual void SetMainFrameMimeType(const std::string& mime_type) {}
80 virtual bool CanOverscrollContent() const;
82 // Notification to the Navigator embedder that navigation state has
83 // changed. This method corresponds to
84 // WebContents::NotifyNavigationStateChanged.
85 virtual void NotifyChangedNavigationState(InvalidateTypes changed_flags) {}
87 // Notifies the Navigator embedder that it is beginning to navigate a frame.
88 virtual void AboutToNavigateRenderFrame(
89 RenderFrameHostImpl* render_frame_host) {}
91 // Notifies the Navigator embedder that a navigation to pending
92 // NavigationEntry has started in the browser process.
93 virtual void DidStartNavigationToPendingEntry(
94 RenderFrameHostImpl* render_frame_host,
95 const GURL& url,
96 NavigationController::ReloadType reload_type) {}
98 // Opens a URL with the given parameters. See PageNavigator::OpenURL, which
99 // this forwards to.
100 virtual void RequestOpenURL(RenderFrameHostImpl* render_frame_host,
101 const OpenURLParams& params) {}
103 // Returns whether URLs for aborted browser-initiated navigations should be
104 // preserved in the omnibox. Defaults to false.
105 virtual bool ShouldPreserveAbortedURLs();
108 } // namspace content
110 #endif // CONTENT_BROWSER_FRAME_HOST_NAVIGATOR_DELEGATE_H_