Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 class Profile; | 10 class Profile; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 47 // MyServiceFactory::MyServiceFactory() | 47 // MyServiceFactory::MyServiceFactory() |
| 48 // : ProfileKeyedServiceFactory( | 48 // : ProfileKeyedServiceFactory( |
| 49 // ProfileDependencyManager::GetInstance()) | 49 // ProfileDependencyManager::GetInstance()) |
| 50 // {} | 50 // {} |
| 51 explicit ProfileKeyedServiceFactory(ProfileDependencyManager* manager); | 51 explicit ProfileKeyedServiceFactory(ProfileDependencyManager* manager); |
| 52 virtual ~ProfileKeyedServiceFactory(); | 52 virtual ~ProfileKeyedServiceFactory(); |
| 53 | 53 |
| 54 // Common implementation that maps |profile| to some service object. Deals | 54 // Common implementation that maps |profile| to some service object. Deals |
| 55 // with incognito profiles per subclass instructions with | 55 // with incognito profiles per subclass instructions with |
| 56 // ServiceActiveInIncognito(). | 56 // ServiceActiveInIncognito(). |
| 57 ProfileKeyedService* GetServiceForProfile(Profile* profile); | 57 ProfileKeyedService* GetServiceForProfile(Profile* profile, bool create); |
|
Miranda Callahan
2011/04/19 17:04:20
add comment saying what the |create| parameter doe
Torne
2011/04/19 17:15:13
Done.
| |
| 58 | 58 |
| 59 // The main public interface for declaring dependencies between services | 59 // The main public interface for declaring dependencies between services |
| 60 // created by factories. | 60 // created by factories. |
| 61 void DependsOn(ProfileKeyedServiceFactory* rhs); | 61 void DependsOn(ProfileKeyedServiceFactory* rhs); |
| 62 | 62 |
| 63 // Maps |profile| to |provider| with debug checks to prevent duplication. | 63 // Maps |profile| to |provider| with debug checks to prevent duplication. |
| 64 void Associate(Profile* profile, ProfileKeyedService* service); | 64 void Associate(Profile* profile, ProfileKeyedService* service); |
| 65 | 65 |
| 66 // Returns a new instance of the service, casted to void* for our common | 66 // Returns a new instance of the service, casted to void* for our common |
| 67 // storage. | 67 // storage. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 // Which ProfileDependencyManager we should communicate with. In real code, | 99 // Which ProfileDependencyManager we should communicate with. In real code, |
| 100 // this will always be ProfileDependencyManager::GetInstance(), but unit | 100 // this will always be ProfileDependencyManager::GetInstance(), but unit |
| 101 // tests will want to use their own copy. | 101 // tests will want to use their own copy. |
| 102 ProfileDependencyManager* dependency_manager_; | 102 ProfileDependencyManager* dependency_manager_; |
| 103 | 103 |
| 104 // A mock factory function to use to create the service, used by tests. | 104 // A mock factory function to use to create the service, used by tests. |
| 105 FactoryFunction factory_; | 105 FactoryFunction factory_; |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ | 108 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_SERVICE_FACTORY_H_ |
| OLD | NEW |