OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // This file defines the "sync API", an interface to the syncer | 5 // This file defines the "sync API", an interface to the syncer |
6 // backend that exposes (1) the core functionality of maintaining a consistent | 6 // backend that exposes (1) the core functionality of maintaining a consistent |
7 // local snapshot of a hierarchical object set; (2) a means to transactionally | 7 // local snapshot of a hierarchical object set; (2) a means to transactionally |
8 // access and modify those objects; (3) a means to control client/server | 8 // access and modify those objects; (3) a means to control client/server |
9 // synchronization tasks, namely: pushing local object modifications to a | 9 // synchronization tasks, namely: pushing local object modifications to a |
10 // server, pulling nonlocal object modifications from a server to this client, | 10 // server, pulling nonlocal object modifications from a server to this client, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "base/memory/scoped_ptr.h" | 48 #include "base/memory/scoped_ptr.h" |
49 #include "base/tracked.h" | 49 #include "base/tracked.h" |
50 #include "build/build_config.h" | 50 #include "build/build_config.h" |
51 #include "chrome/browser/sync/engine/configure_reason.h" | 51 #include "chrome/browser/sync/engine/configure_reason.h" |
52 #include "chrome/browser/sync/protocol/password_specifics.pb.h" | 52 #include "chrome/browser/sync/protocol/password_specifics.pb.h" |
53 #include "chrome/browser/sync/syncable/model_type.h" | 53 #include "chrome/browser/sync/syncable/model_type.h" |
54 #include "chrome/browser/sync/util/cryptographer.h" | 54 #include "chrome/browser/sync/util/cryptographer.h" |
55 #include "chrome/common/net/gaia/google_service_auth_error.h" | 55 #include "chrome/common/net/gaia/google_service_auth_error.h" |
56 #include "googleurl/src/gurl.h" | 56 #include "googleurl/src/gurl.h" |
57 | 57 |
| 58 class FilePath; |
| 59 |
| 60 namespace base { |
58 class DictionaryValue; | 61 class DictionaryValue; |
59 class FilePath; | 62 } |
60 | 63 |
61 namespace browser_sync { | 64 namespace browser_sync { |
62 class JsBackend; | 65 class JsBackend; |
63 class ModelSafeWorkerRegistrar; | 66 class ModelSafeWorkerRegistrar; |
64 | 67 |
65 namespace sessions { | 68 namespace sessions { |
66 struct SyncSessionSnapshot; | 69 struct SyncSessionSnapshot; |
67 } | 70 } |
68 } | 71 } |
69 | 72 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 // Return the ID of the first child of this node. If this node has no | 280 // Return the ID of the first child of this node. If this node has no |
278 // children, return 0. | 281 // children, return 0. |
279 virtual int64 GetFirstChildId() const; | 282 virtual int64 GetFirstChildId() const; |
280 | 283 |
281 // These virtual accessors provide access to data members of derived classes. | 284 // These virtual accessors provide access to data members of derived classes. |
282 virtual const syncable::Entry* GetEntry() const = 0; | 285 virtual const syncable::Entry* GetEntry() const = 0; |
283 virtual const BaseTransaction* GetTransaction() const = 0; | 286 virtual const BaseTransaction* GetTransaction() const = 0; |
284 | 287 |
285 // Dumps a summary of node info into a DictionaryValue and returns it. | 288 // Dumps a summary of node info into a DictionaryValue and returns it. |
286 // Transfers ownership of the DictionaryValue to the caller. | 289 // Transfers ownership of the DictionaryValue to the caller. |
287 DictionaryValue* GetSummaryAsValue() const; | 290 base::DictionaryValue* GetSummaryAsValue() const; |
288 | 291 |
289 // Dumps all node details into a DictionaryValue and returns it. | 292 // Dumps all node details into a DictionaryValue and returns it. |
290 // Transfers ownership of the DictionaryValue to the caller. | 293 // Transfers ownership of the DictionaryValue to the caller. |
291 DictionaryValue* GetDetailsAsValue() const; | 294 base::DictionaryValue* GetDetailsAsValue() const; |
292 | 295 |
293 protected: | 296 protected: |
294 BaseNode(); | 297 BaseNode(); |
295 virtual ~BaseNode(); | 298 virtual ~BaseNode(); |
296 // The server has a size limit on client tags, so we generate a fixed length | 299 // The server has a size limit on client tags, so we generate a fixed length |
297 // hash locally. This also ensures that ModelTypes have unique namespaces. | 300 // hash locally. This also ensures that ModelTypes have unique namespaces. |
298 static std::string GenerateSyncableHash(syncable::ModelType model_type, | 301 static std::string GenerateSyncableHash(syncable::ModelType model_type, |
299 const std::string& client_tag); | 302 const std::string& client_tag); |
300 | 303 |
301 // Determines whether part of the entry is encrypted, and if so attempts to | 304 // Determines whether part of the entry is encrypted, and if so attempts to |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // TODO(zea): One day get passwords playing nicely with the rest of encryption | 628 // TODO(zea): One day get passwords playing nicely with the rest of encryption |
626 // and get rid of this. | 629 // and get rid of this. |
627 class ExtraPasswordChangeRecordData { | 630 class ExtraPasswordChangeRecordData { |
628 public: | 631 public: |
629 ExtraPasswordChangeRecordData(); | 632 ExtraPasswordChangeRecordData(); |
630 explicit ExtraPasswordChangeRecordData( | 633 explicit ExtraPasswordChangeRecordData( |
631 const sync_pb::PasswordSpecificsData& data); | 634 const sync_pb::PasswordSpecificsData& data); |
632 virtual ~ExtraPasswordChangeRecordData(); | 635 virtual ~ExtraPasswordChangeRecordData(); |
633 | 636 |
634 // Transfers ownership of the DictionaryValue to the caller. | 637 // Transfers ownership of the DictionaryValue to the caller. |
635 virtual DictionaryValue* ToValue() const; | 638 virtual base::DictionaryValue* ToValue() const; |
636 | 639 |
637 const sync_pb::PasswordSpecificsData& unencrypted() const; | 640 const sync_pb::PasswordSpecificsData& unencrypted() const; |
638 private: | 641 private: |
639 sync_pb::PasswordSpecificsData unencrypted_; | 642 sync_pb::PasswordSpecificsData unencrypted_; |
640 }; | 643 }; |
641 | 644 |
642 // ChangeRecord indicates a single item that changed as a result of a sync | 645 // ChangeRecord indicates a single item that changed as a result of a sync |
643 // operation. This gives the sync id of the node that changed, and the type | 646 // operation. This gives the sync id of the node that changed, and the type |
644 // of change. To get the actual property values after an ADD or UPDATE, the | 647 // of change. To get the actual property values after an ADD or UPDATE, the |
645 // client should get the node with InitByIdLookup(), using the provided id. | 648 // client should get the node with InitByIdLookup(), using the provided id. |
646 struct ChangeRecord { | 649 struct ChangeRecord { |
647 enum Action { | 650 enum Action { |
648 ACTION_ADD, | 651 ACTION_ADD, |
649 ACTION_DELETE, | 652 ACTION_DELETE, |
650 ACTION_UPDATE, | 653 ACTION_UPDATE, |
651 }; | 654 }; |
652 ChangeRecord(); | 655 ChangeRecord(); |
653 ~ChangeRecord(); | 656 ~ChangeRecord(); |
654 | 657 |
655 // Transfers ownership of the DictionaryValue to the caller. | 658 // Transfers ownership of the DictionaryValue to the caller. |
656 DictionaryValue* ToValue(const BaseTransaction* trans) const; | 659 base::DictionaryValue* ToValue(const BaseTransaction* trans) const; |
657 | 660 |
658 int64 id; | 661 int64 id; |
659 Action action; | 662 Action action; |
660 sync_pb::EntitySpecifics specifics; | 663 sync_pb::EntitySpecifics specifics; |
661 linked_ptr<ExtraPasswordChangeRecordData> extra; | 664 linked_ptr<ExtraPasswordChangeRecordData> extra; |
662 }; | 665 }; |
663 | 666 |
664 // Status encapsulates detailed state about the internals of the SyncManager. | 667 // Status encapsulates detailed state about the internals of the SyncManager. |
665 struct Status { | 668 struct Status { |
666 // Summary is a distilled set of important information that the end-user may | 669 // Summary is a distilled set of important information that the end-user may |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 private: | 1065 private: |
1063 // An opaque pointer to the nested private class. | 1066 // An opaque pointer to the nested private class. |
1064 SyncInternal* data_; | 1067 SyncInternal* data_; |
1065 | 1068 |
1066 DISALLOW_COPY_AND_ASSIGN(SyncManager); | 1069 DISALLOW_COPY_AND_ASSIGN(SyncManager); |
1067 }; | 1070 }; |
1068 | 1071 |
1069 } // namespace sync_api | 1072 } // namespace sync_api |
1070 | 1073 |
1071 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ | 1074 #endif // CHROME_BROWSER_SYNC_ENGINE_SYNCAPI_H_ |
OLD | NEW |