OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/profile_policy_connector_factory.h" | 5 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "chrome/browser/policy/profile_policy_connector.h" | 9 #include "chrome/browser/policy/profile_policy_connector.h" |
10 #include "chrome/browser/profiles/incognito_helpers.h" | 10 #include "chrome/browser/profiles/incognito_helpers.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.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/policy_service.h" | 13 #include "components/policy/core/common/policy_service.h" |
14 | 14 |
15 #if defined(ENABLE_CONFIGURATION_POLICY) | 15 #if defined(ENABLE_CONFIGURATION_POLICY) |
16 #include "chrome/browser/policy/schema_registry_service.h" | 16 #include "chrome/browser/policy/schema_registry_service.h" |
17 #include "chrome/browser/policy/schema_registry_service_factory.h" | 17 #include "chrome/browser/policy/schema_registry_service_factory.h" |
18 #include "components/policy/core/common/policy_service_impl.h" | 18 #include "components/policy/core/common/policy_service_impl.h" |
19 #if defined(OS_CHROMEOS) | 19 #if defined(OS_CHROMEOS) |
20 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
21 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 21 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
22 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 22 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
23 #include "components/user_manager/user.h" | 23 #include "components/user_manager/user.h" |
24 #else | 24 #else |
25 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 25 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
26 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" | 26 #include "components/policy/core/common/cloud/user_cloud_policy_manager.h" |
27 #endif | 27 #endif |
28 #endif | 28 #endif |
29 | 29 |
| 30 #include "base/debug/stack_trace.h" |
| 31 |
30 namespace policy { | 32 namespace policy { |
31 | 33 |
32 // static | 34 // static |
33 ProfilePolicyConnectorFactory* ProfilePolicyConnectorFactory::GetInstance() { | 35 ProfilePolicyConnectorFactory* ProfilePolicyConnectorFactory::GetInstance() { |
34 return Singleton<ProfilePolicyConnectorFactory>::get(); | 36 return Singleton<ProfilePolicyConnectorFactory>::get(); |
35 } | 37 } |
36 | 38 |
37 // static | 39 // static |
38 ProfilePolicyConnector* ProfilePolicyConnectorFactory::GetForBrowserContext( | 40 ProfilePolicyConnector* ProfilePolicyConnectorFactory::GetForBrowserContext( |
39 content::BrowserContext* context) { | 41 content::BrowserContext* context) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 118 } |
117 user_cloud_policy_manager = | 119 user_cloud_policy_manager = |
118 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); | 120 UserCloudPolicyManagerFactoryChromeOS::GetForProfile(profile); |
119 #else | 121 #else |
120 user_cloud_policy_manager = | 122 user_cloud_policy_manager = |
121 UserCloudPolicyManagerFactory::GetForBrowserContext(context); | 123 UserCloudPolicyManagerFactory::GetForBrowserContext(context); |
122 #endif // defined(OS_CHROMEOS) | 124 #endif // defined(OS_CHROMEOS) |
123 #endif // defined(ENABLE_CONFIGURATION_POLICY) | 125 #endif // defined(ENABLE_CONFIGURATION_POLICY) |
124 | 126 |
125 scoped_ptr<ProfilePolicyConnector> connector(new ProfilePolicyConnector()); | 127 scoped_ptr<ProfilePolicyConnector> connector(new ProfilePolicyConnector()); |
| 128 // LOG(ERROR) << base::debug::StackTrace().ToString(); |
| 129 LOG(ERROR) << "context " << context << " connector " << connector << " mgr " <
< user_cloud_policy_manager; |
126 | 130 |
127 #if defined(ENABLE_CONFIGURATION_POLICY) | 131 #if defined(ENABLE_CONFIGURATION_POLICY) |
128 if (test_providers_.empty()) { | 132 if (test_providers_.empty()) { |
129 connector->Init(force_immediate_load, | 133 connector->Init(force_immediate_load, |
130 #if defined(OS_CHROMEOS) | 134 #if defined(OS_CHROMEOS) |
131 user, | 135 user, |
132 #endif | 136 #endif |
133 schema_registry, | 137 schema_registry, |
134 user_cloud_policy_manager); | 138 user_cloud_policy_manager); |
135 } else { | 139 } else { |
136 PolicyServiceImpl::Providers providers; | 140 PolicyServiceImpl::Providers providers; |
137 providers.push_back(test_providers_.front()); | 141 providers.push_back(test_providers_.front()); |
138 test_providers_.pop_front(); | 142 test_providers_.pop_front(); |
139 scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers)); | 143 scoped_ptr<PolicyService> service(new PolicyServiceImpl(providers)); |
140 connector->InitForTesting(service.Pass()); | 144 connector->InitForTesting(service.Pass(), user_cloud_policy_manager); |
141 } | 145 } |
142 #else | 146 #else |
143 connector->Init(false, NULL, NULL); | 147 connector->Init(false, NULL, NULL); |
144 #endif | 148 #endif |
145 | 149 |
146 connectors_[context] = connector.get(); | 150 connectors_[context] = connector.get(); |
147 return connector.Pass(); | 151 return connector.Pass(); |
148 } | 152 } |
149 | 153 |
150 void ProfilePolicyConnectorFactory::BrowserContextShutdown( | 154 void ProfilePolicyConnectorFactory::BrowserContextShutdown( |
(...skipping 18 matching lines...) Expand all Loading... |
169 | 173 |
170 bool ProfilePolicyConnectorFactory::HasTestingFactory( | 174 bool ProfilePolicyConnectorFactory::HasTestingFactory( |
171 content::BrowserContext* context) { | 175 content::BrowserContext* context) { |
172 return false; | 176 return false; |
173 } | 177 } |
174 | 178 |
175 void ProfilePolicyConnectorFactory::CreateServiceNow( | 179 void ProfilePolicyConnectorFactory::CreateServiceNow( |
176 content::BrowserContext* context) {} | 180 content::BrowserContext* context) {} |
177 | 181 |
178 } // namespace policy | 182 } // namespace policy |
OLD | NEW |