| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ | 5 #ifndef EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ |
| 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ | 6 #define EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | 10 #include <vector> |
| 10 | 11 |
| 11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 | 14 |
| 15 class ValueStoreChange; | 15 class ValueStoreChange; |
| 16 typedef std::vector<ValueStoreChange> ValueStoreChangeList; | 16 typedef std::vector<ValueStoreChange> ValueStoreChangeList; |
| 17 | 17 |
| 18 // A change to a setting. Safe/efficient to copy. | 18 // A change to a setting. Safe/efficient to copy. |
| 19 class ValueStoreChange { | 19 class ValueStoreChange { |
| 20 public: | 20 public: |
| 21 // Converts an ValueStoreChangeList into JSON of the form: | 21 // Converts an ValueStoreChangeList into JSON of the form: |
| 22 // { "foo": { "key": "foo", "oldValue": "bar", "newValue": "baz" } } | 22 // { "foo": { "key": "foo", "oldValue": "bar", "newValue": "baz" } } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 41 // value. | 41 // value. |
| 42 const base::Value* new_value() const; | 42 const base::Value* new_value() const; |
| 43 | 43 |
| 44 private: | 44 private: |
| 45 class Inner : public base::RefCountedThreadSafe<Inner> { | 45 class Inner : public base::RefCountedThreadSafe<Inner> { |
| 46 public: | 46 public: |
| 47 Inner( | 47 Inner( |
| 48 const std::string& key, base::Value* old_value, base::Value* new_value); | 48 const std::string& key, base::Value* old_value, base::Value* new_value); |
| 49 | 49 |
| 50 const std::string key_; | 50 const std::string key_; |
| 51 const scoped_ptr<base::Value> old_value_; | 51 const std::unique_ptr<base::Value> old_value_; |
| 52 const scoped_ptr<base::Value> new_value_; | 52 const std::unique_ptr<base::Value> new_value_; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 friend class base::RefCountedThreadSafe<Inner>; | 55 friend class base::RefCountedThreadSafe<Inner>; |
| 56 virtual ~Inner(); | 56 virtual ~Inner(); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 scoped_refptr<Inner> inner_; | 59 scoped_refptr<Inner> inner_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ | 62 #endif // EXTENSIONS_BROWSER_VALUE_STORE_VALUE_STORE_CHANGE_H_ |
| OLD | NEW |