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/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom eos.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "chrome/browser/browser_process.h" | 11 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/chromeos/login/user.h" | 12 #include "chrome/browser/chromeos/login/user.h" |
13 #include "chrome/browser/chromeos/login/user_manager.h" | 13 #include "chrome/browser/chromeos/login/user_manager.h" |
14 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 14 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
15 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" | 15 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
16 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 16 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
17 #include "chrome/browser/invalidation/invalidation_service_factory.h" | |
17 #include "chrome/browser/policy/browser_policy_connector.h" | 18 #include "chrome/browser/policy/browser_policy_connector.h" |
18 #include "chrome/browser/policy/cloud/device_management_service.h" | 19 #include "chrome/browser/policy/cloud/device_management_service.h" |
19 #include "chrome/browser/policy/cloud/resource_cache.h" | 20 #include "chrome/browser/policy/cloud/resource_cache.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
22 #include "chromeos/chromeos_paths.h" | 23 #include "chromeos/chromeos_paths.h" |
23 #include "chromeos/chromeos_switches.h" | 24 #include "chromeos/chromeos_switches.h" |
24 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
25 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" | 26 #include "components/browser_context_keyed_service/browser_context_dependency_ma nager.h" |
26 #include "net/url_request/url_request_context_getter.h" | 27 #include "net/url_request/url_request_context_getter.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 scoped_ptr<UserCloudPolicyManagerChromeOS> | 62 scoped_ptr<UserCloudPolicyManagerChromeOS> |
62 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( | 63 UserCloudPolicyManagerFactoryChromeOS::CreateForProfile( |
63 Profile* profile, | 64 Profile* profile, |
64 bool force_immediate_load) { | 65 bool force_immediate_load) { |
65 return GetInstance()->CreateManagerForProfile(profile, force_immediate_load); | 66 return GetInstance()->CreateManagerForProfile(profile, force_immediate_load); |
66 } | 67 } |
67 | 68 |
68 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() | 69 UserCloudPolicyManagerFactoryChromeOS::UserCloudPolicyManagerFactoryChromeOS() |
69 : BrowserContextKeyedBaseFactory( | 70 : BrowserContextKeyedBaseFactory( |
70 "UserCloudPolicyManagerChromeOS", | 71 "UserCloudPolicyManagerChromeOS", |
71 BrowserContextDependencyManager::GetInstance()) {} | 72 BrowserContextDependencyManager::GetInstance()) { |
73 DependsOn(invalidation::InvalidationServiceFactory::GetInstance()); | |
Joao da Silva
2013/07/24 15:34:07
I just realized that we can't do this.
Basically
Steve Condie
2013/07/25 01:18:08
Done.
| |
74 } | |
72 | 75 |
73 UserCloudPolicyManagerFactoryChromeOS:: | 76 UserCloudPolicyManagerFactoryChromeOS:: |
74 ~UserCloudPolicyManagerFactoryChromeOS() {} | 77 ~UserCloudPolicyManagerFactoryChromeOS() {} |
75 | 78 |
76 UserCloudPolicyManagerChromeOS* | 79 UserCloudPolicyManagerChromeOS* |
77 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( | 80 UserCloudPolicyManagerFactoryChromeOS::GetManagerForProfile( |
78 Profile* profile) { | 81 Profile* profile) { |
79 // Get the manager for the original profile, since the PolicyService is | 82 // Get the manager for the original profile, since the PolicyService is |
80 // also shared between the incognito Profile and the original Profile. | 83 // also shared between the incognito Profile and the original Profile. |
81 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); | 84 ManagerMap::const_iterator it = managers_.find(profile->GetOriginalProfile()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 | 139 |
137 scoped_ptr<CloudPolicyStore> store( | 140 scoped_ptr<CloudPolicyStore> store( |
138 new UserCloudPolicyStoreChromeOS( | 141 new UserCloudPolicyStoreChromeOS( |
139 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), | 142 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), |
140 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 143 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
141 username, policy_key_dir, token_cache_file, policy_cache_file)); | 144 username, policy_key_dir, token_cache_file, policy_cache_file)); |
142 scoped_ptr<ResourceCache> resource_cache; | 145 scoped_ptr<ResourceCache> resource_cache; |
143 if (command_line->HasSwitch(switches::kEnableComponentCloudPolicy)) | 146 if (command_line->HasSwitch(switches::kEnableComponentCloudPolicy)) |
144 resource_cache.reset(new ResourceCache(resource_cache_dir)); | 147 resource_cache.reset(new ResourceCache(resource_cache_dir)); |
145 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( | 148 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( |
146 new UserCloudPolicyManagerChromeOS(store.Pass(), | 149 new UserCloudPolicyManagerChromeOS( |
147 resource_cache.Pass(), | 150 store.Pass(), |
148 wait_for_initial_policy)); | 151 resource_cache.Pass(), |
152 wait_for_initial_policy, | |
153 invalidation::InvalidationServiceFactory::GetForProfile(profile))); | |
149 manager->Init(); | 154 manager->Init(); |
150 manager->Connect(g_browser_process->local_state(), | 155 manager->Connect(g_browser_process->local_state(), |
151 device_management_service, | 156 device_management_service, |
152 g_browser_process->system_request_context(), | 157 g_browser_process->system_request_context(), |
153 affiliation); | 158 affiliation); |
154 | 159 |
155 DCHECK(managers_.find(profile) == managers_.end()); | 160 DCHECK(managers_.find(profile) == managers_.end()); |
156 managers_[profile] = manager.get(); | 161 managers_[profile] = manager.get(); |
157 return manager.Pass(); | 162 return manager.Pass(); |
158 } | 163 } |
(...skipping 15 matching lines...) Expand all Loading... | |
174 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); | 179 BrowserContextKeyedBaseFactory::BrowserContextDestroyed(context); |
175 } | 180 } |
176 | 181 |
177 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( | 182 void UserCloudPolicyManagerFactoryChromeOS::SetEmptyTestingFactory( |
178 content::BrowserContext* context) {} | 183 content::BrowserContext* context) {} |
179 | 184 |
180 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 185 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
181 content::BrowserContext* context) {} | 186 content::BrowserContext* context) {} |
182 | 187 |
183 } // namespace policy | 188 } // namespace policy |
OLD | NEW |