1// Copyright (c) 2010 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_SERVICE_SERVICE_PROCESS_CONTROL_MANAGER_H_
6#define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_MANAGER_H_
7
8#include <vector>
9
10class Profile;
11class ServiceProcessControl;
12
13// ServiceProcessControlManager is a registrar for all ServiceProcess created
14// in the browser process. It is also a factory for creating new
15// ServiceProcess.
16class ServiceProcessControlManager {
17 public:
18  typedef std::vector<ServiceProcessControl*> ServiceProcessControlList;
19
20  ServiceProcessControlManager();
21  ~ServiceProcessControlManager();
22
23  // Get the ServiceProcess instance corresponding to |profile| and |type|.
24  // If such an instance doesn't exist a new instance is created.
25  //
26  // There will be at most one ServiceProcess for a |profile|.
27  //
28  // This method should only be accessed on the UI thread.
29  ServiceProcessControl* GetProcessControl(Profile* profile);
30
31  // Destroy all ServiceProcess objects created.
32  void Shutdown();
33
34  // Return the instance of ServiceProcessControlManager.
35  static ServiceProcessControlManager* GetInstance();
36
37 private:
38  ServiceProcessControlList process_control_list_;
39};
40
41#endif  // CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_MANAGER_H_
42