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