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

Side by Side Diff: components/keyed_service/content/browser_context_keyed_service_factory.h

Issue 1918083002: Convert //components/[f-n]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: … Created 4 years, 8 months 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H _ 5 #ifndef COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H _
6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H _ 6 #define COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTORY_H _
7 7
8 #include <memory>
9
8 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
9 #include "base/macros.h" 11 #include "base/macros.h"
10 #include "components/keyed_service/core/keyed_service_export.h" 12 #include "components/keyed_service/core/keyed_service_export.h"
11 #include "components/keyed_service/core/keyed_service_factory.h" 13 #include "components/keyed_service/core/keyed_service_factory.h"
12 14
13 class BrowserContextDependencyManager; 15 class BrowserContextDependencyManager;
14 class KeyedService; 16 class KeyedService;
15 17
16 namespace content { 18 namespace content {
17 class BrowserContext; 19 class BrowserContext;
(...skipping 15 matching lines...) Expand all
33 // attached to a single |context|. Only test code is allowed to call this 35 // attached to a single |context|. Only test code is allowed to call this
34 // method. 36 // method.
35 // TODO(gab): This method can be removed entirely when 37 // TODO(gab): This method can be removed entirely when
36 // PrefService::DeprecatedGetPrefRegistry() is phased out. 38 // PrefService::DeprecatedGetPrefRegistry() is phased out.
37 void RegisterUserPrefsOnBrowserContextForTest( 39 void RegisterUserPrefsOnBrowserContextForTest(
38 content::BrowserContext* context); 40 content::BrowserContext* context);
39 41
40 // A function that supplies the instance of a KeyedService for a given 42 // A function that supplies the instance of a KeyedService for a given
41 // BrowserContext. This is used primarily for testing, where we want to feed 43 // BrowserContext. This is used primarily for testing, where we want to feed
42 // a specific mock into the BCKSF system. 44 // a specific mock into the BCKSF system.
43 typedef scoped_ptr<KeyedService>(*TestingFactoryFunction)( 45 using TestingFactoryFunction =
44 content::BrowserContext* context); 46 std::unique_ptr<KeyedService> (*)(content::BrowserContext* context);
45 47
46 // Associates |factory| with |context| so that |factory| is used to create 48 // Associates |factory| with |context| so that |factory| is used to create
47 // the KeyedService when requested. |factory| can be NULL to signal that 49 // the KeyedService when requested. |factory| can be NULL to signal that
48 // KeyedService should be NULL. Multiple calls to SetTestingFactory() are 50 // KeyedService should be NULL. Multiple calls to SetTestingFactory() are
49 // allowed; previous services will be shut down. 51 // allowed; previous services will be shut down.
50 void SetTestingFactory(content::BrowserContext* context, 52 void SetTestingFactory(content::BrowserContext* context,
51 TestingFactoryFunction factory); 53 TestingFactoryFunction factory);
52 54
53 // Associates |factory| with |context| and immediately returns the created 55 // Associates |factory| with |context| and immediately returns the created
54 // KeyedService. Since the factory will be used immediately, it may not be 56 // KeyedService. Since the factory will be used immediately, it may not be
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 private: 125 private:
124 friend class BrowserContextDependencyManagerUnittests; 126 friend class BrowserContextDependencyManagerUnittests;
125 127
126 // Registers any user preferences on this service. This is called by 128 // Registers any user preferences on this service. This is called by
127 // RegisterPrefsIfNecessaryForContext() and should be overriden by any service 129 // RegisterPrefsIfNecessaryForContext() and should be overriden by any service
128 // that wants to register profile-specific preferences. 130 // that wants to register profile-specific preferences.
129 virtual void RegisterProfilePrefs( 131 virtual void RegisterProfilePrefs(
130 user_prefs::PrefRegistrySyncable* registry) {} 132 user_prefs::PrefRegistrySyncable* registry) {}
131 133
132 // KeyedServiceFactory: 134 // KeyedServiceFactory:
133 scoped_ptr<KeyedService> BuildServiceInstanceFor( 135 std::unique_ptr<KeyedService> BuildServiceInstanceFor(
134 base::SupportsUserData* context) const final; 136 base::SupportsUserData* context) const final;
135 bool IsOffTheRecord(base::SupportsUserData* context) const final; 137 bool IsOffTheRecord(base::SupportsUserData* context) const final;
136 138
137 // KeyedServiceBaseFactory: 139 // KeyedServiceBaseFactory:
138 base::SupportsUserData* GetContextToUse( 140 base::SupportsUserData* GetContextToUse(
139 base::SupportsUserData* context) const final; 141 base::SupportsUserData* context) const final;
140 bool ServiceIsCreatedWithContext() const final; 142 bool ServiceIsCreatedWithContext() const final;
141 void ContextShutdown(base::SupportsUserData* context) final; 143 void ContextShutdown(base::SupportsUserData* context) final;
142 void ContextDestroyed(base::SupportsUserData* context) final; 144 void ContextDestroyed(base::SupportsUserData* context) final;
143 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) final; 145 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) final;
144 146
145 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory); 147 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory);
146 }; 148 };
147 149
148 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTOR Y_H_ 150 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTOR Y_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698