| Index: chrome/browser/extensions/api/storage/policy_value_store.cc
|
| diff --git a/chrome/browser/extensions/api/storage/policy_value_store.cc b/chrome/browser/extensions/api/storage/policy_value_store.cc
|
| index f5da68205785a23105b728cac0fa2feef3c39eba..9691e2bf01c832a43b7e6db4d6c8710d2d7858f6 100644
|
| --- a/chrome/browser/extensions/api/storage/policy_value_store.cc
|
| +++ b/chrome/browser/extensions/api/storage/policy_value_store.cc
|
| @@ -57,6 +57,17 @@ void PolicyValueStore::SetCurrentPolicy(const policy::PolicyMap& policy) {
|
| // must be removed.
|
| base::DictionaryValue previous_policy;
|
| ValueStore::ReadResult read_result = delegate_->Get();
|
| +
|
| + // If the database is corrupted, try to restore it.
|
| + // This may have the unfortunate side-effect of incorrectly informing the
|
| + // extension of a "new" key, which isn't new and was corrupted. Unfortunately,
|
| + // there's not always a way around this - if the database is corrupted, there
|
| + // may be no way of telling which keys were previously present.
|
| + if (read_result->IsCorrupted()) {
|
| + if (delegate_->Restore())
|
| + read_result = delegate_->Get();
|
| + }
|
| +
|
| if (read_result->HasError()) {
|
| LOG(WARNING) << "Failed to read managed settings for extension "
|
| << extension_id_ << ": " << read_result->error().message;
|
| @@ -161,4 +172,10 @@ ValueStore::WriteResult PolicyValueStore::Clear() {
|
| return MakeWriteResult(ReadOnlyError(util::NoKey()));
|
| }
|
|
|
| +bool PolicyValueStore::Restore() { return delegate_->Restore(); }
|
| +
|
| +bool PolicyValueStore::RestoreKey(const std::string& key) {
|
| + return delegate_->RestoreKey(key);
|
| +}
|
| +
|
| } // namespace extensions
|
|
|