diff options
73 files changed, 356 insertions, 176 deletions
diff --git a/chrome/browser/sync/backend_migrator.h b/chrome/browser/sync/backend_migrator.h index 9503440..a2303ce 100644 --- a/chrome/browser/sync/backend_migrator.h +++ b/chrome/browser/sync/backend_migrator.h @@ -8,7 +8,7 @@ #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" #include "base/observer_list.h" -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" #include "sync/internal_api/public/base/model_type.h" diff --git a/chrome/browser/sync/backend_migrator_unittest.cc b/chrome/browser/sync/backend_migrator_unittest.cc index f261756..84f614d 100644 --- a/chrome/browser/sync/backend_migrator_unittest.cc +++ b/chrome/browser/sync/backend_migrator_unittest.cc @@ -7,8 +7,8 @@ #include "base/message_loop/message_loop.h" #include "base/tracked_objects.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/sync/glue/data_type_manager_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" +#include "components/sync_driver/data_type_manager_mock.h" #include "sync/internal_api/public/base/model_type_test_util.h" #include "sync/internal_api/public/test/test_user_share.h" #include "sync/internal_api/public/write_transaction.h" diff --git a/chrome/browser/sync/backend_unrecoverable_error_handler.cc b/chrome/browser/sync/backend_unrecoverable_error_handler.cc index 4e9f321..1eeaec6 100644 --- a/chrome/browser/sync/backend_unrecoverable_error_handler.cc +++ b/chrome/browser/sync/backend_unrecoverable_error_handler.cc @@ -6,6 +6,7 @@ #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "content/public/browser/browser_thread.h" using content::BrowserThread; diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.cc b/chrome/browser/sync/glue/autofill_data_type_controller.cc index d2c0090..66c575d 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller.cc @@ -7,6 +7,7 @@ #include "base/bind.h" #include "base/metrics/histogram.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -26,7 +27,11 @@ AutofillDataTypeController::AutofillDataTypeController( Profile* profile, ProfileSyncService* sync_service) : NonUIDataTypeController( - profile_sync_factory, profile, sync_service) { + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service) { } syncer::ModelType AutofillDataTypeController::type() const { diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index c048699..479b4879 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -10,7 +10,6 @@ #include "base/run_loop.h" #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/sync/glue/autofill_data_type_controller.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/shared_change_processor_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -18,7 +17,9 @@ #include "chrome/browser/webdata/autocomplete_syncable_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "components/webdata/common/web_data_service_test_util.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" diff --git a/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc b/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc index b135e51..45be769 100644 --- a/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc +++ b/chrome/browser/sync/glue/autofill_profile_data_type_controller.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram.h" #include "chrome/browser/autofill/personal_data_manager_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/webdata/web_data_service_factory.h" @@ -26,9 +27,12 @@ AutofillProfileDataTypeController::AutofillProfileDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : NonUIDataTypeController(profile_sync_factory, - profile, - sync_service), + : NonUIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service), personal_data_(NULL), callback_registered_(false) {} diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller.cc b/chrome/browser/sync/glue/bookmark_data_type_controller.cc index 1ed2066..5e75e58 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller.cc @@ -11,6 +11,7 @@ #include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" #include "content/public/browser/browser_thread.h" @@ -25,9 +26,12 @@ BookmarkDataTypeController::BookmarkDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : FrontendDataTypeController(profile_sync_factory, - profile, - sync_service), + : FrontendDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service), bookmark_model_(NULL), installed_bookmark_observer_(false) { } diff --git a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc index 75ae26f..7898980 100644 --- a/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/bookmark_data_type_controller_unittest.cc @@ -18,11 +18,11 @@ #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/glue/change_processor_mock.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" #include "components/browser_context_keyed_service/refcounted_browser_context_keyed_service.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "components/sync_driver/model_associator_mock.h" #include "content/public/browser/notification_service.h" #include "content/public/test/test_browser_thread.h" diff --git a/chrome/browser/sync/glue/bookmark_model_associator.h b/chrome/browser/sync/glue/bookmark_model_associator.h index 50f3afc..368f8a6 100644 --- a/chrome/browser/sync/glue/bookmark_model_associator.h +++ b/chrome/browser/sync/glue/bookmark_model_associator.h @@ -12,7 +12,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" #include "components/sync_driver/model_associator.h" #include "sync/internal_api/public/util/unrecoverable_error_handler.h" diff --git a/chrome/browser/sync/glue/data_type_error_handler_mock.h b/chrome/browser/sync/glue/data_type_error_handler_mock.h index 0f3e00d..b5c6580 100644 --- a/chrome/browser/sync/glue/data_type_error_handler_mock.h +++ b/chrome/browser/sync/glue/data_type_error_handler_mock.h @@ -4,7 +4,7 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_ERROR_HANDLER_MOCK_H__ #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_ERROR_HANDLER_MOCK_H__ -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "testing/gmock/include/gmock/gmock.h" #include "sync/internal_api/public/base/model_type.h" diff --git a/chrome/browser/sync/glue/data_type_manager_impl.cc b/chrome/browser/sync/glue/data_type_manager_impl.cc index 7a184e4..1684a45 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl.cc @@ -17,9 +17,9 @@ #include "base/metrics/histogram.h" #include "base/strings/stringprintf.h" #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/data_type_manager_observer.h" #include "chrome/browser/sync/glue/failed_data_types_handler.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_encryption_handler.h" #include "content/public/browser/browser_thread.h" #include "sync/internal_api/public/data_type_debug_info_listener.h" diff --git a/chrome/browser/sync/glue/data_type_manager_impl.h b/chrome/browser/sync/glue/data_type_manager_impl.h index a901793..48ed059 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl.h +++ b/chrome/browser/sync/glue/data_type_manager_impl.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_IMPL_H__ #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_IMPL_H__ -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" #include <map> #include <queue> diff --git a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc index ec5e821..a05b288 100644 --- a/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc +++ b/chrome/browser/sync/glue/data_type_manager_impl_unittest.cc @@ -7,12 +7,12 @@ #include "base/compiler_specific.h" #include "base/message_loop/message_loop.h" #include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/data_type_manager_observer.h" #include "chrome/browser/sync/glue/failed_data_types_handler.h" -#include "chrome/browser/sync/glue/fake_data_type_controller.h" #include "components/sync_driver/backend_data_type_configurer.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_encryption_handler.h" +#include "components/sync_driver/fake_data_type_controller.h" #include "content/public/test/test_browser_thread.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/configure_reason.h" diff --git a/chrome/browser/sync/glue/data_type_manager_observer.h b/chrome/browser/sync/glue/data_type_manager_observer.h index f67efd9..0e81a1a 100644 --- a/chrome/browser/sync/glue/data_type_manager_observer.h +++ b/chrome/browser/sync/glue/data_type_manager_observer.h @@ -5,7 +5,7 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_OBSERVER_H_ #define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_OBSERVER_H_ -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/extension_data_type_controller.cc b/chrome/browser/sync/glue/extension_data_type_controller.cc index 72428fd..5b5e2db 100644 --- a/chrome/browser/sync/glue/extension_data_type_controller.cc +++ b/chrome/browser/sync/glue/extension_data_type_controller.cc @@ -6,9 +6,13 @@ #include "base/metrics/histogram.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/profile_sync_components_factory.h" +#include "content/public/browser/browser_thread.h" #include "extensions/browser/extension_system.h" +using content::BrowserThread; + namespace browser_sync { ExtensionDataTypeController::ExtensionDataTypeController( @@ -16,10 +20,13 @@ ExtensionDataTypeController::ExtensionDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : UIDataTypeController(type, - profile_sync_factory, - profile, - sync_service) { + : UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + type, + profile_sync_factory, + profile, + sync_service) { DCHECK(type == syncer::EXTENSIONS || type == syncer::APPS); } diff --git a/chrome/browser/sync/glue/extension_setting_data_type_controller.cc b/chrome/browser/sync/glue/extension_setting_data_type_controller.cc index 8d968cc..4fb8058 100644 --- a/chrome/browser/sync/glue/extension_setting_data_type_controller.cc +++ b/chrome/browser/sync/glue/extension_setting_data_type_controller.cc @@ -8,6 +8,7 @@ #include "base/metrics/histogram.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/generic_change_processor.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "content/public/browser/browser_thread.h" @@ -23,9 +24,12 @@ ExtensionSettingDataTypeController::ExtensionSettingDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* profile_sync_service) - : NonUIDataTypeController(profile_sync_factory, - profile, - profile_sync_service), + : NonUIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + profile_sync_service), type_(type), profile_(profile), profile_sync_service_(profile_sync_service) { diff --git a/chrome/browser/sync/glue/failed_data_types_handler.cc b/chrome/browser/sync/glue/failed_data_types_handler.cc index ada738c..977e515 100644 --- a/chrome/browser/sync/glue/failed_data_types_handler.cc +++ b/chrome/browser/sync/glue/failed_data_types_handler.cc @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/glue/data_type_manager.h" #include "chrome/browser/sync/glue/failed_data_types_handler.h" +#include "components/sync_driver/data_type_manager.h" using browser_sync::DataTypeManager; diff --git a/chrome/browser/sync/glue/failed_data_types_handler.h b/chrome/browser/sync/glue/failed_data_types_handler.h index 0b86fd8..63a2baa 100644 --- a/chrome/browser/sync/glue/failed_data_types_handler.h +++ b/chrome/browser/sync/glue/failed_data_types_handler.h @@ -7,7 +7,7 @@ #include <string> -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/frontend_data_type_controller.cc b/chrome/browser/sync/glue/frontend_data_type_controller.cc index dbc7dee..b49ca99 100644 --- a/chrome/browser/sync/glue/frontend_data_type_controller.cc +++ b/chrome/browser/sync/glue/frontend_data_type_controller.cc @@ -21,10 +21,13 @@ using content::BrowserThread; namespace browser_sync { FrontendDataTypeController::FrontendDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : profile_sync_factory_(profile_sync_factory), + : DataTypeController(ui_thread, error_callback), + profile_sync_factory_(profile_sync_factory), profile_(profile), sync_service_(sync_service), state_(NOT_RUNNING) { @@ -144,7 +147,8 @@ void FrontendDataTypeController::OnSingleDatatypeUnrecoverableError( } FrontendDataTypeController::FrontendDataTypeController() - : profile_sync_factory_(NULL), + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()), + profile_sync_factory_(NULL), profile_(NULL), sync_service_(NULL), state_(NOT_RUNNING) { diff --git a/chrome/browser/sync/glue/frontend_data_type_controller.h b/chrome/browser/sync/glue/frontend_data_type_controller.h index fb824ad7..ae7cd55 100644 --- a/chrome/browser/sync/glue/frontend_data_type_controller.h +++ b/chrome/browser/sync/glue/frontend_data_type_controller.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" class Profile; @@ -43,6 +43,8 @@ class ChangeProcessor; class FrontendDataTypeController : public DataTypeController { public: FrontendDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service); diff --git a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc index f7f06d2..59d42e2 100644 --- a/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/frontend_data_type_controller_unittest.cc @@ -11,12 +11,12 @@ #include "base/message_loop/message_loop.h" #include "base/tracked_objects.h" #include "chrome/browser/sync/glue/change_processor_mock.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/frontend_data_type_controller.h" #include "chrome/browser/sync/glue/frontend_data_type_controller_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "components/sync_driver/model_associator_mock.h" #include "content/public/test/test_browser_thread.h" @@ -42,7 +42,9 @@ class FrontendDataTypeControllerFake : public FrontendDataTypeController { Profile* profile, ProfileSyncService* sync_service, FrontendDataTypeControllerMock* mock) - : FrontendDataTypeController(profile_sync_factory, + : FrontendDataTypeController(base::MessageLoopProxy::current(), + base::Closure(), + profile_sync_factory, profile, sync_service), mock_(mock) {} diff --git a/chrome/browser/sync/glue/generic_change_processor.h b/chrome/browser/sync/glue/generic_change_processor.h index 274d5da..0f0c93b 100644 --- a/chrome/browser/sync/glue/generic_change_processor.h +++ b/chrome/browser/sync/glue/generic_change_processor.h @@ -11,7 +11,7 @@ #include "base/memory/weak_ptr.h" #include "base/threading/non_thread_safe.h" #include "chrome/browser/sync/glue/change_processor.h" -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" #include "sync/api/sync_change_processor.h" #include "sync/api/sync_merge_result.h" diff --git a/chrome/browser/sync/glue/model_association_manager.cc b/chrome/browser/sync/glue/model_association_manager.cc index 3540fd1..8b0f7a4 100644 --- a/chrome/browser/sync/glue/model_association_manager.cc +++ b/chrome/browser/sync/glue/model_association_manager.cc @@ -11,6 +11,7 @@ #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram.h" +#include "content/public/browser/browser_thread.h" #include "sync/internal_api/public/base/model_type.h" using content::BrowserThread; diff --git a/chrome/browser/sync/glue/model_association_manager.h b/chrome/browser/sync/glue/model_association_manager.h index 3d18349..4f736ec 100644 --- a/chrome/browser/sync/glue/model_association_manager.h +++ b/chrome/browser/sync/glue/model_association_manager.h @@ -10,7 +10,7 @@ #include "base/memory/weak_ptr.h" #include "base/timer/timer.h" -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" #include "sync/internal_api/public/data_type_association_stats.h" #include "sync/internal_api/public/util/weak_handle.h" diff --git a/chrome/browser/sync/glue/model_association_manager_unittest.cc b/chrome/browser/sync/glue/model_association_manager_unittest.cc index 4c02b4a..6b97495 100644 --- a/chrome/browser/sync/glue/model_association_manager_unittest.cc +++ b/chrome/browser/sync/glue/model_association_manager_unittest.cc @@ -4,8 +4,8 @@ #include "base/callback.h" #include "base/message_loop/message_loop.h" -#include "chrome/browser/sync/glue/fake_data_type_controller.h" #include "chrome/browser/sync/glue/model_association_manager.h" +#include "components/sync_driver/fake_data_type_controller.h" #include "content/public/test/test_browser_thread.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller.cc b/chrome/browser/sync/glue/non_frontend_data_type_controller.cc index 2bd9933..1617ce7 100644 --- a/chrome/browser/sync/glue/non_frontend_data_type_controller.cc +++ b/chrome/browser/sync/glue/non_frontend_data_type_controller.cc @@ -51,8 +51,8 @@ class NonFrontendDataTypeController::BackendComponentsContainer { NonFrontendDataTypeController:: BackendComponentsContainer::BackendComponentsContainer( NonFrontendDataTypeController* controller) - : controller_(controller), - type_(controller->type()) { + : controller_(controller), + type_(controller->type()) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); controller_handle_ = syncer::MakeWeakHandle(controller_->weak_ptr_factory_.GetWeakPtr()); @@ -157,10 +157,13 @@ NonFrontendDataTypeController::AssociationResult::AssociationResult( NonFrontendDataTypeController::AssociationResult::~AssociationResult() {} NonFrontendDataTypeController::NonFrontendDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : state_(NOT_RUNNING), + : DataTypeController(ui_thread, error_callback), + state_(NOT_RUNNING), profile_sync_factory_(profile_sync_factory), profile_(profile), profile_sync_service_(sync_service), @@ -302,7 +305,8 @@ void NonFrontendDataTypeController::OnSingleDatatypeUnrecoverableError( } NonFrontendDataTypeController::NonFrontendDataTypeController() - : state_(NOT_RUNNING), + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()), + state_(NOT_RUNNING), profile_sync_factory_(NULL), profile_(NULL), profile_sync_service_(NULL), diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller.h b/chrome/browser/sync/glue/non_frontend_data_type_controller.h index 1e73330..86acf77 100644 --- a/chrome/browser/sync/glue/non_frontend_data_type_controller.h +++ b/chrome/browser/sync/glue/non_frontend_data_type_controller.h @@ -13,8 +13,8 @@ #include "base/memory/scoped_ptr.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/profile_sync_components_factory.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" class Profile; @@ -48,6 +48,8 @@ class NonFrontendDataTypeController : public DataTypeController { class BackendComponentsContainer; NonFrontendDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service); diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc index d7574ea..9c48a86 100644 --- a/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/non_frontend_data_type_controller_unittest.cc @@ -14,12 +14,12 @@ #include "base/test/test_timeouts.h" #include "base/tracked_objects.h" #include "chrome/browser/sync/glue/change_processor_mock.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/non_frontend_data_type_controller.h" #include "chrome/browser/sync/glue/non_frontend_data_type_controller_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "components/sync_driver/model_associator_mock.h" #include "content/public/test/test_browser_thread.h" #include "sync/internal_api/public/engine/model_safe_worker.h" @@ -56,7 +56,9 @@ class NonFrontendDataTypeControllerFake : public NonFrontendDataTypeController { Profile* profile, ProfileSyncService* sync_service, NonFrontendDataTypeControllerMock* mock) - : NonFrontendDataTypeController(profile_sync_factory, + : NonFrontendDataTypeController(base::MessageLoopProxy::current(), + base::Closure(), + profile_sync_factory, profile, sync_service), mock_(mock) {} diff --git a/chrome/browser/sync/glue/non_ui_data_type_controller.cc b/chrome/browser/sync/glue/non_ui_data_type_controller.cc index e1d0b9c..83c7dd7 100644 --- a/chrome/browser/sync/glue/non_ui_data_type_controller.cc +++ b/chrome/browser/sync/glue/non_ui_data_type_controller.cc @@ -21,10 +21,13 @@ using content::BrowserThread; namespace browser_sync { NonUIDataTypeController::NonUIDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : profile_sync_factory_(profile_sync_factory), + : DataTypeController(ui_thread, error_callback), + profile_sync_factory_(profile_sync_factory), profile_(profile), sync_service_(sync_service), state_(NOT_RUNNING) { @@ -186,7 +189,8 @@ void NonUIDataTypeController::OnSingleDatatypeUnrecoverableError( } NonUIDataTypeController::NonUIDataTypeController() - : profile_sync_factory_(NULL), + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()), + profile_sync_factory_(NULL), profile_(NULL), sync_service_(NULL) {} diff --git a/chrome/browser/sync/glue/non_ui_data_type_controller.h b/chrome/browser/sync/glue/non_ui_data_type_controller.h index 2c6133d1..696aee2 100644 --- a/chrome/browser/sync/glue/non_ui_data_type_controller.h +++ b/chrome/browser/sync/glue/non_ui_data_type_controller.h @@ -11,8 +11,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/shared_change_processor.h" +#include "components/sync_driver/data_type_controller.h" class Profile; class ProfileSyncService; @@ -27,6 +27,8 @@ namespace browser_sync { class NonUIDataTypeController : public DataTypeController { public: NonUIDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service); diff --git a/chrome/browser/sync/glue/non_ui_data_type_controller_unittest.cc b/chrome/browser/sync/glue/non_ui_data_type_controller_unittest.cc index 4ca65cf..a9c6954 100644 --- a/chrome/browser/sync/glue/non_ui_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/non_ui_data_type_controller_unittest.cc @@ -13,11 +13,11 @@ #include "base/synchronization/waitable_event.h" #include "base/test/test_timeouts.h" #include "base/tracked_objects.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/non_ui_data_type_controller_mock.h" #include "chrome/browser/sync/glue/shared_change_processor_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "content/public/test/test_browser_thread.h" #include "sync/api/fake_syncable_service.h" #include "sync/internal_api/public/engine/model_safe_worker.h" @@ -65,9 +65,11 @@ class NonUIDataTypeControllerFake Profile* profile, ProfileSyncService* sync_service, NonUIDataTypeControllerMock* mock) - : NonUIDataTypeController(profile_sync_factory, - profile, - sync_service), + : NonUIDataTypeController(base::MessageLoopProxy::current(), + base::Closure(), + profile_sync_factory, + profile, + sync_service), blocked_(false), mock_(mock) {} diff --git a/chrome/browser/sync/glue/password_data_type_controller.cc b/chrome/browser/sync/glue/password_data_type_controller.cc index 688c2a6..4dd6773 100644 --- a/chrome/browser/sync/glue/password_data_type_controller.cc +++ b/chrome/browser/sync/glue/password_data_type_controller.cc @@ -9,6 +9,7 @@ #include "chrome/browser/password_manager/password_store.h" #include "chrome/browser/password_manager/password_store_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/password_change_processor.h" #include "chrome/browser/sync/profile_sync_service.h" #include "content/public/browser/browser_thread.h" @@ -22,9 +23,12 @@ PasswordDataTypeController::PasswordDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : NonFrontendDataTypeController(profile_sync_factory, - profile, - sync_service) { + : NonFrontendDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service) { } syncer::ModelType PasswordDataTypeController::type() const { diff --git a/chrome/browser/sync/glue/proxy_data_type_controller.cc b/chrome/browser/sync/glue/proxy_data_type_controller.cc index ffe138c..3bee439 100644 --- a/chrome/browser/sync/glue/proxy_data_type_controller.cc +++ b/chrome/browser/sync/glue/proxy_data_type_controller.cc @@ -6,8 +6,11 @@ namespace browser_sync { -ProxyDataTypeController::ProxyDataTypeController(syncer::ModelType type) - : state_(NOT_RUNNING), +ProxyDataTypeController::ProxyDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + syncer::ModelType type) + : DataTypeController(ui_thread, base::Closure()), + state_(NOT_RUNNING), type_(type) { DCHECK(syncer::ProxyTypes().Has(type_)); } diff --git a/chrome/browser/sync/glue/proxy_data_type_controller.h b/chrome/browser/sync/glue/proxy_data_type_controller.h index 4300f33..03f79d2 100644 --- a/chrome/browser/sync/glue/proxy_data_type_controller.h +++ b/chrome/browser/sync/glue/proxy_data_type_controller.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" namespace browser_sync { @@ -16,7 +16,9 @@ namespace browser_sync { // service. class ProxyDataTypeController : public DataTypeController { public: - explicit ProxyDataTypeController(syncer::ModelType type); + explicit ProxyDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + syncer::ModelType type); // DataTypeController interface. virtual void LoadModels( diff --git a/chrome/browser/sync/glue/search_engine_data_type_controller.cc b/chrome/browser/sync/glue/search_engine_data_type_controller.cc index 351fe6d..cd5d0b0 100644 --- a/chrome/browser/sync/glue/search_engine_data_type_controller.cc +++ b/chrome/browser/sync/glue/search_engine_data_type_controller.cc @@ -7,8 +7,10 @@ #include "base/metrics/histogram.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/search_engines/template_url_service_factory.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "content/public/browser/browser_thread.h" #include "sync/api/syncable_service.h" using content::BrowserThread; @@ -19,10 +21,13 @@ SearchEngineDataTypeController::SearchEngineDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : UIDataTypeController(syncer::SEARCH_ENGINES, - profile_sync_factory, - profile, - sync_service) { + : UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::SEARCH_ENGINES, + profile_sync_factory, + profile, + sync_service) { } SearchEngineDataTypeController::~SearchEngineDataTypeController() {} diff --git a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc index 98b8fd7..700968e 100644 --- a/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/search_engine_data_type_controller_unittest.cc @@ -10,12 +10,12 @@ #include "base/tracked_objects.h" #include "chrome/browser/search_engines/template_url_service_factory.h" #include "chrome/browser/search_engines/template_url_service_test_util.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/fake_generic_change_processor.h" #include "chrome/browser/sync/glue/search_engine_data_type_controller.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "sync/api/fake_syncable_service.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sync/glue/session_data_type_controller.cc b/chrome/browser/sync/glue/session_data_type_controller.cc index 8e69ad5..c43866c 100644 --- a/chrome/browser/sync/glue/session_data_type_controller.cc +++ b/chrome/browser/sync/glue/session_data_type_controller.cc @@ -6,6 +6,7 @@ #include "base/metrics/histogram.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/synced_window_delegate.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "content/public/browser/browser_thread.h" @@ -13,16 +14,21 @@ #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +using content::BrowserThread; + namespace browser_sync { SessionDataTypeController::SessionDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : FrontendDataTypeController(profile_sync_factory, - profile, - sync_service) { -} + : FrontendDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service) { + } SessionModelAssociator* SessionDataTypeController::GetModelAssociator() { return reinterpret_cast<SessionModelAssociator*>(model_associator_.get()); diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc index 910e702..323c144 100644 --- a/chrome/browser/sync/glue/session_model_associator.cc +++ b/chrome/browser/sync/glue/session_model_associator.cc @@ -33,6 +33,7 @@ #include "chrome/common/url_constants.h" #include "components/sessions/serialized_navigation_entry.h" #include "components/user_prefs/pref_registry_syncable.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/sync/glue/theme_data_type_controller.cc b/chrome/browser/sync/glue/theme_data_type_controller.cc index 5ae9c28..17aadae9 100644 --- a/chrome/browser/sync/glue/theme_data_type_controller.cc +++ b/chrome/browser/sync/glue/theme_data_type_controller.cc @@ -5,18 +5,25 @@ #include "chrome/browser/sync/glue/theme_data_type_controller.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" +#include "content/public/browser/browser_thread.h" #include "extensions/browser/extension_system.h" +using content::BrowserThread; + namespace browser_sync { ThemeDataTypeController::ThemeDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : UIDataTypeController(syncer::THEMES, - profile_sync_factory, - profile, - sync_service) { + : UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::THEMES, + profile_sync_factory, + profile, + sync_service) { } ThemeDataTypeController::~ThemeDataTypeController() {} diff --git a/chrome/browser/sync/glue/typed_url_change_processor.cc b/chrome/browser/sync/glue/typed_url_change_processor.cc index 0084eaf..82c0617 100644 --- a/chrome/browser/sync/glue/typed_url_change_processor.cc +++ b/chrome/browser/sync/glue/typed_url_change_processor.cc @@ -14,6 +14,7 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/sync/glue/typed_url_model_associator.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "sync/internal_api/public/change_record.h" #include "sync/internal_api/public/read_node.h" diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.cc b/chrome/browser/sync/glue/typed_url_data_type_controller.cc index fe7d137..2587999 100644 --- a/chrome/browser/sync/glue/typed_url_data_type_controller.cc +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.cc @@ -13,6 +13,7 @@ #include "chrome/browser/history/history_service.h" #include "chrome/browser/history/history_service_factory.h" #include "chrome/browser/profiles/profile.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/typed_url_change_processor.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" @@ -67,9 +68,12 @@ TypedUrlDataTypeController::TypedUrlDataTypeController( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : NonFrontendDataTypeController(profile_sync_factory, - profile, - sync_service), + : NonFrontendDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + profile_sync_factory, + profile, + sync_service), backend_(NULL) { pref_registrar_.Init(profile->GetPrefs()); pref_registrar_.Add( diff --git a/chrome/browser/sync/glue/typed_url_model_associator.cc b/chrome/browser/sync/glue/typed_url_model_associator.cc index 3c42750..adfdbf6 100644 --- a/chrome/browser/sync/glue/typed_url_model_associator.cc +++ b/chrome/browser/sync/glue/typed_url_model_associator.cc @@ -13,6 +13,7 @@ #include "base/strings/utf_string_conversions.h" #include "chrome/browser/history/history_backend.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "content/public/browser/browser_thread.h" #include "net/base/net_util.h" #include "sync/api/sync_error.h" #include "sync/internal_api/public/read_node.h" diff --git a/chrome/browser/sync/glue/ui_data_type_controller.cc b/chrome/browser/sync/glue/ui_data_type_controller.cc index 24b0e51..884c73b 100644 --- a/chrome/browser/sync/glue/ui_data_type_controller.cc +++ b/chrome/browser/sync/glue/ui_data_type_controller.cc @@ -21,7 +21,8 @@ using content::BrowserThread; namespace browser_sync { UIDataTypeController::UIDataTypeController() - : profile_sync_factory_(NULL), + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()), + profile_sync_factory_(NULL), profile_(NULL), sync_service_(NULL), state_(NOT_RUNNING), @@ -29,11 +30,14 @@ UIDataTypeController::UIDataTypeController() } UIDataTypeController::UIDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, syncer::ModelType type, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : profile_sync_factory_(profile_sync_factory), + : DataTypeController(ui_thread, error_callback), + profile_sync_factory_(profile_sync_factory), profile_(profile), sync_service_(sync_service), state_(NOT_RUNNING), diff --git a/chrome/browser/sync/glue/ui_data_type_controller.h b/chrome/browser/sync/glue/ui_data_type_controller.h index dbd6f08..c30c1d4 100644 --- a/chrome/browser/sync/glue/ui_data_type_controller.h +++ b/chrome/browser/sync/glue/ui_data_type_controller.h @@ -11,8 +11,8 @@ #include "base/compiler_specific.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/shared_change_processor.h" +#include "components/sync_driver/data_type_controller.h" class Profile; class ProfileSyncService; @@ -36,6 +36,8 @@ namespace browser_sync { class UIDataTypeController : public DataTypeController { public: UIDataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback, syncer::ModelType type, ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, diff --git a/chrome/browser/sync/glue/ui_data_type_controller_unittest.cc b/chrome/browser/sync/glue/ui_data_type_controller_unittest.cc index 94c52fa..538aeb4 100644 --- a/chrome/browser/sync/glue/ui_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/ui_data_type_controller_unittest.cc @@ -8,11 +8,11 @@ #include "base/memory/scoped_ptr.h" #include "base/message_loop/message_loop.h" #include "base/tracked_objects.h" -#include "chrome/browser/sync/glue/data_type_controller_mock.h" #include "chrome/browser/sync/glue/fake_generic_change_processor.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/test/base/profile_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" #include "content/public/test/test_browser_thread.h" #include "sync/api/fake_syncable_service.h" #include "testing/gtest/include/gtest/gtest.h" @@ -48,7 +48,9 @@ class SyncUIDataTypeControllerTest : public testing::Test { virtual void SetUp() { profile_sync_factory_.reset(new ProfileSyncComponentsFactoryMock()); preference_dtc_ = - new UIDataTypeController(type_, + new UIDataTypeController(base::MessageLoopProxy::current(), + base::Closure(), + type_, profile_sync_factory_.get(), &profile_, &profile_sync_service_); diff --git a/chrome/browser/sync/profile_sync_components_factory.h b/chrome/browser/sync/profile_sync_components_factory.h index 3b91724..b49c7b7 100644 --- a/chrome/browser/sync/profile_sync_components_factory.h +++ b/chrome/browser/sync/profile_sync_components_factory.h @@ -8,7 +8,7 @@ #include <string> #include "base/memory/weak_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" #include "sync/api/sync_merge_result.h" #include "sync/internal_api/public/util/unrecoverable_error_handler.h" diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index 54af3b6..e96de85a 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -28,6 +28,7 @@ #include "chrome/browser/sync/glue/bookmark_change_processor.h" #include "chrome/browser/sync/glue/bookmark_data_type_controller.h" #include "chrome/browser/sync/glue/bookmark_model_associator.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/data_type_manager_impl.h" #include "chrome/browser/sync/glue/data_type_manager_observer.h" #include "chrome/browser/sync/glue/extension_data_type_controller.h" @@ -93,6 +94,7 @@ using browser_sync::AutofillProfileDataTypeController; using browser_sync::BookmarkChangeProcessor; using browser_sync::BookmarkDataTypeController; using browser_sync::BookmarkModelAssociator; +using browser_sync::ChromeReportUnrecoverableError; using browser_sync::DataTypeController; using browser_sync::DataTypeErrorHandler; using browser_sync::DataTypeManager; @@ -176,13 +178,19 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( if (!command_line_->HasSwitch(switches::kHistoryDisableFullHistorySync)) { pss->RegisterDataTypeController( new UIDataTypeController( - syncer::HISTORY_DELETE_DIRECTIVES, this, profile_, pss)); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::HISTORY_DELETE_DIRECTIVES, + this, + profile_, + pss)); } // Session sync is enabled by default. Register unless explicitly disabled. if (!command_line_->HasSwitch(switches::kDisableSyncTabs)) { - pss->RegisterDataTypeController( - new ProxyDataTypeController(syncer::PROXY_TABS)); + pss->RegisterDataTypeController(new ProxyDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + syncer::PROXY_TABS)); if (command_line_->HasSwitch(switches::kDisableSyncSessionsV2)) { pss->RegisterDataTypeController( new SessionDataTypeController(this, profile_, pss)); @@ -195,15 +203,21 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( // Favicon sync is enabled by default. Register unless explicitly disabled. if (!command_line_->HasSwitch(switches::kDisableSyncFavicons)) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::FAVICON_IMAGES, - this, - profile_, - pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::FAVICON_IMAGES, + this, + profile_, + pss)); pss->RegisterDataTypeController( - new UIDataTypeController(syncer::FAVICON_TRACKING, - this, - profile_, - pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::FAVICON_TRACKING, + this, + profile_, + pss)); } // Password sync is enabled by default. Register unless explicitly @@ -220,22 +234,43 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( } if (IsEnableSyncArticlesSet()) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::ARTICLES, this, profile_, pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::ARTICLES, + this, + profile_, + pss)); } #if defined(ENABLE_MANAGED_USERS) if (profile_->IsManaged()) { pss->RegisterDataTypeController( new UIDataTypeController( - syncer::MANAGED_USER_SETTINGS, this, profile_, pss)); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::MANAGED_USER_SETTINGS, + this, + profile_, + pss)); } else { pss->RegisterDataTypeController( new UIDataTypeController( - syncer::MANAGED_USERS, this, profile_, pss)); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::MANAGED_USERS, + this, + profile_, + pss)); } pss->RegisterDataTypeController( new UIDataTypeController( - syncer::MANAGED_USER_SHARED_SETTINGS, this, profile_, pss)); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::MANAGED_USER_SHARED_SETTINGS, + this, + profile_, + pss)); #endif } @@ -260,14 +295,25 @@ void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( // disabled. if (!command_line_->HasSwitch(switches::kDisableSyncPreferences)) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::PREFERENCES, this, profile_, pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::PREFERENCES, + this, + profile_, + pss)); } if (!command_line_->HasSwitch(switches::kDisableSyncPriorityPreferences)) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::PRIORITY_PREFERENCES, - this, profile_, pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::PRIORITY_PREFERENCES, + this, + profile_, + pss)); } #if defined(ENABLE_THEMES) @@ -305,14 +351,25 @@ void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( // App List sync is disabled by default. Register only if enabled. if (command_line_->HasSwitch(switches::kEnableSyncAppList)) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::APP_LIST, this, profile_, pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::APP_LIST, + this, + profile_, + pss)); } #endif // Synced Notifications are enabled by default. pss->RegisterDataTypeController( new UIDataTypeController( - syncer::SYNCED_NOTIFICATIONS, this, profile_, pss)); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::SYNCED_NOTIFICATIONS, + this, + profile_, + pss)); // TODO(petewil): Enable the data type controller once we have a handler. @@ -320,7 +377,13 @@ void ProfileSyncComponentsFactoryImpl::RegisterDesktopDataTypes( // Dictionary sync is enabled by default. if (!command_line_->HasSwitch(switches::kDisableSyncDictionary)) { pss->RegisterDataTypeController( - new UIDataTypeController(syncer::DICTIONARY, this, profile_, pss)); + new UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::DICTIONARY, + this, + profile_, + pss)); } #endif } diff --git a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc index 7cabeb8..a59df74 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl_unittest.cc @@ -10,12 +10,12 @@ #include "base/message_loop/message_loop.h" #include "chrome/browser/signin/profile_oauth2_token_service.h" #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/profile_sync_components_factory_impl.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_version_info.h" #include "chrome/test/base/testing_profile.h" +#include "components/sync_driver/data_type_controller.h" #include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.h b/chrome/browser/sync/profile_sync_components_factory_mock.h index 11d0a65..e8575f6 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.h +++ b/chrome/browser/sync/profile_sync_components_factory_mock.h @@ -6,9 +6,9 @@ #define CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/profile_sync_components_factory.h" #include "chrome/browser/sync/profile_sync_service.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_error_handler.h" #include "testing/gmock/include/gmock/gmock.h" diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index 5857272..84703f6 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -38,7 +38,6 @@ #include "chrome/browser/sync/glue/change_processor.h" #include "chrome/browser/sync/glue/chrome_encryptor.h" #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/favicon_cache.h" #include "chrome/browser/sync/glue/session_data_type_controller.h" @@ -61,6 +60,7 @@ #include "chrome/common/chrome_version_info.h" #include "chrome/common/pref_names.h" #include "chrome/common/url_constants.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/user_selectable_sync_type.h" #include "components/user_prefs/pref_registry_syncable.h" #include "content/public/browser/notification_details.h" diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 646dcbf..1c6e405 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -21,8 +21,6 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" -#include "chrome/browser/sync/glue/data_type_controller.h" -#include "chrome/browser/sync/glue/data_type_manager.h" #include "chrome/browser/sync/glue/data_type_manager_observer.h" #include "chrome/browser/sync/glue/failed_data_types_handler.h" #include "chrome/browser/sync/glue/sync_backend_host.h" @@ -32,7 +30,9 @@ #include "chrome/browser/sync/sessions2/sessions_sync_manager.h" #include "chrome/browser/sync/sync_prefs.h" #include "components/browser_context_keyed_service/browser_context_keyed_service.h" +#include "components/sync_driver/data_type_controller.h" #include "components/sync_driver/data_type_encryption_handler.h" +#include "components/sync_driver/data_type_manager.h" #include "components/sync_driver/sync_frontend.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" diff --git a/chrome/browser/sync/profile_sync_service_android.cc b/chrome/browser/sync/profile_sync_service_android.cc index 42e1929..9717168 100644 --- a/chrome/browser/sync/profile_sync_service_android.cc +++ b/chrome/browser/sync/profile_sync_service_android.cc @@ -25,6 +25,7 @@ #include "chrome/browser/sync/sync_prefs.h" #include "chrome/browser/sync/sync_ui_util.h" #include "chrome/common/pref_names.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "google/cacheinvalidation/types.pb.h" diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 13a5366..c6c420ab 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -28,7 +28,6 @@ #include "chrome/browser/sync/abstract_profile_sync_service_test.h" #include "chrome/browser/sync/glue/autofill_data_type_controller.h" #include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/generic_change_processor.h" #include "chrome/browser/sync/glue/shared_change_processor.h" #include "chrome/browser/sync/profile_sync_components_factory.h" @@ -46,6 +45,7 @@ #include "components/autofill/core/browser/webdata/autofill_profile_syncable_service.h" #include "components/autofill/core/browser/webdata/autofill_table.h" #include "components/autofill/core/browser/webdata/autofill_webdata_service.h" +#include "components/sync_driver/data_type_controller.h" #include "components/webdata/common/web_data_service_test_util.h" #include "components/webdata/common/web_database.h" #include "content/public/test/test_browser_thread.h" diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index 18832df..fa9c3f0 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h @@ -11,10 +11,10 @@ #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "chrome/browser/sync/glue/change_processor.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/test/base/testing_profile.h" +#include "components/sync_driver/data_type_controller.h" #include "google_apis/gaia/google_service_auth_error.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/protocol/sync_protocol_error.h" diff --git a/chrome/browser/sync/profile_sync_service_preference_unittest.cc b/chrome/browser/sync/profile_sync_service_preference_unittest.cc index d350dde..3fa669f 100644 --- a/chrome/browser/sync/profile_sync_service_preference_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_preference_unittest.cc @@ -177,7 +177,9 @@ class ProfileSyncServicePreferenceTest EXPECT_CALL(*components, CreateDataTypeManager(_, _, _, _, _, _)). WillOnce(ReturnNewDataTypeManagerWithDebugListener( syncer::MakeWeakHandle(debug_ptr_factory_.GetWeakPtr()))); - dtc_ = new UIDataTypeController(syncer::PREFERENCES, + dtc_ = new UIDataTypeController(base::MessageLoopProxy::current(), + base::Closure(), + syncer::PREFERENCES, components, profile_.get(), sync_service_); diff --git a/chrome/browser/sync/profile_sync_service_startup_unittest.cc b/chrome/browser/sync/profile_sync_service_startup_unittest.cc index cdf0051..69ae209 100644 --- a/chrome/browser/sync/profile_sync_service_startup_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_startup_unittest.cc @@ -12,8 +12,6 @@ #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" #include "chrome/browser/signin/signin_manager.h" #include "chrome/browser/signin/signin_manager_factory.h" -#include "chrome/browser/sync/glue/data_type_manager.h" -#include "chrome/browser/sync/glue/data_type_manager_mock.h" #include "chrome/browser/sync/glue/sync_backend_host_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" #include "chrome/browser/sync/profile_sync_service_factory.h" @@ -21,6 +19,8 @@ #include "chrome/browser/sync/sync_prefs.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" +#include "components/sync_driver/data_type_manager.h" +#include "components/sync_driver/data_type_manager_mock.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" #include "content/public/test/test_browser_thread_bundle.h" diff --git a/chrome/browser/sync/sessions2/session_data_type_controller2.cc b/chrome/browser/sync/sessions2/session_data_type_controller2.cc index 0add2e7..66f3b0f 100644 --- a/chrome/browser/sync/sessions2/session_data_type_controller2.cc +++ b/chrome/browser/sync/sessions2/session_data_type_controller2.cc @@ -5,22 +5,28 @@ #include "chrome/browser/sync/sessions2/session_data_type_controller2.h" #include "chrome/browser/chrome_notification_types.h" +#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" #include "chrome/browser/sync/glue/synced_window_delegate.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" #include "content/public/browser/notification_source.h" +using content::BrowserThread; + namespace browser_sync { SessionDataTypeController2::SessionDataTypeController2( ProfileSyncComponentsFactory* profile_sync_factory, Profile* profile, ProfileSyncService* sync_service) - : UIDataTypeController(syncer::SESSIONS, - profile_sync_factory, - profile, - sync_service) { + : UIDataTypeController( + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + syncer::SESSIONS, + profile_sync_factory, + profile, + sync_service) { } SessionDataTypeController2::~SessionDataTypeController2() {} diff --git a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc index 08525cc..063aa6a 100644 --- a/chrome/browser/sync/test/integration/profile_sync_service_harness.cc +++ b/chrome/browser/sync/test/integration/profile_sync_service_harness.cc @@ -30,11 +30,11 @@ #include "chrome/browser/signin/signin_manager_base.h" #include "chrome/browser/sync/about_sync_util.h" #include "chrome/browser/sync/backend_migrator.h" -#include "chrome/browser/sync/glue/data_type_controller.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/test/integration/status_change_checker.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "components/sync_driver/data_type_controller.h" #include "content/public/browser/notification_service.h" #include "google_apis/gaia/gaia_constants.h" #include "sync/internal_api/public/base/progress_marker_map.h" diff --git a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc index 0394d71..94cee71 100644 --- a/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc +++ b/chrome/browser/ui/toolbar/recent_tabs_sub_menu_model_unittest.cc @@ -25,6 +25,7 @@ #include "chrome/test/base/menu_model_test.h" #include "chrome/test/base/testing_profile.h" #include "components/sessions/serialized_navigation_entry_test_helper.h" +#include "content/public/browser/browser_thread.h" #include "grit/generated_resources.h" #include "sync/api/fake_sync_change_processor.h" #include "sync/api/sync_error_factory_mock.h" diff --git a/chrome/browser/ui/webui/sync_internals_message_handler.cc b/chrome/browser/ui/webui/sync_internals_message_handler.cc index 1f03b59..6a52ece 100644 --- a/chrome/browser/ui/webui/sync_internals_message_handler.cc +++ b/chrome/browser/ui/webui/sync_internals_message_handler.cc @@ -11,6 +11,7 @@ #include "chrome/browser/sync/about_sync_util.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/web_ui.h" #include "sync/internal_api/public/util/weak_handle.h" #include "sync/js/js_arg_list.h" diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 92c2544..3aca70a 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2200,10 +2200,6 @@ 'browser/sync/glue/chrome_encryptor.h', 'browser/sync/glue/chrome_report_unrecoverable_error.cc', 'browser/sync/glue/chrome_report_unrecoverable_error.h', - 'browser/sync/glue/data_type_controller.cc', - 'browser/sync/glue/data_type_controller.h', - 'browser/sync/glue/data_type_manager.cc', - 'browser/sync/glue/data_type_manager.h', 'browser/sync/glue/data_type_manager_impl.cc', 'browser/sync/glue/data_type_manager_impl.h', 'browser/sync/glue/data_type_manager_observer.h', diff --git a/chrome/chrome_tests_unit.gypi b/chrome/chrome_tests_unit.gypi index 4177980..e8268bf 100644 --- a/chrome/chrome_tests_unit.gypi +++ b/chrome/chrome_tests_unit.gypi @@ -1286,16 +1286,10 @@ 'browser/sync/glue/change_processor_mock.cc', 'browser/sync/glue/change_processor_mock.h', 'browser/sync/glue/chrome_encryptor_unittest.cc', - 'browser/sync/glue/data_type_controller_mock.cc', - 'browser/sync/glue/data_type_controller_mock.h', 'browser/sync/glue/data_type_error_handler_mock.cc', 'browser/sync/glue/data_type_error_handler_mock.h', 'browser/sync/glue/data_type_manager_impl_unittest.cc', - 'browser/sync/glue/data_type_manager_mock.cc', - 'browser/sync/glue/data_type_manager_mock.h', 'browser/sync/glue/extensions_activity_monitor_unittest.cc', - 'browser/sync/glue/fake_data_type_controller.cc', - 'browser/sync/glue/fake_data_type_controller.h', 'browser/sync/glue/fake_generic_change_processor.cc', 'browser/sync/glue/fake_generic_change_processor.h', 'browser/sync/glue/favicon_cache_unittest.cc', diff --git a/components/sync_driver.gypi b/components/sync_driver.gypi index cadde22..643ac25 100644 --- a/components/sync_driver.gypi +++ b/components/sync_driver.gypi @@ -17,9 +17,13 @@ 'sources': [ 'sync_driver/backend_data_type_configurer.cc', 'sync_driver/backend_data_type_configurer.h', + 'sync_driver/data_type_controller.cc', + 'sync_driver/data_type_controller.h', 'sync_driver/data_type_encryption_handler.cc', 'sync_driver/data_type_encryption_handler.h', 'sync_driver/data_type_error_handler.h', + 'sync_driver/data_type_manager.cc', + 'sync_driver/data_type_manager.h', 'sync_driver/model_associator.h', 'sync_driver/sync_frontend.h', 'sync_driver/sync_frontend.cc', @@ -40,6 +44,12 @@ '..', ], 'sources': [ + 'sync_driver/data_type_controller_mock.cc', + 'sync_driver/data_type_controller_mock.h', + 'sync_driver/data_type_manager_mock.cc', + 'sync_driver/data_type_manager_mock.h', + 'sync_driver/fake_data_type_controller.cc', + 'sync_driver/fake_data_type_controller.h', 'sync_driver/model_associator_mock.cc', 'sync_driver/model_associator_mock.h', ], diff --git a/chrome/browser/sync/glue/data_type_controller.cc b/components/sync_driver/data_type_controller.cc index cb56478..9e1932b 100644 --- a/chrome/browser/sync/glue/data_type_controller.cc +++ b/components/sync_driver/data_type_controller.cc @@ -1,15 +1,23 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" - -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/util/data_type_histogram.h" namespace browser_sync { +DataTypeController::DataTypeController( + scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback) + : base::RefCountedDeleteOnMessageLoop<DataTypeController>(ui_thread), + error_callback_(error_callback) { +} + +DataTypeController::~DataTypeController() { +} + bool DataTypeController::IsUnrecoverableResult(StartResult result) { return (result == UNRECOVERABLE_ERROR); } @@ -22,7 +30,8 @@ syncer::SyncError DataTypeController::CreateAndUploadError( const tracked_objects::Location& location, const std::string& message, syncer::ModelType type) { - ChromeReportUnrecoverableError(); + if (!error_callback_.is_null()) + error_callback_.Run(); return syncer::SyncError(location, syncer::SyncError::DATATYPE_ERROR, message, @@ -42,8 +51,8 @@ void DataTypeController::RecordUnrecoverableError( // TODO(sync): remove this once search engines triggers less errors, such as // due to crbug.com/130448. - if (type() != syncer::SEARCH_ENGINES) - ChromeReportUnrecoverableError(); + if ((type() != syncer::SEARCH_ENGINES) && (!error_callback_.is_null())) + error_callback_.Run(); } } // namespace browser_sync diff --git a/chrome/browser/sync/glue/data_type_controller.h b/components/sync_driver/data_type_controller.h index 5349e03..633f433 100644 --- a/chrome/browser/sync/glue/data_type_controller.h +++ b/components/sync_driver/data_type_controller.h @@ -1,18 +1,19 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ -#define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ +#ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ +#define COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ #include <map> #include <string> #include "base/callback.h" #include "base/location.h" +#include "base/memory/ref_counted.h" +#include "base/memory/ref_counted_delete_on_message_loop.h" #include "base/sequenced_task_runner_helpers.h" #include "components/sync_driver/data_type_error_handler.h" -#include "content/public/browser/browser_thread.h" #include "sync/api/sync_merge_result.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/engine/model_safe_worker.h" @@ -27,8 +28,7 @@ namespace browser_sync { // Data type controllers need to be refcounted threadsafe, as they may // need to run model associator or change processor on other threads. class DataTypeController - : public base::RefCountedThreadSafe< - DataTypeController, content::BrowserThread::DeleteOnUIThread>, + : public base::RefCountedDeleteOnMessageLoop<DataTypeController>, public DataTypeErrorHandler { public: enum State { @@ -118,16 +118,18 @@ class DataTypeController syncer::ModelType type) OVERRIDE; protected: - friend struct content::BrowserThread::DeleteOnThread< - content::BrowserThread::UI>; + friend class base::RefCountedDeleteOnMessageLoop<DataTypeController>; friend class base::DeleteHelper<DataTypeController>; + DataTypeController(scoped_refptr<base::MessageLoopProxy> ui_thread, + const base::Closure& error_callback); + // If the DTC is waiting for models to load, once the models are // loaded the datatype service will call this function on DTC to let // us know that it is safe to start associating. virtual void OnModelLoaded() = 0; - virtual ~DataTypeController() {} + virtual ~DataTypeController(); // Handles the reporting of unrecoverable error. It records stuff in // UMA and reports to breakpad. @@ -135,8 +137,12 @@ class DataTypeController virtual void RecordUnrecoverableError( const tracked_objects::Location& from_here, const std::string& message); + + private: + // The callback that will be invoked when an unrecoverable error occurs. + base::Closure error_callback_; }; } // namespace browser_sync -#endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_H__ +#endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_H__ diff --git a/chrome/browser/sync/glue/data_type_controller_mock.cc b/components/sync_driver/data_type_controller_mock.cc index 74e257e..cf15b53 100644 --- a/chrome/browser/sync/glue/data_type_controller_mock.cc +++ b/components/sync_driver/data_type_controller_mock.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/glue/data_type_controller_mock.h" +#include "components/sync_driver/data_type_controller_mock.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/data_type_controller_mock.h b/components/sync_driver/data_type_controller_mock.h index 40ab896..1f3b9d6 100644 --- a/chrome/browser/sync/glue/data_type_controller_mock.h +++ b/components/sync_driver/data_type_controller_mock.h @@ -1,11 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_MOCK_H__ -#define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_MOCK_H__ +#ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_MOCK_H__ +#define COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_MOCK_H__ -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "sync/api/sync_error.h" #include "testing/gmock/include/gmock/gmock.h" @@ -31,4 +31,4 @@ class ModelLoadCallbackMock { } // namespace browser_sync -#endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_CONTROLLER_MOCK_H__ +#endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_CONTROLLER_MOCK_H__ diff --git a/chrome/browser/sync/glue/data_type_manager.cc b/components/sync_driver/data_type_manager.cc index 36b0037..9bc9627 100644 --- a/chrome/browser/sync/glue/data_type_manager.cc +++ b/components/sync_driver/data_type_manager.cc @@ -1,8 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_manager.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/data_type_manager.h b/components/sync_driver/data_type_manager.h index 5c70c3b..d7287f2 100644 --- a/chrome/browser/sync/glue/data_type_manager.h +++ b/components/sync_driver/data_type_manager.h @@ -1,15 +1,15 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_H__ -#define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_H__ +#ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_H__ +#define COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_H__ #include <list> #include <set> #include <string> -#include "chrome/browser/sync/glue/data_type_controller.h" +#include "components/sync_driver/data_type_controller.h" #include "sync/api/sync_error.h" #include "sync/internal_api/public/base/model_type.h" #include "sync/internal_api/public/configure_reason.h" @@ -108,4 +108,4 @@ class DataTypeManager { } // namespace browser_sync -#endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_H__ +#endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_H__ diff --git a/chrome/browser/sync/glue/data_type_manager_mock.cc b/components/sync_driver/data_type_manager_mock.cc index 425b491..9a18407 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.cc +++ b/components/sync_driver/data_type_manager_mock.cc @@ -1,10 +1,9 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/location.h" -#include "chrome/browser/chrome_notification_types.h" -#include "chrome/browser/sync/glue/data_type_manager_mock.h" +#include "components/sync_driver/data_type_manager_mock.h" namespace browser_sync { diff --git a/chrome/browser/sync/glue/data_type_manager_mock.h b/components/sync_driver/data_type_manager_mock.h index 546e66c..5159a20 100644 --- a/chrome/browser/sync/glue/data_type_manager_mock.h +++ b/components/sync_driver/data_type_manager_mock.h @@ -1,12 +1,11 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ -#define CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ +#ifndef COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_MOCK_H__ +#define COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_MOCK_H__ -#include "chrome/browser/sync/glue/data_type_manager.h" -#include "chrome/browser/sync/profile_sync_test_util.h" +#include "components/sync_driver/data_type_manager.h" #include "sync/api/sync_error.h" #include "testing/gmock/include/gmock/gmock.h" @@ -30,4 +29,4 @@ class DataTypeManagerMock : public DataTypeManager { } // namespace browser_sync -#endif // CHROME_BROWSER_SYNC_GLUE_DATA_TYPE_MANAGER_MOCK_H__ +#endif // COMPONENTS_SYNC_DRIVER_DATA_TYPE_MANAGER_MOCK_H__ diff --git a/chrome/browser/sync/glue/fake_data_type_controller.cc b/components/sync_driver/fake_data_type_controller.cc index e651584..d89d411 100644 --- a/chrome/browser/sync/glue/fake_data_type_controller.cc +++ b/components/sync_driver/fake_data_type_controller.cc @@ -1,11 +1,8 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "testing/gmock/include/gmock/gmock.h" -#include "testing/gtest/include/gtest/gtest.h" - -#include "chrome/browser/sync/glue/fake_data_type_controller.h" +#include "components/sync_driver/fake_data_type_controller.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -14,7 +11,10 @@ using syncer::ModelType; namespace browser_sync { FakeDataTypeController::FakeDataTypeController(ModelType type) - : state_(NOT_RUNNING), model_load_delayed_(false), type_(type) {} + : DataTypeController(base::MessageLoopProxy::current(), base::Closure()), + state_(NOT_RUNNING), + model_load_delayed_(false), + type_(type) {} FakeDataTypeController::~FakeDataTypeController() { } diff --git a/chrome/browser/sync/glue/fake_data_type_controller.h b/components/sync_driver/fake_data_type_controller.h index 33569fc..2292c4f 100644 --- a/chrome/browser/sync/glue/fake_data_type_controller.h +++ b/components/sync_driver/fake_data_type_controller.h @@ -1,12 +1,12 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_SYNC_GLUE_FAKE_DATA_TYPE_CONTROLLER_H__ -#define CHROME_BROWSER_SYNC_GLUE_FAKE_DATA_TYPE_CONTROLLER_H__ +#ifndef COMPONENTS_SYNC_DRIVER_FAKE_DATA_TYPE_CONTROLLER_H__ +#define COMPONENTS_SYNC_DRIVER_FAKE_DATA_TYPE_CONTROLLER_H__ -#include "chrome/browser/sync/glue/data_type_controller.h" -#include "chrome/browser/sync/glue/data_type_manager.h" +#include "components/sync_driver/data_type_controller.h" +#include "components/sync_driver/data_type_manager.h" namespace browser_sync { // Fake DataTypeController implementation that simulates the state @@ -68,4 +68,4 @@ class FakeDataTypeController : public DataTypeController { }; } // namespace browser_sync -#endif // CHROME_BROWSER_SYNC_GLUE_FAKE_DATA_TYPE_CONTROLLER_H__ +#endif // COMPONENTS_SYNC_DRIVER_FAKE_DATA_TYPE_CONTROLLER_H__ |