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

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

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 // BrowserContextDependencyManager. For all non-test code, write your subclass 49 // BrowserContextDependencyManager. For all non-test code, write your subclass
50 // constructors like this: 50 // constructors like this:
51 // 51 //
52 // MyServiceFactory::MyServiceFactory() 52 // MyServiceFactory::MyServiceFactory()
53 // : BrowserContextKeyedServiceFactory( 53 // : BrowserContextKeyedServiceFactory(
54 // "MyService", 54 // "MyService",
55 // BrowserContextDependencyManager::GetInstance()) 55 // BrowserContextDependencyManager::GetInstance())
56 // {} 56 // {}
57 BrowserContextKeyedServiceFactory(const char* name, 57 BrowserContextKeyedServiceFactory(const char* name,
58 BrowserContextDependencyManager* manager); 58 BrowserContextDependencyManager* manager);
59 virtual ~BrowserContextKeyedServiceFactory(); 59 ~BrowserContextKeyedServiceFactory() override;
60 60
61 // Common implementation that maps |context| to some service object. Deals 61 // Common implementation that maps |context| to some service object. Deals
62 // with incognito contexts per subclass instructions with 62 // with incognito contexts per subclass instructions with
63 // GetBrowserContextRedirectedInIncognito() and 63 // GetBrowserContextRedirectedInIncognito() and
64 // GetBrowserContextOwnInstanceInIncognito() through the 64 // GetBrowserContextOwnInstanceInIncognito() through the
65 // GetBrowserContextToUse() method on the base. If |create| is true, the 65 // GetBrowserContextToUse() method on the base. If |create| is true, the
66 // service will be created using BuildServiceInstanceFor() if it doesn't 66 // service will be created using BuildServiceInstanceFor() if it doesn't
67 // already exist. 67 // already exist.
68 KeyedService* GetServiceForBrowserContext(content::BrowserContext* context, 68 KeyedService* GetServiceForBrowserContext(content::BrowserContext* context,
69 bool create); 69 bool create);
(...skipping 14 matching lines...) Expand all
84 // does a two pass shutdown. 84 // does a two pass shutdown.
85 // 85 //
86 // First, BrowserContextShutdown() is called on every ServiceFactory and will 86 // First, BrowserContextShutdown() is called on every ServiceFactory and will
87 // usually call KeyedService::Shutdown(), which gives each 87 // usually call KeyedService::Shutdown(), which gives each
88 // KeyedService a chance to remove dependencies on other 88 // KeyedService a chance to remove dependencies on other
89 // services that it may be holding. 89 // services that it may be holding.
90 // 90 //
91 // Secondly, BrowserContextDestroyed() is called on every ServiceFactory 91 // Secondly, BrowserContextDestroyed() is called on every ServiceFactory
92 // and the default implementation removes it from |mapping_| and deletes 92 // and the default implementation removes it from |mapping_| and deletes
93 // the pointer. 93 // the pointer.
94 virtual void BrowserContextShutdown(content::BrowserContext* context) 94 void BrowserContextShutdown(content::BrowserContext* context) override;
95 override; 95 void BrowserContextDestroyed(content::BrowserContext* context) override;
96 virtual void BrowserContextDestroyed(content::BrowserContext* context)
97 override;
98 96
99 virtual void SetEmptyTestingFactory(content::BrowserContext* context) 97 void SetEmptyTestingFactory(content::BrowserContext* context) override;
100 override; 98 bool HasTestingFactory(content::BrowserContext* context) override;
101 virtual bool HasTestingFactory(content::BrowserContext* context) override; 99 void CreateServiceNow(content::BrowserContext* context) override;
102 virtual void CreateServiceNow(content::BrowserContext* context) override;
103 100
104 private: 101 private:
105 friend class BrowserContextDependencyManager; 102 friend class BrowserContextDependencyManager;
106 friend class BrowserContextDependencyManagerUnittests; 103 friend class BrowserContextDependencyManagerUnittests;
107 104
108 typedef std::map<content::BrowserContext*, KeyedService*> 105 typedef std::map<content::BrowserContext*, KeyedService*>
109 BrowserContextKeyedServices; 106 BrowserContextKeyedServices;
110 typedef std::map<content::BrowserContext*, TestingFactoryFunction> 107 typedef std::map<content::BrowserContext*, TestingFactoryFunction>
111 BrowserContextOverriddenTestingFunctions; 108 BrowserContextOverriddenTestingFunctions;
112 109
113 // The mapping between a BrowserContext and its service. 110 // The mapping between a BrowserContext and its service.
114 BrowserContextKeyedServices mapping_; 111 BrowserContextKeyedServices mapping_;
115 112
116 // The mapping between a BrowserContext and its overridden 113 // The mapping between a BrowserContext and its overridden
117 // TestingFactoryFunction. 114 // TestingFactoryFunction.
118 BrowserContextOverriddenTestingFunctions testing_factories_; 115 BrowserContextOverriddenTestingFunctions testing_factories_;
119 116
120 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory); 117 DISALLOW_COPY_AND_ASSIGN(BrowserContextKeyedServiceFactory);
121 }; 118 };
122 119
123 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTOR Y_H_ 120 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_BROWSER_CONTEXT_KEYED_SERVICE_FACTOR Y_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698