Chromium Code Reviews| Index: chrome/browser/extensions/api/processes/processes_api_service.h |
| diff --git a/chrome/browser/extensions/api/processes/processes_api_service.h b/chrome/browser/extensions/api/processes/processes_api_service.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b7c593f57a562f3c7ed41d5d2b18a21f0bc03df0 |
| --- /dev/null |
| +++ b/chrome/browser/extensions/api/processes/processes_api_service.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |
| +#define CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |
| + |
| +#include <string> |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "chrome/browser/extensions/event_router.h" |
| +#include "chrome/browser/profiles/profile_keyed_service.h" |
| + |
| +class Profile; |
| + |
| +namespace extensions { |
|
Aaron Boodman
2012/11/07 04:08:20
Nit: In the end, I don't think we want these in th
Yoyo Zhou
2012/11/07 22:53:36
Should they be in a namespace like processes_api?
Aaron Boodman
2012/11/07 23:51:28
I think it depends on whether they end up being th
|
| +class ProcessesEventRouter; |
| + |
| +// The profile-keyed service that manages the processes extension API. |
| +class ProcessesAPIService : public ProfileKeyedService, |
| + public EventRouter::Observer { |
| + public: |
| + explicit ProcessesAPIService(Profile* profile); |
| + virtual ~ProcessesAPIService(); |
| + |
| + // Convenience method to get the ProcessesAPIService for a profile. |
| + static ProcessesAPIService* Get(Profile* profile); |
| + |
| + ProcessesEventRouter* processes_event_router() { |
| + return processes_event_router_.get(); |
| + } |
| + |
| + // EventRouter::Observer implementation. |
| + virtual void OnListenerAdded(const std::string& event_name) OVERRIDE; |
| + virtual void OnListenerRemoved(const std::string& event_name) OVERRIDE; |
| + |
| + private: |
| + Profile* profile_; |
| + |
| + // Lazily initialized in OnListenerAdded. |
| + scoped_ptr<extensions::ProcessesEventRouter> processes_event_router_; |
| +}; |
| + |
| +} // namespace extensions |
| + |
| +#endif // CHROME_BROWSER_EXTENSIONS_API_PROCESSES_PROCESSES_API_SERVICE_H__ |