OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/extensions/event_router.h" |
| 12 #include "chrome/browser/profiles/profile_keyed_service.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 namespace extensions { |
| 17 class ProcessesEventRouter; |
| 18 |
| 19 // The profile-keyed service that manages the processes extension API. |
| 20 class ProcessesAPIService : public ProfileKeyedService, |
| 21 public EventRouter::Observer { |
| 22 public: |
| 23 explicit ProcessesAPIService(Profile* profile); |
| 24 virtual ~ProcessesAPIService(); |
| 25 |
| 26 // Convenience method to get the ProcessesAPIService for a profile. |
| 27 static ProcessesAPIService* Get(Profile* profile); |
| 28 |
| 29 ProcessesEventRouter* processes_event_router() { |
| 30 return processes_event_router_.get(); |
| 31 } |
| 32 |
| 33 // EventRouter::Observer implementation. |
| 34 virtual void OnListenerAdded(const std::string& event_name) OVERRIDE; |
| 35 virtual void OnListenerRemoved(const std::string& event_name) OVERRIDE; |
| 36 |
| 37 private: |
| 38 Profile* profile_; |
| 39 |
| 40 // Lazily initialized in OnListenerAdded. |
| 41 scoped_ptr<extensions::ProcessesEventRouter> processes_event_router_; |
| 42 }; |
| 43 |
| 44 } // namespace extensions |
| 45 |
| 46 #endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |
OLD | NEW |