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/cloud/component_cloud_policy_store.h" | 5 #include "chrome/browser/policy/cloud/component_cloud_policy_store.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/sha1.h" | 10 #include "base/sha1.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 } | 59 } |
60 | 60 |
61 } // namespace | 61 } // namespace |
62 | 62 |
63 ComponentCloudPolicyStore::Delegate::~Delegate() {} | 63 ComponentCloudPolicyStore::Delegate::~Delegate() {} |
64 | 64 |
65 ComponentCloudPolicyStore::ComponentCloudPolicyStore( | 65 ComponentCloudPolicyStore::ComponentCloudPolicyStore( |
66 Delegate* delegate, | 66 Delegate* delegate, |
67 ResourceCache* cache) | 67 ResourceCache* cache) |
68 : delegate_(delegate), | 68 : delegate_(delegate), |
69 cache_(cache) {} | 69 cache_(cache) { |
| 70 // Allow the store to be created on a different thread than the thread that |
| 71 // will end up using it. |
| 72 DetachFromThread(); |
| 73 } |
70 | 74 |
71 ComponentCloudPolicyStore::~ComponentCloudPolicyStore() { | 75 ComponentCloudPolicyStore::~ComponentCloudPolicyStore() { |
72 DCHECK(CalledOnValidThread()); | 76 DCHECK(CalledOnValidThread()); |
73 } | 77 } |
74 | 78 |
75 // static | 79 // static |
76 bool ComponentCloudPolicyStore::SupportsDomain(PolicyDomain domain) { | 80 bool ComponentCloudPolicyStore::SupportsDomain(PolicyDomain domain) { |
77 return GetDomainConstants(domain) != NULL; | 81 return GetDomainConstants(domain) != NULL; |
78 } | 82 } |
79 | 83 |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 // If policy for components is ever used for device-level settings then | 339 // If policy for components is ever used for device-level settings then |
336 // this must support a configurable scope; assuming POLICY_SCOPE_USER is | 340 // this must support a configurable scope; assuming POLICY_SCOPE_USER is |
337 // fine for now. | 341 // fine for now. |
338 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); | 342 policy->Set(it.key(), level, POLICY_SCOPE_USER, value.release(), NULL); |
339 } | 343 } |
340 | 344 |
341 return true; | 345 return true; |
342 } | 346 } |
343 | 347 |
344 } // namespace policy | 348 } // namespace policy |
OLD | NEW |