OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 | 44 |
45 // Returns the extension id the setting is for. | 45 // Returns the extension id the setting is for. |
46 const std::string& extension_id() const; | 46 const std::string& extension_id() const; |
47 | 47 |
48 // Returns the settings key. | 48 // Returns the settings key. |
49 const std::string& key() const; | 49 const std::string& key() const; |
50 | 50 |
51 // Returns the value of the setting. | 51 // Returns the value of the setting. |
52 const base::Value& value() const; | 52 const base::Value& value() const; |
53 | 53 |
54 // Releases ownership of the value to the caller. | |
55 // | |
56 // Be careful when calling this, as SettingSyncData is effectively a | |
Devlin
2015/05/15 21:59:07
Hmm...
Generally, it's best to avoid saying "Be c
not at google - send to devlin
2015/05/15 23:28:30
The blocker is this diff blowing up even more, but
Devlin
2015/05/15 23:58:18
Win.
| |
57 // refcounted wrapper around internal state, which can be shared between | |
58 // multiple SettingSyncData instances. | |
59 // | |
60 // Therefore, releasing the value may unexpectedly release the value from | |
61 // other SettingSyncData instances. | |
62 scoped_ptr<base::Value> PassValue(); | |
63 | |
54 private: | 64 private: |
55 // Ref-counted container for the data. | 65 // Ref-counted container for the data. |
56 // TODO(kalman): Use browser_sync::Immutable<Internal>. | 66 // TODO(kalman): Use browser_sync::Immutable<Internal>. |
57 class Internal : public base::RefCountedThreadSafe<Internal> { | 67 class Internal : public base::RefCountedThreadSafe<Internal> { |
58 public: | 68 public: |
59 Internal( | 69 Internal( |
60 syncer::SyncChange::SyncChangeType change_type, | 70 syncer::SyncChange::SyncChangeType change_type, |
61 const std::string& extension_id, | 71 const std::string& extension_id, |
62 const std::string& key, | 72 const std::string& key, |
63 scoped_ptr<base::Value> value); | 73 scoped_ptr<base::Value> value); |
(...skipping 18 matching lines...) Expand all Loading... | |
82 const sync_pb::ExtensionSettingSpecifics& specifics); | 92 const sync_pb::ExtensionSettingSpecifics& specifics); |
83 | 93 |
84 scoped_refptr<Internal> internal_; | 94 scoped_refptr<Internal> internal_; |
85 }; | 95 }; |
86 | 96 |
87 typedef std::vector<SettingSyncData> SettingSyncDataList; | 97 typedef std::vector<SettingSyncData> SettingSyncDataList; |
88 | 98 |
89 } // namespace extensions | 99 } // namespace extensions |
90 | 100 |
91 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ | 101 #endif // CHROME_BROWSER_EXTENSIONS_API_STORAGE_SETTING_SYNC_DATA_H_ |
OLD | NEW |