Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/extensions/extension_settings_changes.h" | |
| 6 | |
| 7 #include "base/json/json_writer.h" | |
| 8 | |
| 9 ExtensionSettingsChanges::ExtensionSettingsChanges() : inner_(new Inner()) {} | |
| 10 | |
| 11 ExtensionSettingsChanges::~ExtensionSettingsChanges() {} | |
| 12 | |
| 13 void ExtensionSettingsChanges::AppendChange( | |
| 14 const std::string& key, Value* old_value, Value* new_value) { | |
| 15 DictionaryValue* change = new DictionaryValue(); | |
| 16 change->Set("key", Value::CreateStringValue(key)); | |
|
akalin
2011/10/14 10:31:49
can do SetString()
not at google - send to devlin
2011/10/17 00:04:33
Done.
| |
| 17 if (old_value) { | |
| 18 change->Set("oldValue", old_value); | |
| 19 } | |
| 20 if (new_value) { | |
| 21 change->Set("newValue", new_value); | |
| 22 } | |
| 23 inner_->changes.Append(change); | |
| 24 } | |
| 25 | |
| 26 std::string ExtensionSettingsChanges::ToJson() const { | |
| 27 std::string event_json; | |
| 28 base::JSONWriter::Write(&inner_->changes, false, &event_json); | |
| 29 return event_json; | |
| 30 } | |
| OLD | NEW |