OLD | NEW |
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 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 5 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
13 #include "components/policy/core/common/cloud/cloud_policy_service.h" | 13 #include "components/policy/core/common/cloud/cloud_policy_service.h" |
14 #include "components/policy/core/common/policy_bundle.h" | 14 #include "components/policy/core/common/policy_bundle.h" |
15 #include "components/policy/core/common/policy_map.h" | 15 #include "components/policy/core/common/policy_map.h" |
16 #include "components/policy/core/common/policy_switches.h" | 16 #include "components/policy/core/common/policy_switches.h" |
17 #include "net/url_request/url_request_context_getter.h" | 17 #include "net/url_request/url_request_context_getter.h" |
18 | 18 |
19 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 19 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
20 #include "components/policy/core/common/cloud/resource_cache.h" | 20 #include "components/policy/core/common/cloud/resource_cache.h" |
21 #endif | 21 #endif |
22 | 22 |
23 namespace policy { | 23 namespace policy { |
24 | 24 |
25 CloudPolicyManager::CloudPolicyManager( | 25 CloudPolicyManager::CloudPolicyManager( |
26 const PolicyNamespaceKey& policy_ns_key, | 26 const std::string& policy_type, |
| 27 const std::string& settings_entity_id, |
27 CloudPolicyStore* cloud_policy_store, | 28 CloudPolicyStore* cloud_policy_store, |
28 const scoped_refptr<base::SequencedTaskRunner>& task_runner, | 29 const scoped_refptr<base::SequencedTaskRunner>& task_runner, |
29 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, | 30 const scoped_refptr<base::SequencedTaskRunner>& file_task_runner, |
30 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) | 31 const scoped_refptr<base::SequencedTaskRunner>& io_task_runner) |
31 : core_(policy_ns_key, cloud_policy_store, task_runner), | 32 : core_(policy_type, settings_entity_id, cloud_policy_store, task_runner), |
32 waiting_for_policy_refresh_(false), | 33 waiting_for_policy_refresh_(false), |
33 file_task_runner_(file_task_runner), | 34 file_task_runner_(file_task_runner), |
34 io_task_runner_(io_task_runner) { | 35 io_task_runner_(io_task_runner) { |
35 store()->AddObserver(this); | 36 store()->AddObserver(this); |
36 | 37 |
37 // If the underlying store is already initialized, publish the loaded | 38 // If the underlying store is already initialized, publish the loaded |
38 // policy. Otherwise, request a load now. | 39 // policy. Otherwise, request a load now. |
39 if (store()->is_initialized()) | 40 if (store()->is_initialized()) |
40 CheckAndPublishPolicy(); | 41 CheckAndPublishPolicy(); |
41 else | 42 else |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 } | 145 } |
145 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 146 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
146 } | 147 } |
147 | 148 |
148 void CloudPolicyManager::OnRefreshComplete(bool success) { | 149 void CloudPolicyManager::OnRefreshComplete(bool success) { |
149 waiting_for_policy_refresh_ = false; | 150 waiting_for_policy_refresh_ = false; |
150 CheckAndPublishPolicy(); | 151 CheckAndPublishPolicy(); |
151 } | 152 } |
152 | 153 |
153 } // namespace policy | 154 } // namespace policy |
OLD | NEW |