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 // content::NotificationObserver implementation. | 43 // content::NotificationObserver implementation. |
44 virtual void Observe(int type, | 44 virtual void Observe(int type, |
45 const content::NotificationSource& source, | 45 const content::NotificationSource& source, |
46 const content::NotificationDetails& details) OVERRIDE; | 46 const content::NotificationDetails& details) OVERRIDE; |
47 | 47 |
48 | 48 |
49 // content::WebContentsObserver implementation. | 49 // content::WebContentsObserver implementation. |
50 virtual void AboutToNavigateRenderView( | 50 virtual void AboutToNavigateRenderView( |
51 content::RenderViewHost* render_view_host) OVERRIDE; | 51 content::RenderViewHost* render_view_host) OVERRIDE; |
52 virtual void DidStartProvisionalLoadForFrame( | 52 virtual void DidStartProvisionalLoadForFrame( |
53 int64 frame_id, | 53 int64 frame_num, |
54 bool is_main_frame, | 54 bool is_main_frame, |
55 const GURL& validated_url, | 55 const GURL& validated_url, |
56 bool is_error_page, | 56 bool is_error_page, |
57 content::RenderViewHost* render_view_host) OVERRIDE; | 57 content::RenderViewHost* render_view_host) OVERRIDE; |
58 virtual void DidCommitProvisionalLoadForFrame( | 58 virtual void DidCommitProvisionalLoadForFrame( |
59 int64 frame_id, | 59 int64 frame_num, |
60 bool is_main_frame, | 60 bool is_main_frame, |
61 const GURL& url, | 61 const GURL& url, |
62 content::PageTransition transition_type, | 62 content::PageTransition transition_type, |
63 content::RenderViewHost* render_view_host) OVERRIDE; | 63 content::RenderViewHost* render_view_host) OVERRIDE; |
64 virtual void DidFailProvisionalLoad( | 64 virtual void DidFailProvisionalLoad( |
65 int64 frame_id, | 65 int64 frame_num, |
66 bool is_main_frame, | 66 bool is_main_frame, |
67 const GURL& validated_url, | 67 const GURL& validated_url, |
68 int error_code, | 68 int error_code, |
69 const string16& error_description, | 69 const string16& error_description, |
70 content::RenderViewHost* render_view_host) OVERRIDE; | 70 content::RenderViewHost* render_view_host) OVERRIDE; |
71 virtual void DocumentLoadedInFrame( | 71 virtual void DocumentLoadedInFrame( |
72 int64 frame_id, | 72 int64 frame_num, |
73 content::RenderViewHost* render_view_host) OVERRIDE; | 73 content::RenderViewHost* render_view_host) OVERRIDE; |
74 virtual void DidFinishLoad( | 74 virtual void DidFinishLoad( |
75 int64 frame_id, | 75 int64 frame_num, |
76 const GURL& validated_url, | 76 const GURL& validated_url, |
77 bool is_main_frame, | 77 bool is_main_frame, |
78 content::RenderViewHost* render_view_host) OVERRIDE; | 78 content::RenderViewHost* render_view_host) OVERRIDE; |
79 virtual void DidFailLoad( | 79 virtual void DidFailLoad( |
80 int64 frame_id, | 80 int64 frame_num, |
81 const GURL& validated_url, | 81 const GURL& validated_url, |
82 bool is_main_frame, | 82 bool is_main_frame, |
83 int error_code, | 83 int error_code, |
84 const string16& error_description, | 84 const string16& error_description, |
85 content::RenderViewHost* render_view_host) OVERRIDE; | 85 content::RenderViewHost* render_view_host) OVERRIDE; |
86 virtual void DidOpenRequestedURL(content::WebContents* new_contents, | 86 virtual void DidOpenRequestedURL(content::WebContents* new_contents, |
87 const GURL& url, | 87 const GURL& url, |
88 const content::Referrer& referrer, | 88 const content::Referrer& referrer, |
89 WindowOpenDisposition disposition, | 89 WindowOpenDisposition disposition, |
90 content::PageTransition transition, | 90 content::PageTransition transition, |
91 int64 source_frame_id) OVERRIDE; | 91 int64 source_frame_num) OVERRIDE; |
92 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; | 92 virtual void WebContentsDestroyed(content::WebContents* tab) OVERRIDE; |
93 | 93 |
94 private: | 94 private: |
95 // True if the transition and target url correspond to a reference fragment | 95 // True if the transition and target url correspond to a reference fragment |
96 // navigation. | 96 // navigation. |
97 bool IsReferenceFragmentNavigation(int64 frame_id, const GURL& url); | 97 bool IsReferenceFragmentNavigation(FrameNavigationState::FrameID frame_id, |
| 98 const GURL& url); |
98 | 99 |
99 // Tracks the state of the frames we are sending events for. | 100 // Tracks the state of the frames we are sending events for. |
100 FrameNavigationState navigation_state_; | 101 FrameNavigationState navigation_state_; |
101 | 102 |
102 // Used for tracking registrations to redirect notifications. | 103 // Used for tracking registrations to redirect notifications. |
103 content::NotificationRegistrar registrar_; | 104 content::NotificationRegistrar registrar_; |
104 | 105 |
105 content::RenderViewHost* render_view_host_; | 106 content::RenderViewHost* render_view_host_; |
106 content::RenderViewHost* pending_render_view_host_; | 107 content::RenderViewHost* pending_render_view_host_; |
107 | 108 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 // API function that returns the states of all frames in a given tab. | 191 // API function that returns the states of all frames in a given tab. |
191 class GetAllFramesFunction : public SyncExtensionFunction { | 192 class GetAllFramesFunction : public SyncExtensionFunction { |
192 virtual ~GetAllFramesFunction() {} | 193 virtual ~GetAllFramesFunction() {} |
193 virtual bool RunImpl() OVERRIDE; | 194 virtual bool RunImpl() OVERRIDE; |
194 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames") | 195 DECLARE_EXTENSION_FUNCTION_NAME("webNavigation.getAllFrames") |
195 }; | 196 }; |
196 | 197 |
197 } // namespace extensions | 198 } // namespace extensions |
198 | 199 |
199 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ | 200 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ |
OLD | NEW |