Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/browser/extensions/api/processes/processes_api_service.h

Issue 11359081: Lazy initialization for ProcessesEventRouter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 {
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
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__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698