| OLD | NEW | 
|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_SYNCABLE_NIGORI_HANDLER_H_ | 5 #ifndef COMPONENTS_SYNC_SYNCABLE_NIGORI_HANDLER_H_ | 
| 6 #define SYNC_SYNCABLE_NIGORI_HANDLER_H_ | 6 #define COMPONENTS_SYNC_SYNCABLE_NIGORI_HANDLER_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 | 9 | 
| 10 #include "sync/base/sync_export.h" | 10 #include "components/sync/base/model_type.h" | 
| 11 #include "sync/internal_api/public/base/model_type.h" | 11 #include "components/sync/base/sync_export.h" | 
| 12 | 12 | 
| 13 namespace google { | 13 namespace google { | 
| 14 namespace protobuf { | 14 namespace protobuf { | 
| 15 template <typename T> | 15 template <typename T> | 
| 16 class RepeatedPtrField; | 16 class RepeatedPtrField; | 
| 17 } | 17 } | 
| 18 } | 18 } | 
| 19 | 19 | 
| 20 namespace sync_pb { | 20 namespace sync_pb { | 
| 21 class NigoriSpecifics; | 21 class NigoriSpecifics; | 
| 22 } | 22 } | 
| 23 | 23 | 
| 24 namespace syncer { | 24 namespace syncer { | 
| 25 namespace syncable { | 25 namespace syncable { | 
| 26 | 26 | 
| 27 class BaseTransaction; | 27 class BaseTransaction; | 
| 28 | 28 | 
| 29 // Sync internal interface for dealing with nigori node and querying | 29 // Sync internal interface for dealing with nigori node and querying | 
| 30 // the current set of encrypted types. Not thread safe, so a sync transaction | 30 // the current set of encrypted types. Not thread safe, so a sync transaction | 
| 31 // must be held by a caller whenever invoking methods. | 31 // must be held by a caller whenever invoking methods. | 
| 32 class SYNC_EXPORT NigoriHandler { | 32 class SYNC_EXPORT NigoriHandler { | 
| 33  public: | 33  public: | 
| 34   NigoriHandler(); | 34   NigoriHandler(); | 
| 35   virtual ~NigoriHandler(); | 35   virtual ~NigoriHandler(); | 
| 36 | 36 | 
| 37   // Apply a nigori node update, updating the internal encryption state | 37   // Apply a nigori node update, updating the internal encryption state | 
| 38   // accordingly. | 38   // accordingly. | 
| 39   virtual void ApplyNigoriUpdate( | 39   virtual void ApplyNigoriUpdate(const sync_pb::NigoriSpecifics& nigori, | 
| 40       const sync_pb::NigoriSpecifics& nigori, | 40                                  syncable::BaseTransaction* const trans) = 0; | 
| 41       syncable::BaseTransaction* const trans) = 0; |  | 
| 42 | 41 | 
| 43   // Store the current encrypt everything/encrypted types state into |nigori|. | 42   // Store the current encrypt everything/encrypted types state into |nigori|. | 
| 44   virtual void UpdateNigoriFromEncryptedTypes( | 43   virtual void UpdateNigoriFromEncryptedTypes( | 
| 45       sync_pb::NigoriSpecifics* nigori, | 44       sync_pb::NigoriSpecifics* nigori, | 
| 46       syncable::BaseTransaction* const trans) const = 0; | 45       syncable::BaseTransaction* const trans) const = 0; | 
| 47 | 46 | 
| 48   // Whether a keystore key needs to be requested from the sync server. | 47   // Whether a keystore key needs to be requested from the sync server. | 
| 49   virtual bool NeedKeystoreKey( | 48   virtual bool NeedKeystoreKey( | 
| 50       syncable::BaseTransaction* const trans) const = 0; | 49       syncable::BaseTransaction* const trans) const = 0; | 
| 51 | 50 | 
| 52   // Set the keystore keys the server returned for this account. | 51   // Set the keystore keys the server returned for this account. | 
| 53   // Returns true on success, false otherwise. | 52   // Returns true on success, false otherwise. | 
| 54   virtual bool SetKeystoreKeys( | 53   virtual bool SetKeystoreKeys( | 
| 55       const google::protobuf::RepeatedPtrField<std::string>& keys, | 54       const google::protobuf::RepeatedPtrField<std::string>& keys, | 
| 56       syncable::BaseTransaction* const trans) = 0; | 55       syncable::BaseTransaction* const trans) = 0; | 
| 57 | 56 | 
| 58   // Returns the set of currently encrypted types. | 57   // Returns the set of currently encrypted types. | 
| 59   virtual ModelTypeSet GetEncryptedTypes( | 58   virtual ModelTypeSet GetEncryptedTypes( | 
| 60       syncable::BaseTransaction* const trans) const = 0; | 59       syncable::BaseTransaction* const trans) const = 0; | 
| 61 }; | 60 }; | 
| 62 | 61 | 
| 63 }  // namespace syncable | 62 }  // namespace syncable | 
| 64 }  // namespace syncer | 63 }  // namespace syncer | 
| 65 | 64 | 
| 66 #endif  // SYNC_SYNCABLE_NIGORI_HANDLER_H_ | 65 #endif  // COMPONENTS_SYNC_SYNCABLE_NIGORI_HANDLER_H_ | 
| OLD | NEW | 
|---|