| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/storage/storage_api.h" | 5 #include "extensions/browser/api/storage/storage_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return OneArgument(dict); | 81 return OneArgument(dict); |
| 82 } | 82 } |
| 83 | 83 |
| 84 ExtensionFunction::ResponseValue SettingsFunction::UseWriteResult( | 84 ExtensionFunction::ResponseValue SettingsFunction::UseWriteResult( |
| 85 ValueStore::WriteResult result, | 85 ValueStore::WriteResult result, |
| 86 ValueStore* storage) { | 86 ValueStore* storage) { |
| 87 if (result->HasError()) | 87 if (result->HasError()) |
| 88 return HandleError(result->error(), storage); | 88 return HandleError(result->error(), storage); |
| 89 | 89 |
| 90 if (!result->changes().empty()) { | 90 if (!result->changes().empty()) { |
| 91 observers_->Notify( | 91 observers_->Notify(FROM_HERE, &SettingsObserver::OnSettingsChanged, |
| 92 &SettingsObserver::OnSettingsChanged, | 92 extension_id(), settings_namespace_, |
| 93 extension_id(), | 93 ValueStoreChange::ToJson(result->changes())); |
| 94 settings_namespace_, | |
| 95 ValueStoreChange::ToJson(result->changes())); | |
| 96 } | 94 } |
| 97 | 95 |
| 98 return NoArguments(); | 96 return NoArguments(); |
| 99 } | 97 } |
| 100 | 98 |
| 101 ExtensionFunction::ResponseValue SettingsFunction::HandleError( | 99 ExtensionFunction::ResponseValue SettingsFunction::HandleError( |
| 102 const ValueStore::Error& error, | 100 const ValueStore::Error& error, |
| 103 ValueStore* storage) { | 101 ValueStore* storage) { |
| 104 // If the method failed due to corruption, and we haven't tried to fix it, we | 102 // If the method failed due to corruption, and we haven't tried to fix it, we |
| 105 // can try to restore the storage and re-run it. Otherwise, the method has | 103 // can try to restore the storage and re-run it. Otherwise, the method has |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { | 290 StorageStorageAreaClearFunction::RunWithStorage(ValueStore* storage) { |
| 293 return UseWriteResult(storage->Clear(), storage); | 291 return UseWriteResult(storage->Clear(), storage); |
| 294 } | 292 } |
| 295 | 293 |
| 296 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( | 294 void StorageStorageAreaClearFunction::GetQuotaLimitHeuristics( |
| 297 QuotaLimitHeuristics* heuristics) const { | 295 QuotaLimitHeuristics* heuristics) const { |
| 298 GetModificationQuotaLimitHeuristics(heuristics); | 296 GetModificationQuotaLimitHeuristics(heuristics); |
| 299 } | 297 } |
| 300 | 298 |
| 301 } // namespace extensions | 299 } // namespace extensions |
| OLD | NEW |