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

Side by Side Diff: components/browser_context_keyed_service/browser_context_dependency_manager.h

Issue 23068005: Convert UserPolicySigninService to use OAuth2TokenService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with ToT Created 7 years, 4 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 | Annotate | Revision Log
OLDNEW
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 COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_ 5 #ifndef COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_
6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_ 6 #define COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_MANA GER_H_
7 7
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "components/browser_context_keyed_service/browser_context_keyed_service _export.h" 9 #include "components/browser_context_keyed_service/browser_context_keyed_service _export.h"
10 #include "components/browser_context_keyed_service/dependency_graph.h" 10 #include "components/browser_context_keyed_service/dependency_graph.h"
(...skipping 16 matching lines...) Expand all
27 // Adds/Removes a component from our list of live components. Removing will 27 // Adds/Removes a component from our list of live components. Removing will
28 // also remove live dependency links. 28 // also remove live dependency links.
29 void AddComponent(BrowserContextKeyedBaseFactory* component); 29 void AddComponent(BrowserContextKeyedBaseFactory* component);
30 void RemoveComponent(BrowserContextKeyedBaseFactory* component); 30 void RemoveComponent(BrowserContextKeyedBaseFactory* component);
31 31
32 // Adds a dependency between two factories. 32 // Adds a dependency between two factories.
33 void AddEdge(BrowserContextKeyedBaseFactory* depended, 33 void AddEdge(BrowserContextKeyedBaseFactory* depended,
34 BrowserContextKeyedBaseFactory* dependee); 34 BrowserContextKeyedBaseFactory* dependee);
35 35
36 // Called by each BrowserContext to alert us of its creation. Several services 36 // Called by each BrowserContext to alert us of its creation. Several services
37 // want to be started when a context is created. Testing configuration is also 37 // want to be started when a context is created. If you want your
38 // done at this time. (If you want your BrowserContextKeyedService to be 38 // BrowserContextKeyedService to be started with the BrowserContext, override
39 // started with the BrowserContext, override BrowserContextKeyedBaseFactory:: 39 // BrowserContextKeyedBaseFactory::ServiceIsCreatedWithBrowserContext() to
40 // ServiceIsCreatedWithBrowserContext() to return true.) 40 // return true. This method also registers any service-related preferences
41 void CreateBrowserContextServices(content::BrowserContext* context, 41 // for non-incognito profiles.
42 bool is_testing_context); 42 void CreateBrowserContextServices(content::BrowserContext* context);
43
44 // Similar to CreateBrowserContextServices(), except this is used for creating
45 // test BrowserContexts - these contexts will not create services for any
46 // BrowserContextKeyedBaseFactories that return true from
47 // ServiceIsNULLWhileTesting(). Callers can pass |force_register_prefs| as
48 // true to have preferences registered even for incognito profiles - this
49 // allows tests to specify a standalone incognito profile without an
50 // associated normal profile.
51 void CreateBrowserContextServicesForTest(content::BrowserContext* context,
52 bool force_register_prefs);
43 53
44 // Called by each BrowserContext to alert us that we should destroy services 54 // Called by each BrowserContext to alert us that we should destroy services
45 // associated with it. 55 // associated with it.
46 void DestroyBrowserContextServices(content::BrowserContext* context); 56 void DestroyBrowserContextServices(content::BrowserContext* context);
47 57
48 #ifndef NDEBUG 58 #ifndef NDEBUG
49 // Debugging assertion called as part of GetServiceForBrowserContext in debug 59 // Debugging assertion called as part of GetServiceForBrowserContext in debug
50 // mode. This will NOTREACHED() whenever the user is trying to access a stale 60 // mode. This will NOTREACHED() whenever the user is trying to access a stale
51 // BrowserContext*. 61 // BrowserContext*.
52 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context); 62 void AssertBrowserContextWasntDestroyed(content::BrowserContext* context);
53 #endif 63 #endif
54 64
55 static BrowserContextDependencyManager* GetInstance(); 65 static BrowserContextDependencyManager* GetInstance();
56 66
57 private: 67 private:
58 friend class BrowserContextDependencyManagerUnittests; 68 friend class BrowserContextDependencyManagerUnittests;
59 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>; 69 friend struct DefaultSingletonTraits<BrowserContextDependencyManager>;
60 70
71 // Helper function used by CreateBrowserContextServices[ForTest].
72 void DoCreateBrowserContextServices(content::BrowserContext* context,
73 bool is_testing_context,
74 bool force_register_prefs);
75
61 BrowserContextDependencyManager(); 76 BrowserContextDependencyManager();
62 virtual ~BrowserContextDependencyManager(); 77 virtual ~BrowserContextDependencyManager();
63 78
64 #ifndef NDEBUG 79 #ifndef NDEBUG
65 void DumpBrowserContextDependencies(content::BrowserContext* context); 80 void DumpBrowserContextDependencies(content::BrowserContext* context);
66 #endif 81 #endif
67 82
68 DependencyGraph dependency_graph_; 83 DependencyGraph dependency_graph_;
69 84
70 #ifndef NDEBUG 85 #ifndef NDEBUG
71 // A list of context objects that have gone through the Shutdown() 86 // A list of context objects that have gone through the Shutdown()
72 // phase. These pointers are most likely invalid, but we keep track of their 87 // phase. These pointers are most likely invalid, but we keep track of their
73 // locations in memory so we can nicely assert if we're asked to do anything 88 // locations in memory so we can nicely assert if we're asked to do anything
74 // with them. 89 // with them.
75 std::set<content::BrowserContext*> dead_context_pointers_; 90 std::set<content::BrowserContext*> dead_context_pointers_;
76 #endif 91 #endif
77 }; 92 };
78 93
79 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_ 94 #endif // COMPONENTS_BROWSER_CONTEXT_KEYED_SERVICE_BROWSER_CONTEXT_DEPENDENCY_M ANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698