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