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"
20 namespace extensions {
22 namespace web_navigation_api_helpers {
24 // Returns the frame ID as it will be passed to the extension:
25 // 0 if the navigation happens in the main frame, or the frame ID
26 // modulo 32 bits otherwise.
27 int GetFrameId(bool is_main_frame, int64 frame_id);
29 // Create and dispatch the various events of the webNavigation API.
30 void DispatchOnBeforeNavigate(content::WebContents* web_contents,
31 int render_process_id,
34 int64 parent_frame_id,
35 bool parent_is_main_frame,
36 const GURL& validated_url);
38 void DispatchOnCommitted(const std::string& event_name,
39 content::WebContents* web_contents,
43 content::PageTransition transition_type);
45 void DispatchOnDOMContentLoaded(content::WebContents* web_contents,
50 void DispatchOnCompleted(content::WebContents* web_contents,
55 void DispatchOnCreatedNavigationTarget(
56 content::WebContents* web_contents,
57 content::BrowserContext* browser_context,
58 int64 source_frame_id,
59 bool source_frame_is_main_frame,
60 content::WebContents* target_web_contents,
61 const GURL& target_url);
63 void DispatchOnErrorOccurred(content::WebContents* web_contents,
64 int render_process_id,
70 void DispatchOnTabReplaced(
71 content::WebContents* old_web_contents,
72 content::BrowserContext* browser_context,
73 content::WebContents* new_web_contents);
75 } // namespace web_navigation_api_helpers
77 } // namespace extensions
79 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_H_