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

Side by Side Diff: components/keyed_service/content/refcounted_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, 1 month 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_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_ 5 #ifndef COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_
6 #define COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_ 6 #define COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SERVIC E_FACTORY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // KeyedService. Since the factory will be used immediately, it may not be 48 // KeyedService. Since the factory will be used immediately, it may not be
49 // NULL. 49 // NULL.
50 scoped_refptr<RefcountedKeyedService> SetTestingFactoryAndUse( 50 scoped_refptr<RefcountedKeyedService> SetTestingFactoryAndUse(
51 content::BrowserContext* context, 51 content::BrowserContext* context,
52 TestingFactoryFunction factory); 52 TestingFactoryFunction factory);
53 53
54 protected: 54 protected:
55 RefcountedBrowserContextKeyedServiceFactory( 55 RefcountedBrowserContextKeyedServiceFactory(
56 const char* name, 56 const char* name,
57 BrowserContextDependencyManager* manager); 57 BrowserContextDependencyManager* manager);
58 virtual ~RefcountedBrowserContextKeyedServiceFactory(); 58 ~RefcountedBrowserContextKeyedServiceFactory() override;
59 59
60 scoped_refptr<RefcountedKeyedService> GetServiceForBrowserContext( 60 scoped_refptr<RefcountedKeyedService> GetServiceForBrowserContext(
61 content::BrowserContext* context, 61 content::BrowserContext* context,
62 bool create); 62 bool create);
63 63
64 // Maps |context| to |service| with debug checks to prevent duplication. 64 // Maps |context| to |service| with debug checks to prevent duplication.
65 void Associate(content::BrowserContext* context, 65 void Associate(content::BrowserContext* context,
66 const scoped_refptr<RefcountedKeyedService>& service); 66 const scoped_refptr<RefcountedKeyedService>& service);
67 67
68 // All subclasses of RefcountedBrowserContextKeyedServiceFactory must return 68 // All subclasses of RefcountedBrowserContextKeyedServiceFactory must return
69 // a RefcountedKeyedService instead of just 69 // a RefcountedKeyedService instead of just
70 // a BrowserContextKeyedBase. 70 // a BrowserContextKeyedBase.
71 virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor( 71 virtual scoped_refptr<RefcountedKeyedService> BuildServiceInstanceFor(
72 content::BrowserContext* context) const = 0; 72 content::BrowserContext* context) const = 0;
73 73
74 virtual void BrowserContextShutdown(content::BrowserContext* context) 74 void BrowserContextShutdown(content::BrowserContext* context) override;
75 override; 75 void BrowserContextDestroyed(content::BrowserContext* context) override;
76 virtual void BrowserContextDestroyed(content::BrowserContext* context) 76 void SetEmptyTestingFactory(content::BrowserContext* context) override;
77 override; 77 bool HasTestingFactory(content::BrowserContext* context) override;
78 virtual void SetEmptyTestingFactory(content::BrowserContext* context) 78 void CreateServiceNow(content::BrowserContext* context) override;
79 override;
80 virtual bool HasTestingFactory(content::BrowserContext* context) override;
81 virtual void CreateServiceNow(content::BrowserContext* context) override;
82 79
83 private: 80 private:
84 typedef std::map<content::BrowserContext*, 81 typedef std::map<content::BrowserContext*,
85 scoped_refptr<RefcountedKeyedService>> RefCountedStorage; 82 scoped_refptr<RefcountedKeyedService>> RefCountedStorage;
86 typedef std::map<content::BrowserContext*, TestingFactoryFunction> 83 typedef std::map<content::BrowserContext*, TestingFactoryFunction>
87 BrowserContextOverriddenTestingFunctions; 84 BrowserContextOverriddenTestingFunctions;
88 85
89 // The mapping between a BrowserContext and its refcounted service. 86 // The mapping between a BrowserContext and its refcounted service.
90 RefCountedStorage mapping_; 87 RefCountedStorage mapping_;
91 88
92 // The mapping between a BrowserContext and its overridden 89 // The mapping between a BrowserContext and its overridden
93 // TestingFactoryFunction. 90 // TestingFactoryFunction.
94 BrowserContextOverriddenTestingFunctions testing_factories_; 91 BrowserContextOverriddenTestingFunctions testing_factories_;
95 92
96 DISALLOW_COPY_AND_ASSIGN(RefcountedBrowserContextKeyedServiceFactory); 93 DISALLOW_COPY_AND_ASSIGN(RefcountedBrowserContextKeyedServiceFactory);
97 }; 94 };
98 95
99 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SER VICE_FACTORY_H_ 96 #endif // COMPONENTS_KEYED_SERVICE_CONTENT_REFCOUNTED_BROWSER_CONTEXT_KEYED_SER VICE_FACTORY_H_
OLDNEW
« no previous file with comments | « components/keyed_service/content/browser_context_keyed_service_factory.h ('k') | components/metrics/daily_event_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698