Chromium Code Reviews| 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..7109381db7474139c796c154de7d0f7689b32d4b 100644 |
| --- a/chrome/browser/extensions/api/storage/policy_value_store.cc |
| +++ b/chrome/browser/extensions/api/storage/policy_value_store.cc |
| @@ -57,6 +57,13 @@ 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. |
| + if (read_result->IsCorrupted()) { |
| + if (delegate_->Restore()) |
| + read_result = delegate_->Get(); |
|
not at google - send to devlin
2014/02/19 18:40:37
I still don't think this is quite right though, be
Devlin
2014/02/19 19:13:55
Yes, the extension will be notified of all keys be
|
| + } |
| + |
| if (read_result->HasError()) { |
| LOG(WARNING) << "Failed to read managed settings for extension " |
| << extension_id_ << ": " << read_result->error().message; |
| @@ -161,4 +168,10 @@ ValueStore::WriteResult PolicyValueStore::Clear() { |
| return MakeWriteResult(ReadOnlyError(util::NoKey())); |
| } |
| +bool PolicyValueStore::Restore() { return delegate_->Restore(); } |
|
not at google - send to devlin
2014/02/19 18:40:37
GRR GIT CL FORMAT IS WRONG.
anyhow, it seems like
not at google - send to devlin
2014/02/19 18:48:26
I suppose if Restore actually does manage to resto
Devlin
2014/02/19 19:13:55
Ideally, yes, Restore() would give more informatio
|
| + |
| +bool PolicyValueStore::RestoreKey(const std::string& key) { |
| + return delegate_->RestoreKey(key); |
| +} |
| + |
| } // namespace extensions |