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

Unified Diff: chrome/browser/extensions/extension_settings_changes.h

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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/extension_settings_changes.h
diff --git a/chrome/browser/extensions/extension_settings_changes.h b/chrome/browser/extensions/extension_settings_changes.h
new file mode 100644
index 0000000000000000000000000000000000000000..f55183a7f24393c6a73a1dd8141f89149cd2682c
--- /dev/null
+++ b/chrome/browser/extensions/extension_settings_changes.h
@@ -0,0 +1,37 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_
+#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_
+#pragma once
+
+#include "base/memory/ref_counted.h"
+#include "base/values.h"
+
+// A list of changes to extension settings. Thread-safe and efficient to copy.
+class ExtensionSettingsChanges {
akalin 2011/10/14 10:31:49 I think ExtensionSettingChanges is less awkward (y
not at google - send to devlin 2011/10/17 00:04:33 Done.
+ public:
+ ExtensionSettingsChanges();
+ ~ExtensionSettingsChanges();
+
+ // Appends a change for a setting.
+ void AppendChange(
akalin 2011/10/14 10:31:49 Unfortunately, the presence of this function makes
not at google - send to devlin 2011/10/17 00:04:33 Hm ok. I don't really like building up a ListValu
akalin 2011/10/17 08:08:57 That works, too.
not at google - send to devlin 2011/10/17 10:35:33 Cool, well, I've written the code and it's uploade
Aaron Boodman 2011/10/18 06:18:30 Guys, I'm really sorry to add more noise to this C
+ const std::string& key,
+ // Ownership taken. May be NULL to imply there is no old value.
+ Value* old_value,
+ // Ownership taken. May be NULL to imply there is no new value.
+ Value* new_value);
+
+ // Gets the JSON serialized form of the changes, for example:
+ // [ { "key": "foo", "oldValue": "bar", "newValue": "baz" } ]
+ std::string ToJson() const;
+
+ private:
+ struct Inner : base::RefCountedThreadSafe<Inner> {
+ ListValue changes;
akalin 2011/10/14 10:31:49 make the destructor private
not at google - send to devlin 2011/10/17 00:04:33 Done.
+ };
+ scoped_refptr<Inner> inner_;
+};
+
+#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_

Powered by Google App Engine
This is Rietveld 408576698