Chromium Code Reviews| 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/internal_api/public/base/model_type.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 // whose construction requires an explicit syncable::Directory, a sync | 25 // whose construction requires an explicit syncable::Directory, a sync |
| 26 // API BaseTransaction is created from a UserShare object. | 26 // API BaseTransaction is created from a UserShare object. |
| 27 class BaseTransaction { | 27 class BaseTransaction { |
| 28 public: | 28 public: |
| 29 // Provide access to the underlying syncable objects from BaseNode. | 29 // Provide access to the underlying syncable objects from BaseNode. |
| 30 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; | 30 virtual syncable::BaseTransaction* GetWrappedTrans() const = 0; |
| 31 Cryptographer* GetCryptographer() const; | 31 Cryptographer* GetCryptographer() const; |
| 32 ModelTypeSet GetEncryptedTypes() const; | 32 ModelTypeSet GetEncryptedTypes() const; |
| 33 | 33 |
| 34 syncable::Directory* GetDirectory() const { | 34 syncable::Directory* GetDirectory() const { |
| 35 return directory_; | 35 if (!user_share_) { |
|
Nicolas Zea
2012/11/16 19:42:27
remove curly braces?
rlarocque
2012/11/17 00:07:21
I'd prefer not to. I believe the style guide does
| |
| 36 return NULL; | |
| 37 } else { | |
| 38 return user_share_->directory.get(); | |
| 39 } | |
| 40 } | |
| 41 | |
| 42 UserShare* GetUserShare() const { | |
| 43 return user_share_; | |
| 36 } | 44 } |
| 37 | 45 |
| 38 protected: | 46 protected: |
| 39 explicit BaseTransaction(UserShare* share); | 47 explicit BaseTransaction(UserShare* share); |
| 40 virtual ~BaseTransaction(); | 48 virtual ~BaseTransaction(); |
| 41 | 49 |
| 42 BaseTransaction() : directory_(NULL) { } | 50 BaseTransaction() : user_share_(NULL) { } |
| 43 | 51 |
| 44 private: | 52 private: |
| 45 syncable::Directory* directory_; | 53 UserShare* user_share_; |
| 46 | 54 |
| 47 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); | 55 DISALLOW_COPY_AND_ASSIGN(BaseTransaction); |
| 48 }; | 56 }; |
| 49 | 57 |
| 50 } // namespace syncer | 58 } // namespace syncer |
| 51 | 59 |
| 52 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ | 60 #endif // SYNC_INTERNAL_API_PUBLIC_BASE_TRANSACTION_H_ |
| OLD | NEW |