| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_ENGINE_MODEL_TYPE_ENTITY_H_ | 5 #ifndef SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ |
| 6 #define SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ | 6 #define SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "sync/base/sync_export.h" | 12 #include "sync/base/sync_export.h" |
| 13 #include "sync/protocol/sync.pb.h" | 13 #include "sync/protocol/sync.pb.h" |
| 14 | 14 |
| 15 namespace syncer_v2 { | 15 namespace syncer_v2 { |
| 16 struct CommitRequestData; | 16 struct CommitRequestData; |
| 17 } // namespace syncer_v2 | |
| 18 | |
| 19 namespace syncer { | |
| 20 | 17 |
| 21 // This is the model thread's representation of a SyncEntity. | 18 // This is the model thread's representation of a SyncEntity. |
| 22 // | 19 // |
| 23 // The model type entity receives updates from the model itself and | 20 // The model type entity receives updates from the model itself and |
| 24 // (asynchronously) from the sync server via the sync thread. From the point | 21 // (asynchronously) from the sync server via the sync thread. From the point |
| 25 // of view of this class, updates from the server take precedence over local | 22 // of view of this class, updates from the server take precedence over local |
| 26 // changes, though the model may be given an opportunity to overwrite this | 23 // changes, though the model may be given an opportunity to overwrite this |
| 27 // decision later. | 24 // decision later. |
| 28 // | 25 // |
| 29 // Sync will try to commit this entity's data to the sync server and local | 26 // Sync will try to commit this entity's data to the sync server and local |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // Schedule a commit if the |name| does not match this item's last known | 89 // Schedule a commit if the |name| does not match this item's last known |
| 93 // encryption key. The worker that performs the commit is expected to | 90 // encryption key. The worker that performs the commit is expected to |
| 94 // encrypt the item using the latest available key. | 91 // encrypt the item using the latest available key. |
| 95 void UpdateDesiredEncryptionKey(const std::string& name); | 92 void UpdateDesiredEncryptionKey(const std::string& name); |
| 96 | 93 |
| 97 // Applies a local deletion to this item. | 94 // Applies a local deletion to this item. |
| 98 void Delete(); | 95 void Delete(); |
| 99 | 96 |
| 100 // Initializes a message representing this item's uncommitted state | 97 // Initializes a message representing this item's uncommitted state |
| 101 // to be forwarded to the sync server for committing. | 98 // to be forwarded to the sync server for committing. |
| 102 void InitializeCommitRequestData(syncer_v2::CommitRequestData* request) const; | 99 void InitializeCommitRequestData(CommitRequestData* request) const; |
| 103 | 100 |
| 104 // Notes that the current version of this item has been queued for commit. | 101 // Notes that the current version of this item has been queued for commit. |
| 105 void SetCommitRequestInProgress(); | 102 void SetCommitRequestInProgress(); |
| 106 | 103 |
| 107 // Receives a successful commit response. | 104 // Receives a successful commit response. |
| 108 // | 105 // |
| 109 // Sucssful commit responses can overwrite an item's ID. | 106 // Sucssful commit responses can overwrite an item's ID. |
| 110 // | 107 // |
| 111 // Note that the receipt of a successful commit response does not necessarily | 108 // Note that the receipt of a successful commit response does not necessarily |
| 112 // unset IsUnsynced(). If many local changes occur in quick succession, it's | 109 // unset IsUnsynced(). If many local changes occur in quick succession, it's |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 base::Time mtime_; | 196 base::Time mtime_; |
| 200 | 197 |
| 201 // The name of the encryption key used to encrypt this item on the server. | 198 // The name of the encryption key used to encrypt this item on the server. |
| 202 // Empty when no encryption is in use. | 199 // Empty when no encryption is in use. |
| 203 std::string encryption_key_name_; | 200 std::string encryption_key_name_; |
| 204 }; | 201 }; |
| 205 | 202 |
| 206 } // namespace syncer | 203 } // namespace syncer |
| 207 | 204 |
| 208 #endif // SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ | 205 #endif // SYNC_ENGINE_MODEL_TYPE_ENTITY_H_ |
| OLD | NEW |