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

Side by Side Diff: chrome/browser/extensions/extension_setting_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: changes return string 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_setting_changes.h"
6
7 #include "base/json/json_writer.h"
8
9 void ExtensionSettingChanges::Builder::AppendChange(
10 const std::string& key, Value* old_value, Value* new_value) {
11 DictionaryValue* change = new DictionaryValue();
12 changes_.Append(change);
13
14 change->SetString("key", key);
15 if (old_value) {
16 change->Set("oldValue", old_value);
17 }
18 if (new_value) {
19 change->Set("newValue", new_value);
20 }
21 }
22
23 ExtensionSettingChanges ExtensionSettingChanges::Builder::Build() {
24 std::string changes_json;
akalin 2011/10/17 17:37:38 should probably clear changes_ (i.e., pass a point
not at google - send to devlin 2011/10/17 23:05:44 Done.
25 base::JSONWriter::Write(&changes_, false, &changes_json);
26 return ExtensionSettingChanges(changes_json);
27 }
28
29 ExtensionSettingChanges::ExtensionSettingChanges(const std::string& changes)
30 : inner_(new Inner(changes)) {}
31
32 ExtensionSettingChanges::~ExtensionSettingChanges() {}
33
34 std::string ExtensionSettingChanges::ToJson() const {
35 return inner_->changes_;
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698