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_BASE_FACTORY_H_ | 5 #ifndef CHROME_BROWSER_PROFILES_PROFILE_KEYED_BASE_FACTORY_H_ |
6 #define CHROME_BROWSER_PROFILES_PROFILE_KEYED_BASE_FACTORY_H_ | 6 #define CHROME_BROWSER_PROFILES_PROFILE_KEYED_BASE_FACTORY_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/threading/non_thread_safe.h" | 10 #include "base/threading/non_thread_safe.h" |
11 | 11 |
12 class PrefService; | 12 class PrefServiceSyncable; |
13 class Profile; | 13 class Profile; |
14 class ProfileDependencyManager; | 14 class ProfileDependencyManager; |
15 | 15 |
16 // Base class for Factories that take a Profile object and return some service. | 16 // Base class for Factories that take a Profile object and return some service. |
17 // | 17 // |
18 // Unless you're trying to make a new type of Factory, you probably don't want | 18 // Unless you're trying to make a new type of Factory, you probably don't want |
19 // this class, but its subclasses: ProfileKeyedServiceFactory and | 19 // this class, but its subclasses: ProfileKeyedServiceFactory and |
20 // RefcountedProfileKeyedServiceFactory. This object describes general | 20 // RefcountedProfileKeyedServiceFactory. This object describes general |
21 // dependency management between Factories; subclasses react to lifecycle | 21 // dependency management between Factories; subclasses react to lifecycle |
22 // events and implement memory management. | 22 // events and implement memory management. |
(...skipping 20 matching lines...) Expand all Loading... |
43 void DependsOn(ProfileKeyedBaseFactory* rhs); | 43 void DependsOn(ProfileKeyedBaseFactory* rhs); |
44 | 44 |
45 // Finds which profile (if any) to use using the Service.*Incognito methods. | 45 // Finds which profile (if any) to use using the Service.*Incognito methods. |
46 Profile* GetProfileToUse(Profile* profile); | 46 Profile* GetProfileToUse(Profile* profile); |
47 | 47 |
48 // Interface for people building a concrete FooServiceFactory: -------------- | 48 // Interface for people building a concrete FooServiceFactory: -------------- |
49 | 49 |
50 // Register any user preferences on this service. This is called during | 50 // Register any user preferences on this service. This is called during |
51 // CreateProfileService() since preferences are registered on a per Profile | 51 // CreateProfileService() since preferences are registered on a per Profile |
52 // basis. | 52 // basis. |
53 virtual void RegisterUserPrefs(PrefService* user_prefs) {} | 53 virtual void RegisterUserPrefs(PrefServiceSyncable* user_prefs) {} |
54 | 54 |
55 // By default, if we are asked for a service with an Incognito profile, we | 55 // By default, if we are asked for a service with an Incognito profile, we |
56 // pass back NULL. To redirect to the Incognito's original profile or to | 56 // pass back NULL. To redirect to the Incognito's original profile or to |
57 // create another instance, even for Incognito windows, override one of the | 57 // create another instance, even for Incognito windows, override one of the |
58 // following methods: | 58 // following methods: |
59 virtual bool ServiceRedirectedInIncognito() const; | 59 virtual bool ServiceRedirectedInIncognito() const; |
60 virtual bool ServiceHasOwnInstanceInIncognito() const; | 60 virtual bool ServiceHasOwnInstanceInIncognito() const; |
61 | 61 |
62 // By default, we create instances of a service lazily and wait until | 62 // By default, we create instances of a service lazily and wait until |
63 // GetForProfile() is called on our subclass. Some services need to be | 63 // GetForProfile() is called on our subclass. Some services need to be |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 #if !defined(NDEBUG) | 123 #if !defined(NDEBUG) |
124 // A static string passed in to our constructor. Should be unique across all | 124 // A static string passed in to our constructor. Should be unique across all |
125 // services. This is used only for debugging in debug mode. (We can print | 125 // services. This is used only for debugging in debug mode. (We can print |
126 // pretty graphs with GraphViz with this information.) | 126 // pretty graphs with GraphViz with this information.) |
127 const char* service_name_; | 127 const char* service_name_; |
128 #endif | 128 #endif |
129 }; | 129 }; |
130 | 130 |
131 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_BASE_FACTORY_H_ | 131 #endif // CHROME_BROWSER_PROFILES_PROFILE_KEYED_BASE_FACTORY_H_ |
OLD | NEW |