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