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 "chrome/browser/extensions/api/storage/policy_value_store.h" | 5 #include "chrome/browser/extensions/api/storage/policy_value_store.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/policy/core/common/policy_map.h" | 9 #include "components/policy/core/common/policy_map.h" |
10 #include "components/policy/core/common/policy_types.h" | 10 #include "components/policy/core/common/policy_types.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 const std::string& extension_id, | 32 const std::string& extension_id, |
33 const scoped_refptr<SettingsObserverList>& observers, | 33 const scoped_refptr<SettingsObserverList>& observers, |
34 scoped_ptr<ValueStore> delegate) | 34 scoped_ptr<ValueStore> delegate) |
35 : extension_id_(extension_id), | 35 : extension_id_(extension_id), |
36 observers_(observers), | 36 observers_(observers), |
37 delegate_(delegate.Pass()) {} | 37 delegate_(delegate.Pass()) {} |
38 | 38 |
39 PolicyValueStore::~PolicyValueStore() {} | 39 PolicyValueStore::~PolicyValueStore() {} |
40 | 40 |
41 void PolicyValueStore::SetCurrentPolicy(const policy::PolicyMap& policy) { | 41 void PolicyValueStore::SetCurrentPolicy(const policy::PolicyMap& policy) { |
42 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 42 DCHECK_CURRENTLY_ON(BrowserThread::FILE); |
43 // Convert |policy| to a dictionary value. Only include mandatory policies | 43 // Convert |policy| to a dictionary value. Only include mandatory policies |
44 // for now. | 44 // for now. |
45 base::DictionaryValue current_policy; | 45 base::DictionaryValue current_policy; |
46 for (policy::PolicyMap::const_iterator it = policy.begin(); | 46 for (policy::PolicyMap::const_iterator it = policy.begin(); |
47 it != policy.end(); ++it) { | 47 it != policy.end(); ++it) { |
48 if (it->second.level == policy::POLICY_LEVEL_MANDATORY) { | 48 if (it->second.level == policy::POLICY_LEVEL_MANDATORY) { |
49 current_policy.SetWithoutPathExpansion( | 49 current_policy.SetWithoutPathExpansion( |
50 it->first, it->second.value->DeepCopy()); | 50 it->first, it->second.value->DeepCopy()); |
51 } | 51 } |
52 } | 52 } |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 return MakeWriteResult(ReadOnlyError(util::NoKey())); | 172 return MakeWriteResult(ReadOnlyError(util::NoKey())); |
173 } | 173 } |
174 | 174 |
175 bool PolicyValueStore::Restore() { return delegate_->Restore(); } | 175 bool PolicyValueStore::Restore() { return delegate_->Restore(); } |
176 | 176 |
177 bool PolicyValueStore::RestoreKey(const std::string& key) { | 177 bool PolicyValueStore::RestoreKey(const std::string& key) { |
178 return delegate_->RestoreKey(key); | 178 return delegate_->RestoreKey(key); |
179 } | 179 } |
180 | 180 |
181 } // namespace extensions | 181 } // namespace extensions |
OLD | NEW |