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 #include "components/sync/driver/generic_change_processor.h" | 5 #include "components/sync/driver/generic_change_processor.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <string> | 10 #include <string> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/threading/thread_task_runner_handle.h" | 16 #include "base/threading/thread_task_runner_handle.h" |
17 #include "components/sync/api/sync_change.h" | 17 #include "components/sync/api/sync_change.h" |
18 #include "components/sync/api/sync_error.h" | 18 #include "components/sync/api/sync_error.h" |
19 #include "components/sync/api/syncable_service.h" | 19 #include "components/sync/api/syncable_service.h" |
| 20 #include "components/sync/base/passphrase_type.h" |
20 #include "components/sync/base/unrecoverable_error_handler.h" | 21 #include "components/sync/base/unrecoverable_error_handler.h" |
21 #include "components/sync/core/base_node.h" | 22 #include "components/sync/core/base_node.h" |
22 #include "components/sync/core/change_record.h" | 23 #include "components/sync/core/change_record.h" |
23 #include "components/sync/core/data_type_error_handler.h" | 24 #include "components/sync/core/data_type_error_handler.h" |
24 #include "components/sync/core/read_node.h" | 25 #include "components/sync/core/read_node.h" |
25 #include "components/sync/core/read_transaction.h" | 26 #include "components/sync/core/read_transaction.h" |
26 #include "components/sync/core/write_node.h" | 27 #include "components/sync/core/write_node.h" |
27 #include "components/sync/core/write_transaction.h" | 28 #include "components/sync/core/write_transaction.h" |
28 #include "components/sync/driver/sync_api_component_factory.h" | 29 #include "components/sync/driver/sync_api_component_factory.h" |
29 #include "components/sync/driver/sync_client.h" | 30 #include "components/sync/driver/sync_client.h" |
30 #include "components/sync/syncable/entry.h" // TODO(tim): Bug 123674. | 31 #include "components/sync/syncable/entry.h" // TODO(tim): Bug 123674. |
31 | 32 |
32 namespace sync_driver { | 33 namespace sync_driver { |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
36 const int kContextSizeLimit = 1024; // Datatype context size limit. | 37 const int kContextSizeLimit = 1024; // Datatype context size limit. |
37 | 38 |
38 void SetNodeSpecifics(const sync_pb::EntitySpecifics& entity_specifics, | 39 void SetNodeSpecifics(const sync_pb::EntitySpecifics& entity_specifics, |
39 syncer::WriteNode* write_node) { | 40 syncer::WriteNode* write_node) { |
40 if (syncer::GetModelTypeFromSpecifics(entity_specifics) == | 41 if (syncer::GetModelTypeFromSpecifics(entity_specifics) == |
41 syncer::PASSWORDS) { | 42 syncer::PASSWORDS) { |
42 write_node->SetPasswordSpecifics( | 43 write_node->SetPasswordSpecifics( |
43 entity_specifics.password().client_only_encrypted_data()); | 44 entity_specifics.password().client_only_encrypted_data(), |
| 45 // TODO(melandory): Since PasswordsSpecifics care about passphrase type. |
| 46 // the real value should be passed here. |
| 47 syncer::PassphraseType::UNDEFINED); |
44 } else { | 48 } else { |
45 write_node->SetEntitySpecifics(entity_specifics); | 49 write_node->SetEntitySpecifics(entity_specifics); |
46 } | 50 } |
47 } | 51 } |
48 | 52 |
49 // Helper function to convert AttachmentId to AttachmentMetadataRecord. | 53 // Helper function to convert AttachmentId to AttachmentMetadataRecord. |
50 sync_pb::AttachmentMetadataRecord AttachmentIdToRecord( | 54 sync_pb::AttachmentMetadataRecord AttachmentIdToRecord( |
51 const syncer::AttachmentId& attachment_id) { | 55 const syncer::AttachmentId& attachment_id) { |
52 sync_pb::AttachmentMetadataRecord record; | 56 sync_pb::AttachmentMetadataRecord record; |
53 *record.mutable_id() = attachment_id.GetProto(); | 57 *record.mutable_id() = attachment_id.GetProto(); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 } | 687 } |
684 } | 688 } |
685 | 689 |
686 std::unique_ptr<syncer::AttachmentService> | 690 std::unique_ptr<syncer::AttachmentService> |
687 GenericChangeProcessor::GetAttachmentService() const { | 691 GenericChangeProcessor::GetAttachmentService() const { |
688 return std::unique_ptr<syncer::AttachmentService>( | 692 return std::unique_ptr<syncer::AttachmentService>( |
689 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); | 693 new syncer::AttachmentServiceProxy(attachment_service_proxy_)); |
690 } | 694 } |
691 | 695 |
692 } // namespace sync_driver | 696 } // namespace sync_driver |
OLD | NEW |