| 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 #include "sync/engine/download_updates_command.h" | 5 #include "sync/engine/download_updates_command.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "sync/engine/syncer.h" | 10 #include "sync/engine/syncer.h" |
| 11 #include "sync/engine/syncer_proto_util.h" | 11 #include "sync/engine/syncer_proto_util.h" |
| 12 #include "sync/internal_api/public/base/model_type_payload_map.h" | 12 #include "sync/internal_api/public/base/model_type_state_map.h" |
| 13 #include "sync/syncable/directory.h" | 13 #include "sync/syncable/directory.h" |
| 14 #include "sync/syncable/read_transaction.h" | 14 #include "sync/syncable/read_transaction.h" |
| 15 | 15 |
| 16 using sync_pb::DebugInfo; | 16 using sync_pb::DebugInfo; |
| 17 | 17 |
| 18 namespace syncer { | 18 namespace syncer { |
| 19 using sessions::StatusController; | 19 using sessions::StatusController; |
| 20 using sessions::SyncSession; | 20 using sessions::SyncSession; |
| 21 using std::string; | 21 using std::string; |
| 22 | 22 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 syncable::Directory* dir = session->context()->directory(); | 65 syncable::Directory* dir = session->context()->directory(); |
| 66 | 66 |
| 67 // Request updates for all enabled types. | 67 // Request updates for all enabled types. |
| 68 const ModelTypeSet enabled_types = | 68 const ModelTypeSet enabled_types = |
| 69 GetRoutingInfoTypes(session->routing_info()); | 69 GetRoutingInfoTypes(session->routing_info()); |
| 70 DVLOG(1) << "Getting updates for types " | 70 DVLOG(1) << "Getting updates for types " |
| 71 << ModelTypeSetToString(enabled_types); | 71 << ModelTypeSetToString(enabled_types); |
| 72 DCHECK(!enabled_types.Empty()); | 72 DCHECK(!enabled_types.Empty()); |
| 73 | 73 |
| 74 const ModelTypePayloadMap& type_payload_map = session->source().types; | 74 const ModelTypeStateMap& type_state_map = session->source().types; |
| 75 for (ModelTypeSet::Iterator it = enabled_types.First(); | 75 for (ModelTypeSet::Iterator it = enabled_types.First(); |
| 76 it.Good(); it.Inc()) { | 76 it.Good(); it.Inc()) { |
| 77 sync_pb::DataTypeProgressMarker* progress_marker = | 77 sync_pb::DataTypeProgressMarker* progress_marker = |
| 78 get_updates->add_from_progress_marker(); | 78 get_updates->add_from_progress_marker(); |
| 79 dir->GetDownloadProgress(it.Get(), progress_marker); | 79 dir->GetDownloadProgress(it.Get(), progress_marker); |
| 80 | 80 |
| 81 // Set notification hint if present. | 81 // Set notification hint if present. |
| 82 ModelTypePayloadMap::const_iterator type_payload = | 82 ModelTypeStateMap::const_iterator type_state = |
| 83 type_payload_map.find(it.Get()); | 83 type_state_map.find(it.Get()); |
| 84 if (type_payload != type_payload_map.end()) { | 84 if (type_state != type_state_map.end()) { |
| 85 progress_marker->set_notification_hint(type_payload->second); | 85 progress_marker->set_notification_hint(type_state->second.payload); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool need_encryption_key = false; | 89 bool need_encryption_key = false; |
| 90 if (session->context()->keystore_encryption_enabled()) { | 90 if (session->context()->keystore_encryption_enabled()) { |
| 91 syncable::Directory* dir = session->context()->directory(); | 91 syncable::Directory* dir = session->context()->directory(); |
| 92 syncable::ReadTransaction trans(FROM_HERE, dir); | 92 syncable::ReadTransaction trans(FROM_HERE, dir); |
| 93 Cryptographer* cryptographer = | 93 Cryptographer* cryptographer = |
| 94 session->context()->directory()->GetCryptographer(&trans); | 94 session->context()->directory()->GetCryptographer(&trans); |
| 95 need_encryption_key = !cryptographer->HasKeystoreKey(); | 95 need_encryption_key = !cryptographer->HasKeystoreKey(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 // could be null in some unit tests. | 157 // could be null in some unit tests. |
| 158 if (session->context()->debug_info_getter()) { | 158 if (session->context()->debug_info_getter()) { |
| 159 session->context()->debug_info_getter()->GetAndClearDebugInfo( | 159 session->context()->debug_info_getter()->GetAndClearDebugInfo( |
| 160 debug_info); | 160 debug_info); |
| 161 } | 161 } |
| 162 session->mutable_status_controller()->set_debug_info_sent(); | 162 session->mutable_status_controller()->set_debug_info_sent(); |
| 163 } | 163 } |
| 164 } | 164 } |
| 165 | 165 |
| 166 } // namespace syncer | 166 } // namespace syncer |
| OLD | NEW |