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

Side by Side Diff: chrome/browser/policy/schema_registry_service_factory.cc

Issue 349643002: Decoupled the SchemaRegistryService from SchemaRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 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
« no previous file with comments | « chrome/browser/policy/schema_registry_service.cc ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "chrome/browser/policy/schema_registry_service_factory.h" 5 #include "chrome/browser/policy/schema_registry_service_factory.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/policy/schema_registry_service.h" 8 #include "chrome/browser/policy/schema_registry_service.h"
9 #include "components/keyed_service/content/browser_context_dependency_manager.h" 9 #include "components/keyed_service/content/browser_context_dependency_manager.h"
10 #include "components/policy/core/common/schema.h" 10 #include "components/policy/core/common/schema.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 return it->second; 53 return it->second;
54 } 54 }
55 55
56 scoped_ptr<SchemaRegistryService> 56 scoped_ptr<SchemaRegistryService>
57 SchemaRegistryServiceFactory::CreateForContextInternal( 57 SchemaRegistryServiceFactory::CreateForContextInternal(
58 content::BrowserContext* context, 58 content::BrowserContext* context,
59 const Schema& chrome_schema, 59 const Schema& chrome_schema,
60 CombinedSchemaRegistry* global_registry) { 60 CombinedSchemaRegistry* global_registry) {
61 DCHECK(!context->IsOffTheRecord()); 61 DCHECK(!context->IsOffTheRecord());
62 DCHECK(registries_.find(context) == registries_.end()); 62 DCHECK(registries_.find(context) == registries_.end());
63 SchemaRegistryService* registry = 63 scoped_ptr<SchemaRegistry> registry(new SchemaRegistry);
64 new SchemaRegistryService(chrome_schema, global_registry); 64 scoped_ptr<SchemaRegistryService> service(new SchemaRegistryService(
65 registries_[context] = registry; 65 registry.Pass(), chrome_schema, global_registry));
66 return make_scoped_ptr(registry); 66 registries_[context] = service.get();
67 return service.Pass();
67 } 68 }
68 69
69 void SchemaRegistryServiceFactory::BrowserContextShutdown( 70 void SchemaRegistryServiceFactory::BrowserContextShutdown(
70 content::BrowserContext* context) { 71 content::BrowserContext* context) {
71 if (context->IsOffTheRecord()) 72 if (context->IsOffTheRecord())
72 return; 73 return;
73 RegistryMap::iterator it = registries_.find(context); 74 RegistryMap::iterator it = registries_.find(context);
74 if (it != registries_.end()) 75 if (it != registries_.end())
75 it->second->Shutdown(); 76 it->second->Shutdown();
76 else 77 else
77 NOTREACHED(); 78 NOTREACHED();
78 } 79 }
79 80
80 void SchemaRegistryServiceFactory::BrowserContextDestroyed( 81 void SchemaRegistryServiceFactory::BrowserContextDestroyed(
81 content::BrowserContext* context) { 82 content::BrowserContext* context) {
82 registries_.erase(context); 83 registries_.erase(context);
83 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); 84 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context);
84 } 85 }
85 86
86 void SchemaRegistryServiceFactory::SetEmptyTestingFactory( 87 void SchemaRegistryServiceFactory::SetEmptyTestingFactory(
87 content::BrowserContext* context) {} 88 content::BrowserContext* context) {}
88 89
89 void SchemaRegistryServiceFactory::CreateServiceNow( 90 void SchemaRegistryServiceFactory::CreateServiceNow(
90 content::BrowserContext* context) {} 91 content::BrowserContext* context) {}
91 92
92 } // namespace policy 93 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/schema_registry_service.cc ('k') | chrome/browser/ui/webui/policy_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698