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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_ | |
| 7 #pragma once | |
| 8 | |
| 9 #include "base/memory/ref_counted.h" | |
| 10 #include "base/values.h" | |
| 11 | |
| 12 // A list of changes to extension settings. Thread-safe and efficient to copy. | |
| 13 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.
| |
| 14 public: | |
| 15 ExtensionSettingsChanges(); | |
| 16 ~ExtensionSettingsChanges(); | |
| 17 | |
| 18 // Appends a change for a setting. | |
| 19 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
| |
| 20 const std::string& key, | |
| 21 // Ownership taken. May be NULL to imply there is no old value. | |
| 22 Value* old_value, | |
| 23 // Ownership taken. May be NULL to imply there is no new value. | |
| 24 Value* new_value); | |
| 25 | |
| 26 // Gets the JSON serialized form of the changes, for example: | |
| 27 // [ { "key": "foo", "oldValue": "bar", "newValue": "baz" } ] | |
| 28 std::string ToJson() const; | |
| 29 | |
| 30 private: | |
| 31 struct Inner : base::RefCountedThreadSafe<Inner> { | |
| 32 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.
| |
| 33 }; | |
| 34 scoped_refptr<Inner> inner_; | |
| 35 }; | |
| 36 | |
| 37 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SETTINGS_CHANGES_H_ | |
| OLD | NEW |