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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 DECLARE_EXTENSION_FUNCTION("webNavigation.getAllFrames", | 217 DECLARE_EXTENSION_FUNCTION("webNavigation.getAllFrames", |
218 WEBNAVIGATION_GETALLFRAMES) | 218 WEBNAVIGATION_GETALLFRAMES) |
219 }; | 219 }; |
220 | 220 |
221 class WebNavigationAPI : public ProfileKeyedAPI, | 221 class WebNavigationAPI : public ProfileKeyedAPI, |
222 public extensions::EventRouter::Observer { | 222 public extensions::EventRouter::Observer { |
223 public: | 223 public: |
224 explicit WebNavigationAPI(Profile* profile); | 224 explicit WebNavigationAPI(Profile* profile); |
225 virtual ~WebNavigationAPI(); | 225 virtual ~WebNavigationAPI(); |
226 | 226 |
227 // ProfileKeyedService implementation. | 227 // BrowserContextKeyedService implementation. |
228 virtual void Shutdown() OVERRIDE; | 228 virtual void Shutdown() OVERRIDE; |
229 | 229 |
230 // ProfileKeyedAPI implementation. | 230 // ProfileKeyedAPI implementation. |
231 static ProfileKeyedAPIFactory<WebNavigationAPI>* GetFactoryInstance(); | 231 static ProfileKeyedAPIFactory<WebNavigationAPI>* GetFactoryInstance(); |
232 | 232 |
233 // EventRouter::Observer implementation. | 233 // EventRouter::Observer implementation. |
234 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) | 234 virtual void OnListenerAdded(const extensions::EventListenerInfo& details) |
235 OVERRIDE; | 235 OVERRIDE; |
236 | 236 |
237 private: | 237 private: |
238 friend class ProfileKeyedAPIFactory<WebNavigationAPI>; | 238 friend class ProfileKeyedAPIFactory<WebNavigationAPI>; |
239 | 239 |
240 Profile* profile_; | 240 Profile* profile_; |
241 | 241 |
242 // ProfileKeyedAPI implementation. | 242 // ProfileKeyedAPI implementation. |
243 static const char* service_name() { | 243 static const char* service_name() { |
244 return "WebNavigationAPI"; | 244 return "WebNavigationAPI"; |
245 } | 245 } |
246 static const bool kServiceIsNULLWhileTesting = true; | 246 static const bool kServiceIsNULLWhileTesting = true; |
247 | 247 |
248 // Created lazily upon OnListenerAdded. | 248 // Created lazily upon OnListenerAdded. |
249 scoped_ptr<WebNavigationEventRouter> web_navigation_event_router_; | 249 scoped_ptr<WebNavigationEventRouter> web_navigation_event_router_; |
250 | 250 |
251 DISALLOW_COPY_AND_ASSIGN(WebNavigationAPI); | 251 DISALLOW_COPY_AND_ASSIGN(WebNavigationAPI); |
252 }; | 252 }; |
253 | 253 |
254 } // namespace extensions | 254 } // namespace extensions |
255 | 255 |
256 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ | 256 #endif // CHROME_BROWSER_EXTENSIONS_API_WEB_NAVIGATION_WEB_NAVIGATION_API_H_ |
OLD | NEW |