| Index: chrome/browser/extensions/extension_settings_storage.cc
|
| diff --git a/chrome/browser/extensions/extension_settings_storage.cc b/chrome/browser/extensions/extension_settings_storage.cc
|
| index 882efe83e72268923482ae77ca8029b589eb93fc..3259748e95d012adefb3c66efd9e9cf65ff8ccc6 100644
|
| --- a/chrome/browser/extensions/extension_settings_storage.cc
|
| +++ b/chrome/browser/extensions/extension_settings_storage.cc
|
| @@ -8,27 +8,57 @@
|
| // Implementation of ExtensionSettingsStorage::Result
|
|
|
| ExtensionSettingsStorage::Result::Result(
|
| - DictionaryValue* settings, std::set<std::string>* changed_keys)
|
| - : inner_(new Inner(settings, changed_keys, std::string())) {}
|
| + DictionaryValue* settings,
|
| + DictionaryValue* old_settings,
|
| + std::set<std::string>* changed_keys)
|
| + : inner_(new Inner(settings, old_settings, changed_keys, std::string())) {}
|
|
|
| ExtensionSettingsStorage::Result::Result(const std::string& error)
|
| - : inner_(new Inner(NULL, new std::set<std::string>(), error)) {
|
| + : inner_(new Inner(NULL, NULL, new std::set<std::string>(), error)) {
|
| DCHECK(!error.empty());
|
| }
|
|
|
| ExtensionSettingsStorage::Result::~Result() {}
|
|
|
| -DictionaryValue* ExtensionSettingsStorage::Result::GetSettings() const {
|
| +const DictionaryValue* ExtensionSettingsStorage::Result::GetSettings() const {
|
| DCHECK(!HasError());
|
| return inner_->settings_.get();
|
| }
|
|
|
| -std::set<std::string>*
|
| +const std::set<std::string>*
|
| ExtensionSettingsStorage::Result::GetChangedKeys() const {
|
| DCHECK(!HasError());
|
| return inner_->changed_keys_.get();
|
| }
|
|
|
| +const Value* ExtensionSettingsStorage::Result::GetOldValue(
|
| + const std::string& key) const {
|
| + DCHECK(!HasError());
|
| + if (!inner_->changed_keys_.get()) {
|
| + return NULL;
|
| + }
|
| + Value* old_value = NULL;
|
| + if (inner_->changed_keys_->count(key)) {
|
| + inner_->old_settings_->GetWithoutPathExpansion(key, &old_value);
|
| + } else if (inner_->settings_.get()) {
|
| + inner_->settings_->GetWithoutPathExpansion(key, &old_value);
|
| + }
|
| + return old_value;
|
| +}
|
| +
|
| +const Value* ExtensionSettingsStorage::Result::GetNewValue(
|
| + const std::string& key) const {
|
| + DCHECK(!HasError());
|
| + if (!inner_->changed_keys_.get()) {
|
| + return NULL;
|
| + }
|
| + Value* new_value = NULL;
|
| + if (inner_->settings_.get()) {
|
| + inner_->settings_->GetWithoutPathExpansion(key, &new_value);
|
| + }
|
| + return new_value;
|
| +}
|
| +
|
| bool ExtensionSettingsStorage::Result::HasError() const {
|
| return !inner_->error_.empty();
|
| }
|
| @@ -40,8 +70,12 @@ const std::string& ExtensionSettingsStorage::Result::GetError() const {
|
|
|
| ExtensionSettingsStorage::Result::Inner::Inner(
|
| DictionaryValue* settings,
|
| + DictionaryValue* old_settings,
|
| std::set<std::string>* changed_keys,
|
| const std::string& error)
|
| - : settings_(settings), changed_keys_(changed_keys), error_(error) {}
|
| + : settings_(settings),
|
| + old_settings_(old_settings),
|
| + changed_keys_(changed_keys),
|
| + error_(error) {}
|
|
|
| ExtensionSettingsStorage::Result::Inner::~Inner() {}
|
|
|