| 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/data_type_manager_impl.h" | 5 #include "components/sync_driver/data_type_manager_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/debug/trace_event.h" | 14 #include "base/debug/trace_event.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
| 17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
| 18 #include "components/sync_driver/data_type_controller.h" | 18 #include "components/sync_driver/data_type_controller.h" |
| 19 #include "components/sync_driver/data_type_encryption_handler.h" | 19 #include "components/sync_driver/data_type_encryption_handler.h" |
| 20 #include "components/sync_driver/data_type_manager_observer.h" | 20 #include "components/sync_driver/data_type_manager_observer.h" |
| 21 #include "components/sync_driver/failed_data_types_handler.h" | 21 #include "components/sync_driver/failed_data_types_handler.h" |
| 22 #include "sync/internal_api/public/data_type_debug_info_listener.h" | 22 #include "sync/internal_api/public/data_type_debug_info_listener.h" |
| 23 | 23 |
| 24 namespace browser_sync { | 24 namespace sync_driver { |
| 25 | 25 |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 FailedDataTypesHandler::TypeErrorMap | 28 FailedDataTypesHandler::TypeErrorMap |
| 29 GenerateCryptoErrorsForTypes(syncer::ModelTypeSet encrypted_types) { | 29 GenerateCryptoErrorsForTypes(syncer::ModelTypeSet encrypted_types) { |
| 30 FailedDataTypesHandler::TypeErrorMap crypto_errors; | 30 FailedDataTypesHandler::TypeErrorMap crypto_errors; |
| 31 for (syncer::ModelTypeSet::Iterator iter = encrypted_types.First(); | 31 for (syncer::ModelTypeSet::Iterator iter = encrypted_types.First(); |
| 32 iter.Good(); iter.Inc()) { | 32 iter.Good(); iter.Inc()) { |
| 33 crypto_errors[iter.Get()] = syncer::SyncError( | 33 crypto_errors[iter.Get()] = syncer::SyncError( |
| 34 FROM_HERE, | 34 FROM_HERE, |
| 35 syncer::SyncError::CRYPTO_ERROR, | 35 syncer::SyncError::CRYPTO_ERROR, |
| 36 "", | 36 "", |
| 37 iter.Get()); | 37 iter.Get()); |
| 38 } | 38 } |
| 39 return crypto_errors; | 39 return crypto_errors; |
| 40 } | 40 } |
| 41 | 41 |
| 42 } // namespace | 42 } // namespace |
| 43 | 43 |
| 44 DataTypeManagerImpl::AssociationTypesInfo::AssociationTypesInfo() {} | 44 DataTypeManagerImpl::AssociationTypesInfo::AssociationTypesInfo() {} |
| 45 DataTypeManagerImpl::AssociationTypesInfo::~AssociationTypesInfo() {} | 45 DataTypeManagerImpl::AssociationTypesInfo::~AssociationTypesInfo() {} |
| 46 | 46 |
| 47 DataTypeManagerImpl::DataTypeManagerImpl( | 47 DataTypeManagerImpl::DataTypeManagerImpl( |
| 48 const base::Closure& unrecoverable_error_method, | 48 const base::Closure& unrecoverable_error_method, |
| 49 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& | 49 const syncer::WeakHandle<syncer::DataTypeDebugInfoListener>& |
| 50 debug_info_listener, | 50 debug_info_listener, |
| 51 const DataTypeController::TypeMap* controllers, | 51 const DataTypeController::TypeMap* controllers, |
| 52 const browser_sync::DataTypeEncryptionHandler* encryption_handler, | 52 const DataTypeEncryptionHandler* encryption_handler, |
| 53 BackendDataTypeConfigurer* configurer, | 53 BackendDataTypeConfigurer* configurer, |
| 54 DataTypeManagerObserver* observer, | 54 DataTypeManagerObserver* observer, |
| 55 browser_sync::FailedDataTypesHandler* failed_data_types_handler) | 55 FailedDataTypesHandler* failed_data_types_handler) |
| 56 : configurer_(configurer), | 56 : configurer_(configurer), |
| 57 controllers_(controllers), | 57 controllers_(controllers), |
| 58 state_(DataTypeManager::STOPPED), | 58 state_(DataTypeManager::STOPPED), |
| 59 needs_reconfigure_(false), | 59 needs_reconfigure_(false), |
| 60 last_configure_reason_(syncer::CONFIGURE_REASON_UNKNOWN), | 60 last_configure_reason_(syncer::CONFIGURE_REASON_UNKNOWN), |
| 61 debug_info_listener_(debug_info_listener), | 61 debug_info_listener_(debug_info_listener), |
| 62 model_association_manager_(controllers, this), | 62 model_association_manager_(controllers, this), |
| 63 observer_(observer), | 63 observer_(observer), |
| 64 failed_data_types_handler_(failed_data_types_handler), | 64 failed_data_types_handler_(failed_data_types_handler), |
| 65 encryption_handler_(encryption_handler), | 65 encryption_handler_(encryption_handler), |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 | 607 |
| 608 DataTypeManager::State DataTypeManagerImpl::state() const { | 608 DataTypeManager::State DataTypeManagerImpl::state() const { |
| 609 return state_; | 609 return state_; |
| 610 } | 610 } |
| 611 | 611 |
| 612 void DataTypeManagerImpl::AddToConfigureTime() { | 612 void DataTypeManagerImpl::AddToConfigureTime() { |
| 613 DCHECK(!last_restart_time_.is_null()); | 613 DCHECK(!last_restart_time_.is_null()); |
| 614 configure_time_delta_ += (base::Time::Now() - last_restart_time_); | 614 configure_time_delta_ += (base::Time::Now() - last_restart_time_); |
| 615 } | 615 } |
| 616 | 616 |
| 617 } // namespace browser_sync | 617 } // namespace sync_driver |
| OLD | NEW |