| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // IGNORE_QUOTA because these settings aren't writable by the extension, and | 98 // IGNORE_QUOTA because these settings aren't writable by the extension, and |
| 99 // are configured by the domain administrator. | 99 // are configured by the domain administrator. |
| 100 ValueStore::WriteOptions options = ValueStore::IGNORE_QUOTA; | 100 ValueStore::WriteOptions options = ValueStore::IGNORE_QUOTA; |
| 101 result = delegate_->Set(options, current_policy); | 101 result = delegate_->Set(options, current_policy); |
| 102 if (!result->HasError()) { | 102 if (!result->HasError()) { |
| 103 changes.insert( | 103 changes.insert( |
| 104 changes.end(), result->changes().begin(), result->changes().end()); | 104 changes.end(), result->changes().begin(), result->changes().end()); |
| 105 } | 105 } |
| 106 | 106 |
| 107 if (!changes.empty()) { | 107 if (!changes.empty()) { |
| 108 observers_->Notify( | 108 observers_->Notify(FROM_HERE, &SettingsObserver::OnSettingsChanged, |
| 109 &SettingsObserver::OnSettingsChanged, | 109 extension_id_, settings_namespace::MANAGED, |
| 110 extension_id_, | 110 ValueStoreChange::ToJson(changes)); |
| 111 settings_namespace::MANAGED, | |
| 112 ValueStoreChange::ToJson(changes)); | |
| 113 } | 111 } |
| 114 } | 112 } |
| 115 | 113 |
| 116 void PolicyValueStore::DeleteStorage() { | 114 void PolicyValueStore::DeleteStorage() { |
| 117 // This is called from our owner, indicating that storage for this extension | 115 // This is called from our owner, indicating that storage for this extension |
| 118 // should be removed. | 116 // should be removed. |
| 119 delegate_->Clear(); | 117 delegate_->Clear(); |
| 120 } | 118 } |
| 121 | 119 |
| 122 size_t PolicyValueStore::GetBytesInUse(const std::string& key) { | 120 size_t PolicyValueStore::GetBytesInUse(const std::string& key) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 return MakeWriteResult(ReadOnlyError(util::NoKey())); | 170 return MakeWriteResult(ReadOnlyError(util::NoKey())); |
| 173 } | 171 } |
| 174 | 172 |
| 175 bool PolicyValueStore::Restore() { return delegate_->Restore(); } | 173 bool PolicyValueStore::Restore() { return delegate_->Restore(); } |
| 176 | 174 |
| 177 bool PolicyValueStore::RestoreKey(const std::string& key) { | 175 bool PolicyValueStore::RestoreKey(const std::string& key) { |
| 178 return delegate_->RestoreKey(key); | 176 return delegate_->RestoreKey(key); |
| 179 } | 177 } |
| 180 | 178 |
| 181 } // namespace extensions | 179 } // namespace extensions |
| OLD | NEW |