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 #ifndef CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "chrome/browser/profiles/profile_keyed_base_factory.h" | 12 #include "chrome/browser/profiles/profile_keyed_base_factory.h" |
13 #include "chrome/browser/profiles/profile_keyed_service.h" | 13 #include "chrome/browser/profiles/profile_keyed_service.h" |
14 | 14 |
15 class Profile; | |
16 class ProfileDependencyManager; | 15 class ProfileDependencyManager; |
17 class ProfileKeyedService; | 16 class ProfileKeyedService; |
18 | 17 |
19 // Base class for Factories that take a Profile object and return some service | 18 // Base class for Factories that take a Profile object and return some service |
20 // on a one-to-one mapping. Each factory that derives from this class *must* | 19 // on a one-to-one mapping. Each factory that derives from this class *must* |
21 // be a Singleton (only unit tests don't do that). See ThemeServiceFactory as | 20 // be a Singleton (only unit tests don't do that). See ThemeServiceFactory as |
22 // an example of how to derive from this class. | 21 // an example of how to derive from this class. |
23 // | 22 // |
24 // We do this because services depend on each other and we need to control | 23 // We do this because services depend on each other and we need to control |
25 // shutdown/destruction order. In each derived classes' constructors, the | 24 // shutdown/destruction order. In each derived classes' constructors, the |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 // The mapping between a Profile and its service. | 106 // The mapping between a Profile and its service. |
108 std::map<content::BrowserContext*, ProfileKeyedService*> mapping_; | 107 std::map<content::BrowserContext*, ProfileKeyedService*> mapping_; |
109 | 108 |
110 // The mapping between a Profile and its overridden FactoryFunction. | 109 // The mapping between a Profile and its overridden FactoryFunction. |
111 std::map<content::BrowserContext*, FactoryFunction> factories_; | 110 std::map<content::BrowserContext*, FactoryFunction> factories_; |
112 | 111 |
113 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedServiceFactory); | 112 DISALLOW_COPY_AND_ASSIGN(ProfileKeyedServiceFactory); |
114 }; | 113 }; |
115 | 114 |
116 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ | 115 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ |
OLD | NEW |