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 "extensions/browser/extension_event_histogram_value.h"
12 #include "ui/base/page_transition_types.h"
16 class RenderFrameHost
;
22 namespace extensions
{
24 namespace web_navigation_api_helpers
{
26 // Returns the frame ID as it will be passed to the extension:
27 // 0 if the navigation happens in the main frame, or the frame routing ID
29 int GetFrameId(content::RenderFrameHost
* frame_host
);
31 // Create and dispatch the various events of the webNavigation API.
32 void DispatchOnBeforeNavigate(content::WebContents
* web_contents
,
33 content::RenderFrameHost
* frame_host
,
34 const GURL
& validated_url
);
36 void DispatchOnCommitted(events::HistogramValue histogram_value
,
37 const std::string
& event_name
,
38 content::WebContents
* web_contents
,
39 content::RenderFrameHost
* frame_host
,
41 ui::PageTransition transition_type
);
43 void DispatchOnDOMContentLoaded(content::WebContents
* web_contents
,
44 content::RenderFrameHost
* frame_host
,
47 void DispatchOnCompleted(content::WebContents
* web_contents
,
48 content::RenderFrameHost
* frame_host
,
51 void DispatchOnCreatedNavigationTarget(
52 content::WebContents
* web_contents
,
53 content::BrowserContext
* browser_context
,
54 content::RenderFrameHost
* source_frame_host
,
55 content::WebContents
* target_web_contents
,
56 const GURL
& target_url
);
58 void DispatchOnErrorOccurred(content::WebContents
* web_contents
,
59 content::RenderFrameHost
* frame_host
,
63 void DispatchOnTabReplaced(
64 content::WebContents
* old_web_contents
,
65 content::BrowserContext
* browser_context
,
66 content::WebContents
* new_web_contents
);
68 } // namespace web_navigation_api_helpers
70 } // namespace extensions
72 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_H_