1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_H_
10 #include "base/basictypes.h"
11 #include "content/public/common/page_transition_types.h"
15 class RenderFrameHost
;
21 namespace extensions
{
23 namespace web_navigation_api_helpers
{
25 // Returns the frame ID as it will be passed to the extension:
26 // 0 if the navigation happens in the main frame, or the frame routing ID
28 int GetFrameId(content::RenderFrameHost
* frame_host
);
30 // Create and dispatch the various events of the webNavigation API.
31 void DispatchOnBeforeNavigate(content::WebContents
* web_contents
,
32 content::RenderFrameHost
* frame_host
,
33 const GURL
& validated_url
);
35 void DispatchOnCommitted(const std::string
& event_name
,
36 content::WebContents
* web_contents
,
37 content::RenderFrameHost
* frame_host
,
39 content::PageTransition transition_type
);
41 void DispatchOnDOMContentLoaded(content::WebContents
* web_contents
,
42 content::RenderFrameHost
* frame_host
,
45 void DispatchOnCompleted(content::WebContents
* web_contents
,
46 content::RenderFrameHost
* frame_host
,
49 void DispatchOnCreatedNavigationTarget(
50 content::WebContents
* web_contents
,
51 content::BrowserContext
* browser_context
,
52 content::RenderFrameHost
* source_frame_host
,
53 content::WebContents
* target_web_contents
,
54 const GURL
& target_url
);
56 void DispatchOnErrorOccurred(content::WebContents
* web_contents
,
57 content::RenderFrameHost
* frame_host
,
61 void DispatchOnTabReplaced(
62 content::WebContents
* old_web_contents
,
63 content::BrowserContext
* browser_context
,
64 content::WebContents
* new_web_contents
);
66 } // namespace web_navigation_api_helpers
68 } // namespace extensions
70 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_H_