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

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

Issue 2739453004: Fix crash during sync load of the signin profile (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « chrome/browser/policy/profile_policy_connector_factory.cc ('k') | no next file » | 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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "chrome/browser/policy/schema_registry_service.h" 11 #include "chrome/browser/policy/schema_registry_service.h"
12 #include "components/keyed_service/content/browser_context_dependency_manager.h" 12 #include "components/keyed_service/content/browser_context_dependency_manager.h"
13 #include "components/policy/core/common/schema.h" 13 #include "components/policy/core/common/schema.h"
14 #include "components/policy/core/common/schema_registry.h" 14 #include "components/policy/core/common/schema_registry.h"
15 #include "content/public/browser/browser_context.h" 15 #include "content/public/browser/browser_context.h"
16 16
17 #if defined(OS_CHROMEOS) 17 #if defined(OS_CHROMEOS)
18 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
19 #include "chrome/browser/browser_process_platform_part_chromeos.h" 19 #include "chrome/browser/browser_process_platform_part_chromeos.h"
20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
21 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
21 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h" 22 #include "chrome/browser/chromeos/policy/device_local_account_policy_service.h"
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" 23 #include "chrome/browser/chromeos/profiles/profile_helper.h"
23 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
24 #include "components/user_manager/user.h" 25 #include "components/user_manager/user.h"
25 #include "components/user_manager/user_manager.h" 26 #include "components/user_manager/user_manager.h"
26 #endif 27 #endif
27 28
28 namespace policy { 29 namespace policy {
29 30
30 #if defined(OS_CHROMEOS) 31 #if defined(OS_CHROMEOS)
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // DeviceLocalAccountPolicyBroker, which uses the registry to fetch and 117 // DeviceLocalAccountPolicyBroker, which uses the registry to fetch and
117 // cache policy even if there is no active session for that account. 118 // cache policy even if there is no active session for that account.
118 // Use a ForwardingSchemaRegistry that wraps this SchemaRegistry. 119 // Use a ForwardingSchemaRegistry that wraps this SchemaRegistry.
119 registry.reset(new ForwardingSchemaRegistry(broker->schema_registry())); 120 registry.reset(new ForwardingSchemaRegistry(broker->schema_registry()));
120 } 121 }
121 #endif 122 #endif
122 123
123 if (!registry) 124 if (!registry)
124 registry.reset(new SchemaRegistry); 125 registry.reset(new SchemaRegistry);
125 126
127 #if defined(OS_CHROMEOS)
128 Profile* const profile = Profile::FromBrowserContext(context);
129 if (chromeos::ProfileHelper::IsSigninProfile(profile)) {
130 // Pass the SchemaRegistry of the signin profile to device cloud policy
131 // manager, for being used for fetching the component policies.
132 policy::DeviceCloudPolicyManagerChromeOS* device_cloud_policy_manager =
133 g_browser_process->platform_part()
134 ->browser_policy_connector_chromeos()
135 ->GetDeviceCloudPolicyManager();
136 // TODO(tnagel): Do we need to do something for Active Directory management?
137 if (device_cloud_policy_manager) {
138 device_cloud_policy_manager->SetSigninProfileSchemaRegistry(
139 registry.get());
140 }
141 }
142 #endif
143
126 std::unique_ptr<SchemaRegistryService> service(new SchemaRegistryService( 144 std::unique_ptr<SchemaRegistryService> service(new SchemaRegistryService(
127 std::move(registry), chrome_schema, global_registry)); 145 std::move(registry), chrome_schema, global_registry));
128 registries_[context] = service.get(); 146 registries_[context] = service.get();
129 return service; 147 return service;
130 } 148 }
131 149
132 void SchemaRegistryServiceFactory::BrowserContextShutdown( 150 void SchemaRegistryServiceFactory::BrowserContextShutdown(
133 content::BrowserContext* context) { 151 content::BrowserContext* context) {
134 if (context->IsOffTheRecord()) 152 if (context->IsOffTheRecord())
135 return; 153 return;
(...skipping 15 matching lines...) Expand all
151 169
152 bool SchemaRegistryServiceFactory::HasTestingFactory( 170 bool SchemaRegistryServiceFactory::HasTestingFactory(
153 content::BrowserContext* context) { 171 content::BrowserContext* context) {
154 return false; 172 return false;
155 } 173 }
156 174
157 void SchemaRegistryServiceFactory::CreateServiceNow( 175 void SchemaRegistryServiceFactory::CreateServiceNow(
158 content::BrowserContext* context) {} 176 content::BrowserContext* context) {}
159 177
160 } // namespace policy 178 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/profile_policy_connector_factory.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698