| 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 // Defines the Chrome Extensions WebNavigation API functions for observing and | 5 // Defines the Chrome Extensions WebNavigation API functions for observing and |
| 6 // intercepting navigation events, as specified in the extension JSON API. | 6 // intercepting navigation events, as specified in the extension JSON API. |
| 7 | 7 |
| 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ | 8 #ifndef CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ |
| 9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ | 9 #define CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 | 43 |
| 44 const FrameNavigationState& frame_navigation_state() const { | 44 const FrameNavigationState& frame_navigation_state() const { |
| 45 return navigation_state_; | 45 return navigation_state_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // content::WebContentsObserver implementation. | 48 // content::WebContentsObserver implementation. |
| 49 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; | 49 void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| 50 void FrameDeleted(content::RenderFrameHost* render_frame_host) override; | 50 void FrameDeleted(content::RenderFrameHost* render_frame_host) override; |
| 51 void RenderFrameHostChanged(content::RenderFrameHost* old_host, | 51 void RenderFrameHostChanged(content::RenderFrameHost* old_host, |
| 52 content::RenderFrameHost* new_host) override; | 52 content::RenderFrameHost* new_host) override; |
| 53 void DidStartProvisionalLoadForFrame( | 53 void DidStartNavigation( |
| 54 content::RenderFrameHost* render_frame_host, | 54 content::NavigationHandle* navigation_handle) override; |
| 55 const GURL& validated_url, | 55 void DidFinishNavigation( |
| 56 bool is_error_page, | 56 content::NavigationHandle* navigation_handle) override; |
| 57 bool is_iframe_srcdoc) override; | |
| 58 void DidCommitProvisionalLoadForFrame( | |
| 59 content::RenderFrameHost* render_frame_host, | |
| 60 const GURL& url, | |
| 61 ui::PageTransition transition_type) override; | |
| 62 void DidFailProvisionalLoad(content::RenderFrameHost* render_frame_host, | |
| 63 const GURL& validated_url, | |
| 64 int error_code, | |
| 65 const base::string16& error_description, | |
| 66 bool was_ignored_by_handler) override; | |
| 67 void DocumentLoadedInFrame( | 57 void DocumentLoadedInFrame( |
| 68 content::RenderFrameHost* render_frame_host) override; | 58 content::RenderFrameHost* render_frame_host) override; |
| 69 void DidFinishLoad(content::RenderFrameHost* render_frame_host, | 59 void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
| 70 const GURL& validated_url) override; | 60 const GURL& validated_url) override; |
| 71 void DidFailLoad(content::RenderFrameHost* render_frame_host, | 61 void DidFailLoad(content::RenderFrameHost* render_frame_host, |
| 72 const GURL& validated_url, | 62 const GURL& validated_url, |
| 73 int error_code, | 63 int error_code, |
| 74 const base::string16& error_description, | 64 const base::string16& error_description, |
| 75 bool was_ignored_by_handler) override; | 65 bool was_ignored_by_handler) override; |
| 76 void DidGetRedirectForResourceRequest( | |
| 77 content::RenderFrameHost* render_frame_host, | |
| 78 const content::ResourceRedirectDetails& details) override; | |
| 79 void DidOpenRequestedURL(content::WebContents* new_contents, | 66 void DidOpenRequestedURL(content::WebContents* new_contents, |
| 80 content::RenderFrameHost* source_render_frame_host, | 67 content::RenderFrameHost* source_render_frame_host, |
| 81 const GURL& url, | 68 const GURL& url, |
| 82 const content::Referrer& referrer, | 69 const content::Referrer& referrer, |
| 83 WindowOpenDisposition disposition, | 70 WindowOpenDisposition disposition, |
| 84 ui::PageTransition transition) override; | 71 ui::PageTransition transition) override; |
| 85 void WebContentsDestroyed() override; | 72 void WebContentsDestroyed() override; |
| 86 | 73 |
| 87 private: | 74 private: |
| 88 explicit WebNavigationTabObserver(content::WebContents* web_contents); | 75 explicit WebNavigationTabObserver(content::WebContents* web_contents); |
| 89 friend class content::WebContentsUserData<WebNavigationTabObserver>; | 76 friend class content::WebContentsUserData<WebNavigationTabObserver>; |
| 90 | 77 |
| 78 void HandleCommit(content::NavigationHandle* navigation_handle); |
| 79 void HandleError(content::NavigationHandle* navigation_handle); |
| 80 |
| 91 // True if the transition and target url correspond to a reference fragment | 81 // True if the transition and target url correspond to a reference fragment |
| 92 // navigation. | 82 // navigation. |
| 93 bool IsReferenceFragmentNavigation(content::RenderFrameHost* frame_host, | 83 bool IsReferenceFragmentNavigation(content::RenderFrameHost* frame_host, |
| 94 const GURL& url); | 84 const GURL& url); |
| 95 | 85 |
| 96 // Creates and sends onErrorOccurred events for all on-going navigations. If | 86 // Creates and sends onErrorOccurred events for all on-going navigations. If |
| 97 // |render_view_host| is non-NULL, only generates events for frames in this | 87 // |render_view_host| is non-NULL, only generates events for frames in this |
| 98 // render view host. If |frame_host_to_skip| is given, no events are sent for | 88 // render view host. If |frame_host_to_skip| is given, no events are sent for |
| 99 // that | 89 // that |
| 100 // frame. | 90 // frame. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 211 |
| 222 // Created lazily upon OnListenerAdded. | 212 // Created lazily upon OnListenerAdded. |
| 223 scoped_ptr<WebNavigationEventRouter> web_navigation_event_router_; | 213 scoped_ptr<WebNavigationEventRouter> web_navigation_event_router_; |
| 224 | 214 |
| 225 DISALLOW_COPY_AND_ASSIGN(WebNavigationAPI); | 215 DISALLOW_COPY_AND_ASSIGN(WebNavigationAPI); |
| 226 }; | 216 }; |
| 227 | 217 |
| 228 } // namespace extensions | 218 } // namespace extensions |
| 229 | 219 |
| 230 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ | 220 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ |
| OLD | NEW |