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 <memory> |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "extensions/browser/extension_event_histogram_value.h" | 11 #include "extensions/browser/extension_event_histogram_value.h" |
11 #include "ui/base/page_transition_types.h" | 12 #include "ui/base/page_transition_types.h" |
12 | 13 |
13 namespace content { | 14 namespace content { |
14 class BrowserContext; | 15 class BrowserContext; |
15 class NavigationHandle; | 16 class NavigationHandle; |
16 class RenderFrameHost; | 17 class RenderFrameHost; |
17 class WebContents; | 18 class WebContents; |
18 } | 19 } |
19 | 20 |
20 class GURL; | 21 class GURL; |
21 | 22 |
22 namespace extensions { | 23 namespace extensions { |
23 | 24 |
| 25 struct Event; |
| 26 |
24 namespace web_navigation_api_helpers { | 27 namespace web_navigation_api_helpers { |
25 | 28 |
26 // Returns the frame ID as it will be passed to the extension: | 29 // 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 | 30 // 0 if the navigation happens in the main frame, or the frame routing ID |
28 // otherwise. | 31 // otherwise. |
29 int GetFrameId(content::RenderFrameHost* frame_host); | 32 int GetFrameId(content::RenderFrameHost* frame_host); |
30 | 33 |
31 // Create and dispatch the various events of the webNavigation API. | 34 // Create and dispatch the various events of the webNavigation API. |
32 void DispatchOnBeforeNavigate(content::NavigationHandle* navigation_handle); | 35 std::unique_ptr<Event> CreateOnBeforeNavigateEvent( |
| 36 content::NavigationHandle* navigation_handle); |
33 | 37 |
34 void DispatchOnCommitted(events::HistogramValue histogram_value, | 38 void DispatchOnCommitted(events::HistogramValue histogram_value, |
35 const std::string& event_name, | 39 const std::string& event_name, |
36 content::NavigationHandle* navigation_handle); | 40 content::NavigationHandle* navigation_handle); |
37 | 41 |
38 void DispatchOnDOMContentLoaded(content::WebContents* web_contents, | 42 void DispatchOnDOMContentLoaded(content::WebContents* web_contents, |
39 content::RenderFrameHost* frame_host, | 43 content::RenderFrameHost* frame_host, |
40 const GURL& url); | 44 const GURL& url); |
41 | 45 |
42 void DispatchOnCompleted(content::WebContents* web_contents, | 46 void DispatchOnCompleted(content::WebContents* web_contents, |
(...skipping 16 matching lines...) Expand all Loading... |
59 void DispatchOnTabReplaced( | 63 void DispatchOnTabReplaced( |
60 content::WebContents* old_web_contents, | 64 content::WebContents* old_web_contents, |
61 content::BrowserContext* browser_context, | 65 content::BrowserContext* browser_context, |
62 content::WebContents* new_web_contents); | 66 content::WebContents* new_web_contents); |
63 | 67 |
64 } // namespace web_navigation_api_helpers | 68 } // namespace web_navigation_api_helpers |
65 | 69 |
66 } // namespace extensions | 70 } // namespace extensions |
67 | 71 |
68 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPE
RS_H_ | 72 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_HELPE
RS_H_ |
OLD | NEW |