Chromium Code Reviews| 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_ |