OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_
H_ | 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_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPERS_
H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "content/public/common/page_transition_types.h" | 11 #include "content/public/common/page_transition_types.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 class BrowserContext; | 14 class BrowserContext; |
| 15 class RenderFrameHost; |
15 class WebContents; | 16 class WebContents; |
16 } | 17 } |
17 | 18 |
18 class GURL; | 19 class GURL; |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
22 namespace web_navigation_api_helpers { | 23 namespace web_navigation_api_helpers { |
23 | 24 |
24 // Returns the frame ID as it will be passed to the extension: | 25 // 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 // 0 if the navigation happens in the main frame, or the frame routing ID |
26 // modulo 32 bits otherwise. | 27 // otherwise. |
27 int GetFrameId(bool is_main_frame, int64 frame_id); | 28 int GetFrameId(content::RenderFrameHost* frame_host); |
28 | 29 |
29 // Create and dispatch the various events of the webNavigation API. | 30 // Create and dispatch the various events of the webNavigation API. |
30 void DispatchOnBeforeNavigate(content::WebContents* web_contents, | 31 void DispatchOnBeforeNavigate(content::WebContents* web_contents, |
31 int render_process_id, | 32 content::RenderFrameHost* frame_host, |
32 int64 frame_id, | |
33 bool is_main_frame, | |
34 int64 parent_frame_id, | |
35 bool parent_is_main_frame, | |
36 const GURL& validated_url); | 33 const GURL& validated_url); |
37 | 34 |
38 void DispatchOnCommitted(const std::string& event_name, | 35 void DispatchOnCommitted(const std::string& event_name, |
39 content::WebContents* web_contents, | 36 content::WebContents* web_contents, |
40 int64 frame_id, | 37 content::RenderFrameHost* frame_host, |
41 bool is_main_frame, | |
42 const GURL& url, | 38 const GURL& url, |
43 content::PageTransition transition_type); | 39 content::PageTransition transition_type); |
44 | 40 |
45 void DispatchOnDOMContentLoaded(content::WebContents* web_contents, | 41 void DispatchOnDOMContentLoaded(content::WebContents* web_contents, |
46 const GURL& url, | 42 content::RenderFrameHost* frame_host, |
47 bool is_main_frame, | 43 const GURL& url); |
48 int64 frame_id); | |
49 | 44 |
50 void DispatchOnCompleted(content::WebContents* web_contents, | 45 void DispatchOnCompleted(content::WebContents* web_contents, |
51 const GURL& url, | 46 content::RenderFrameHost* frame_host, |
52 bool is_main_frame, | 47 const GURL& url); |
53 int64 frame_id); | |
54 | 48 |
55 void DispatchOnCreatedNavigationTarget( | 49 void DispatchOnCreatedNavigationTarget( |
56 content::WebContents* web_contents, | 50 content::WebContents* web_contents, |
57 content::BrowserContext* browser_context, | 51 content::BrowserContext* browser_context, |
58 int64 source_frame_id, | 52 content::RenderFrameHost* source_frame_host, |
59 bool source_frame_is_main_frame, | |
60 content::WebContents* target_web_contents, | 53 content::WebContents* target_web_contents, |
61 const GURL& target_url); | 54 const GURL& target_url); |
62 | 55 |
63 void DispatchOnErrorOccurred(content::WebContents* web_contents, | 56 void DispatchOnErrorOccurred(content::WebContents* web_contents, |
64 int render_process_id, | 57 content::RenderFrameHost* frame_host, |
65 const GURL& url, | 58 const GURL& url, |
66 int64 frame_id, | |
67 bool is_main_frame, | |
68 int error_code); | 59 int error_code); |
69 | 60 |
70 void DispatchOnTabReplaced( | 61 void DispatchOnTabReplaced( |
71 content::WebContents* old_web_contents, | 62 content::WebContents* old_web_contents, |
72 content::BrowserContext* browser_context, | 63 content::BrowserContext* browser_context, |
73 content::WebContents* new_web_contents); | 64 content::WebContents* new_web_contents); |
74 | 65 |
75 } // namespace web_navigation_api_helpers | 66 } // namespace web_navigation_api_helpers |
76 | 67 |
77 } // namespace extensions | 68 } // namespace extensions |
78 | 69 |
79 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPE
RS_H_ | 70 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPE
RS_H_ |
OLD | NEW |