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 SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 5 #ifndef SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
6 #define SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 6 #define SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
7 | 7 |
8 #include "sync/internal_api/public/user_share.h" | 8 #include "sync/internal_api/public/user_share.h" |
9 | 9 |
| 10 #include "sync/internal_api/public/base/model_type.h" |
10 #include "sync/util/cryptographer.h" | 11 #include "sync/util/cryptographer.h" |
11 | 12 |
12 namespace syncer { | 13 namespace syncer { |
13 | 14 |
14 namespace syncable { | 15 namespace syncable { |
15 class BaseTransaction; | 16 class BaseTransaction; |
16 class Directory; | 17 class Directory; |
17 } | 18 } |
18 | 19 |
19 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for | 20 // Sync API's BaseTransaction, ReadTransaction, and WriteTransaction allow for |
20 // batching of several read and/or write operations. The read and write | 21 // batching of several read and/or write operations. The read and write |
21 // operations are performed by creating ReadNode and WriteNode instances using | 22 // operations are performed by creating ReadNode and WriteNode instances using |
22 // the transaction. These transaction classes wrap identically named classes in | 23 // the transaction. These transaction classes wrap identically named classes in |
23 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction, | 24 // syncable, and are used in a similar way. Unlike syncable::BaseTransaction, |
24 // whose construction requires an explicit syncable::Directory, a sync | 25 // whose construction requires an explicit syncable::Directory, a sync |
25 // API BaseTransaction is created from a UserShare object. | 26 // API BaseTransaction is created from a UserShare object. |
26 class BaseTransaction { | 27 class BaseTransaction { |
27 public: | 28 public: |
28 // Provide access to the underlying syncable objects from BaseNode. | 29 // Provide access to the underlying syncable objects from BaseNode. |
29 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; | 30 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; |
30 Cryptographer* GetCryptographer() const; | 31 Cryptographer* GetCryptographer() const; |
| 32 ModelTypeSet GetEncryptedTypes() const; |
31 | 33 |
32 syncable::Directory* GetDirectory() const { | 34 syncable::Directory* GetDirectory() const { |
33 return directory_; | 35 return directory_; |
34 } | 36 } |
35 | 37 |
36 protected: | 38 protected: |
37 explicit BaseTransaction(UserShare* share); | 39 explicit BaseTransaction(UserShare* share); |
38 virtual ~BaseTransaction(); | 40 virtual ~BaseTransaction(); |
39 | 41 |
40 BaseTransaction() : directory_(NULL) { } | 42 BaseTransaction() : directory_(NULL) { } |
41 | 43 |
42 private: | 44 private: |
43 syncable::Directory* directory_; | 45 syncable::Directory* directory_; |
44 | 46 |
45 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); | 47 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); |
46 }; | 48 }; |
47 | 49 |
48 ModelTypeSet GetEncryptedTypes(const BaseTransaction* trans); | |
49 | |
50 } // namespace syncer | 50 } // namespace syncer |
51 | 51 |
52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
OLD | NEW |