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