OLD | NEW |
1 // Copyright (c) 2011 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_SYNC_INTERNAL_API_WRITE_NODE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ |
6 #define CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ | 6 #define CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "chrome/browser/sync/internal_api/base_node.h" | 14 #include "chrome/browser/sync/internal_api/base_node.h" |
15 #include "chrome/browser/sync/syncable/model_type.h" | 15 #include "sync/syncable/model_type.h" |
16 | 16 |
17 namespace browser_sync { | 17 namespace browser_sync { |
18 class Cryptographer; | 18 class Cryptographer; |
19 class TestBookmarkModelAssociator; | 19 class TestBookmarkModelAssociator; |
20 } | 20 } |
21 | 21 |
22 namespace syncable { | 22 namespace syncable { |
23 class Entry; | 23 class Entry; |
24 class MutableEntry; | 24 class MutableEntry; |
25 } | 25 } |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); | 147 void SetTypedUrlSpecifics(const sync_pb::TypedUrlSpecifics& specifics); |
148 | 148 |
149 // Set the extension specifics (id, update url, enabled state, etc). | 149 // Set the extension specifics (id, update url, enabled state, etc). |
150 // Should only be called if GetModelType() == EXTENSIONS. | 150 // Should only be called if GetModelType() == EXTENSIONS. |
151 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); | 151 void SetExtensionSpecifics(const sync_pb::ExtensionSpecifics& specifics); |
152 | 152 |
153 // Set the session specifics (windows, tabs, navigations etc.). | 153 // Set the session specifics (windows, tabs, navigations etc.). |
154 // Should only be called if GetModelType() == SESSIONS. | 154 // Should only be called if GetModelType() == SESSIONS. |
155 void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics); | 155 void SetSessionSpecifics(const sync_pb::SessionSpecifics& specifics); |
156 | 156 |
157 // Stores |new_specifics| into |entry|, encrypting if necessary. | |
158 // Returns false if an error encrypting occurred (does not modify |entry|). | |
159 // Note: gracefully handles new_specifics aliasing with entry->Get(SPECIFICS). | |
160 static bool UpdateEntryWithEncryption( | |
161 browser_sync::Cryptographer* cryptographer, | |
162 const sync_pb::EntitySpecifics& new_specifics, | |
163 syncable::MutableEntry* entry); | |
164 | |
165 // Implementation of BaseNode's abstract virtual accessors. | 157 // Implementation of BaseNode's abstract virtual accessors. |
166 virtual const syncable::Entry* GetEntry() const OVERRIDE; | 158 virtual const syncable::Entry* GetEntry() const OVERRIDE; |
167 | 159 |
168 virtual const BaseTransaction* GetTransaction() const OVERRIDE; | 160 virtual const BaseTransaction* GetTransaction() const OVERRIDE; |
169 | 161 |
170 private: | 162 private: |
171 friend class browser_sync::TestBookmarkModelAssociator; | 163 friend class browser_sync::TestBookmarkModelAssociator; |
172 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); | 164 FRIEND_TEST_ALL_PREFIXES(SyncManagerTest, EncryptBookmarksWithLegacyData); |
173 | 165 |
174 void* operator new(size_t size); // Node is meant for stack use only. | 166 void* operator new(size_t size); // Node is meant for stack use only. |
(...skipping 13 matching lines...) Expand all Loading... |
188 | 180 |
189 // The sync API transaction that is the parent of this node. | 181 // The sync API transaction that is the parent of this node. |
190 WriteTransaction* transaction_; | 182 WriteTransaction* transaction_; |
191 | 183 |
192 DISALLOW_COPY_AND_ASSIGN(WriteNode); | 184 DISALLOW_COPY_AND_ASSIGN(WriteNode); |
193 }; | 185 }; |
194 | 186 |
195 } // namespace sync_api | 187 } // namespace sync_api |
196 | 188 |
197 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ | 189 #endif // CHROME_BROWSER_SYNC_INTERNAL_API_WRITE_NODE_H_ |
OLD | NEW |