Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/extensions/extension_settings_changes.cc

Issue 8177022: Add onChanged events to the extension settings API, both from sync and between (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync again... Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698