diff options
author | stanisc <stanisc@chromium.org> | 2014-09-25 23:17:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-26 06:17:51 +0000 |
commit | d0df01813574affc20bb17dfac783ad325d4bb06 (patch) | |
tree | 6f104952581c8098b4d7d4d156e43e18c9b447f3 | |
parent | 3cc3a684c62e2344aaa5a6a84f9300926330e4d3 (diff) | |
download | chromium_src-d0df01813574affc20bb17dfac783ad325d4bb06.zip chromium_src-d0df01813574affc20bb17dfac783ad325d4bb06.tar.gz chromium_src-d0df01813574affc20bb17dfac783ad325d4bb06.tar.bz2 |
Device info datatype should be moved to components/sync_driver.
Moving device_info* and local_device_info_provider.h to components/sync_driver
and updating namespaces for the related classes from browsing_sync to sync_driver.
Most of the changes are mechanical - trivial changes of header files and namespaces.
There are just few less trivial changes:
1) I've removed GetClientName from DeviceInfo because it depended on content/public.
Instead I've inlined GetClientName code (which is rather trivial) in two places where
it was used, including supervised_user_registration_utility.cc.
That required me to update DEPS file for supervised_user. There isn't anything new
in reality - these dependencies already existed indirectly.
2) Added two extra parameters to DeviceInfoDataTypeController to avoid having
direct dependencies on the browser.
TBR=pkasting@chromium.org,yoz@chromium.org
BUG=396136
Review URL: https://codereview.chromium.org/597423002
Cr-Commit-Position: refs/heads/master@{#296895}
46 files changed, 189 insertions, 168 deletions
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index a753ad6..4d43d58 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -109,6 +109,7 @@ include_rules = [ "+sync/api", # Sync API files. "+sync/internal_api/public/attachments", # Needed for tests. "+sync/protocol", # Sync protobuf files. + "+sync/util", # Sync utilities like GetSessionName. "+third_party/cros_system_api", "+win8/util", diff --git a/chrome/browser/extensions/api/sessions/sessions_apitest.cc b/chrome/browser/extensions/api/sessions/sessions_apitest.cc index a10e441..28cb25e 100644 --- a/chrome/browser/extensions/api/sessions/sessions_apitest.cc +++ b/chrome/browser/extensions/api/sessions/sessions_apitest.cc @@ -125,7 +125,7 @@ KeyedService* ExtensionSessionsTest::BuildProfileSyncService( new ProfileSyncComponentsFactoryMock(); factory->SetLocalDeviceInfoProvider( - scoped_ptr<LocalDeviceInfoProvider>( + scoped_ptr<sync_driver::LocalDeviceInfoProvider>( new browser_sync::LocalDeviceInfoProviderMock( kSessionTags[0], "machine name", diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc index 9b41995..c2c898f 100644 --- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc +++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.cc @@ -11,12 +11,12 @@ #include "base/values.h" #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/device_info.h" #include "components/crx_file/id_util.h" +#include "components/sync_driver/device_info.h" using base::DictionaryValue; using base::Value; -using browser_sync::DeviceInfo; +using sync_driver::DeviceInfo; namespace extensions { @@ -68,7 +68,7 @@ std::string GetRandomId( } void CreateMappingForUnmappedDevices( - std::vector<browser_sync::DeviceInfo*>* device_info, + std::vector<DeviceInfo*>* device_info, base::DictionaryValue* value) { for (unsigned int i = 0; i < device_info->size(); ++i) { DeviceInfo* device = (*device_info)[i]; diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h index 48a029a..a126633 100644 --- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h +++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h @@ -14,9 +14,9 @@ namespace base { class DictionaryValue; } // namespace base -namespace browser_sync { +namespace sync_driver { class DeviceInfo; -} // namespace browser_sync +} // namespace sync_driver class Profile; @@ -45,12 +45,12 @@ std::string GetGUIDFromPublicId( // The dictionary would have the public id as the key and the // device guid as the value. void CreateMappingForUnmappedDevices( - std::vector<browser_sync::DeviceInfo*>* device_info, + std::vector<sync_driver::DeviceInfo*>* device_info, base::DictionaryValue* value); // Gets the device info for a given client id. If the device is not found // the returned pointer would be null. -scoped_ptr<browser_sync::DeviceInfo> GetDeviceInfoForClientId( +scoped_ptr<sync_driver::DeviceInfo> GetDeviceInfoForClientId( const std::string& client_id, const std::string& extension_id, Profile* profile); diff --git a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc index 2464703..7a4bb6f 100644 --- a/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc +++ b/chrome/browser/extensions/api/signed_in_devices/id_mapping_helper_unittest.cc @@ -9,11 +9,11 @@ #include "base/memory/scoped_vector.h" #include "base/values.h" #include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h" -#include "chrome/browser/sync/glue/device_info.h" +#include "components/sync_driver/device_info.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using browser_sync::DeviceInfo; +using sync_driver::DeviceInfo; namespace extensions { bool VerifyDictionary( diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc index 02727a3..68d9922b 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.cc @@ -9,17 +9,17 @@ #include "base/values.h" #include "chrome/browser/extensions/api/signed_in_devices/id_mapping_helper.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/device_info_tracker.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/extensions/api/signed_in_devices.h" +#include "components/sync_driver/device_info_tracker.h" +#include "components/sync_driver/local_device_info_provider.h" #include "extensions/browser/extension_prefs.h" using base::DictionaryValue; -using browser_sync::DeviceInfo; -using browser_sync::DeviceInfoTracker; -using browser_sync::LocalDeviceInfoProvider; +using sync_driver::DeviceInfo; +using sync_driver::DeviceInfoTracker; +using sync_driver::LocalDeviceInfoProvider; namespace extensions { diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h index 774ca75..8fa8775 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h @@ -11,10 +11,10 @@ #include "base/memory/scoped_vector.h" #include "chrome/browser/extensions/chrome_extension_function.h" -namespace browser_sync { +namespace sync_driver { class DeviceInfo; class DeviceInfoTracker; -} // namespace browser_sync +} // namespace sync_driver namespace extensions { class ExtensionPrefs; @@ -28,13 +28,13 @@ namespace extensions { // filled with the list of devices associated with the account signed into this // |profile|. This function needs the |extension_id| because the // public device ids are set per extension. -ScopedVector<browser_sync::DeviceInfo> GetAllSignedInDevices( +ScopedVector<sync_driver::DeviceInfo> GetAllSignedInDevices( const std::string& extension_id, Profile* profile); -ScopedVector<browser_sync::DeviceInfo> GetAllSignedInDevices( +ScopedVector<sync_driver::DeviceInfo> GetAllSignedInDevices( const std::string& extension_id, - browser_sync::DeviceInfoTracker* device_tracker, + sync_driver::DeviceInfoTracker* device_tracker, ExtensionPrefs* extension_prefs); class SignedInDevicesGetFunction : public ChromeSyncExtensionFunction { diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc index 1ee7dd3..bcced2b 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc @@ -14,16 +14,16 @@ #include "chrome/browser/extensions/extension_api_unittest.h" #include "chrome/browser/extensions/test_extension_prefs.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/common/pref_names.h" +#include "components/sync_driver/device_info.h" #include "extensions/common/extension.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" -using browser_sync::DeviceInfo; -using browser_sync::DeviceInfoTracker; +using sync_driver::DeviceInfo; +using sync_driver::DeviceInfoTracker; using testing::Return; namespace extensions { diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc index 3eadd84..0e8cc26 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.cc @@ -15,15 +15,15 @@ #include "chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/common/extensions/api/signed_in_devices.h" +#include "components/sync_driver/device_info.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry.h" #include "extensions/common/extension.h" -using browser_sync::DeviceInfo; +using sync_driver::DeviceInfo; namespace extensions { namespace { diff --git a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h index 646f522..7843739 100644 --- a/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h +++ b/chrome/browser/extensions/api/signed_in_devices/signed_in_devices_manager.h @@ -10,7 +10,7 @@ #include "base/gtest_prod_util.h" #include "base/memory/scoped_vector.h" #include "base/scoped_observer.h" -#include "chrome/browser/sync/glue/device_info_tracker.h" +#include "components/sync_driver/device_info_tracker.h" #include "extensions/browser/browser_context_keyed_api_factory.h" #include "extensions/browser/event_router.h" #include "extensions/browser/extension_registry_observer.h" @@ -38,7 +38,7 @@ struct EventListenerInfo; // public ids for devices(public ids for a device, is not the same for // all extensions). class SignedInDevicesChangeObserver - : public browser_sync::DeviceInfoTracker::Observer { + : public sync_driver::DeviceInfoTracker::Observer { public: SignedInDevicesChangeObserver(const std::string& extension_id, Profile* profile); diff --git a/chrome/browser/supervised_user/supervised_user_registration_utility.cc b/chrome/browser/supervised_user/supervised_user_registration_utility.cc index c1eb8b0..0f58243 100644 --- a/chrome/browser/supervised_user/supervised_user_registration_utility.cc +++ b/chrome/browser/supervised_user/supervised_user_registration_utility.cc @@ -22,14 +22,15 @@ #include "chrome/browser/supervised_user/supervised_user_shared_settings_update.h" #include "chrome/browser/supervised_user/supervised_user_sync_service.h" #include "chrome/browser/supervised_user/supervised_user_sync_service_factory.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "components/signin/core/browser/profile_oauth2_token_service.h" #include "components/signin/core/browser/signin_client.h" #include "components/signin/core/browser/signin_manager.h" +#include "content/public/browser/browser_thread.h" #include "google_apis/gaia/gaia_urls.h" #include "google_apis/gaia/google_service_auth_error.h" +#include "sync/util/get_session_name.h" using base::DictionaryValue; @@ -304,7 +305,8 @@ void SupervisedUserRegistrationUtilityImpl::Register( weak_ptr_factory_.GetWeakPtr()))); } - browser_sync::DeviceInfo::GetClientName( + syncer::GetSessionName( + content::BrowserThread::GetBlockingPool(), base::Bind(&SupervisedUserRegistrationUtilityImpl::FetchToken, weak_ptr_factory_.GetWeakPtr())); } diff --git a/chrome/browser/sync/glue/device_info_data_type_controller_unittest.cc b/chrome/browser/sync/glue/device_info_data_type_controller_unittest.cc index 0f0a2b9..4b76c3d 100644 --- a/chrome/browser/sync/glue/device_info_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/device_info_data_type_controller_unittest.cc @@ -6,13 +6,14 @@ #include "base/callback.h" #include "base/memory/weak_ptr.h" #include "base/run_loop.h" -#include "chrome/browser/sync/glue/device_info_data_type_controller.h" #include "chrome/browser/sync/glue/local_device_info_provider_mock.h" #include "chrome/browser/sync/profile_sync_components_factory_mock.h" +#include "components/sync_driver/device_info_data_type_controller.h" #include "content/public/test/test_browser_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" using sync_driver::DataTypeController; +using sync_driver::DeviceInfoDataTypeController; namespace browser_sync { @@ -37,6 +38,8 @@ class DeviceInfoDataTypeControllerTest : public testing::Test { "device_id")); controller_ = new DeviceInfoDataTypeController( + base::MessageLoopProxy::current(), + base::Closure(), &profile_sync_factory_, local_device_.get()); diff --git a/chrome/browser/sync/glue/device_info_sync_service_unittest.cc b/chrome/browser/sync/glue/device_info_sync_service_unittest.cc index edf4e51c..5d66a81 100644 --- a/chrome/browser/sync/glue/device_info_sync_service_unittest.cc +++ b/chrome/browser/sync/glue/device_info_sync_service_unittest.cc @@ -3,8 +3,8 @@ // found in the LICENSE file. #include "base/message_loop/message_loop.h" -#include "chrome/browser/sync/glue/device_info_sync_service.h" #include "chrome/browser/sync/glue/local_device_info_provider_mock.h" +#include "components/sync_driver/device_info_sync_service.h" #include "content/public/test/test_browser_thread_bundle.h" #include "sync/api/sync_change.h" #include "sync/api/sync_change_processor.h" @@ -14,6 +14,8 @@ #include "sync/util/time.h" #include "testing/gtest/include/gtest/gtest.h" +using sync_driver::DeviceInfoSyncService; +using sync_driver::DeviceInfoTracker; using syncer::AttachmentIdList; using syncer::AttachmentServiceProxyForTest; using syncer::ModelType; diff --git a/chrome/browser/sync/glue/history_delete_directives_data_type_controller.h b/chrome/browser/sync/glue/history_delete_directives_data_type_controller.h index 7b7fbff..7e2bf46 100644 --- a/chrome/browser/sync/glue/history_delete_directives_data_type_controller.h +++ b/chrome/browser/sync/glue/history_delete_directives_data_type_controller.h @@ -5,8 +5,8 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_ #define CHROME_BROWSER_SYNC_GLUE_HISTORY_DELETE_DIRECTIVES_DATA_TYPE_CONTROLLER_H_ -#include "chrome/browser/sync/glue/local_device_info_provider.h" #include "chrome/browser/sync/profile_sync_service_observer.h" +#include "components/sync_driver/local_device_info_provider.h" #include "components/sync_driver/ui_data_type_controller.h" class Profile; diff --git a/chrome/browser/sync/glue/local_device_info_provider_impl.cc b/chrome/browser/sync/glue/local_device_info_provider_impl.cc index dadfb17..bc8e14a 100644 --- a/chrome/browser/sync/glue/local_device_info_provider_impl.cc +++ b/chrome/browser/sync/glue/local_device_info_provider_impl.cc @@ -5,6 +5,8 @@ #include "base/bind.h" #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" #include "chrome/common/chrome_version_info.h" +#include "content/public/browser/browser_thread.h" +#include "sync/util/get_session_name.h" #include "ui/base/device_form_factor.h" namespace browser_sync { @@ -102,7 +104,7 @@ std::string LocalDeviceInfoProviderImpl::MakeUserAgentForSyncApi( return user_agent; } -const DeviceInfo* +const sync_driver::DeviceInfo* LocalDeviceInfoProviderImpl::GetLocalDeviceInfo() const { return local_device_info_.get(); } @@ -111,7 +113,7 @@ std::string LocalDeviceInfoProviderImpl::GetLocalSyncCacheGUID() const { return cache_guid_; } -scoped_ptr<LocalDeviceInfoProvider::Subscription> +scoped_ptr<sync_driver::LocalDeviceInfoProvider::Subscription> LocalDeviceInfoProviderImpl::RegisterOnInitializedCallback( const base::Closure& callback) { DCHECK(!local_device_info_.get()); @@ -123,7 +125,8 @@ void LocalDeviceInfoProviderImpl::Initialize( DCHECK(!cache_guid.empty()); cache_guid_ = cache_guid; - DeviceInfo::GetClientName( + syncer::GetSessionName( + content::BrowserThread::GetBlockingPool(), base::Bind(&LocalDeviceInfoProviderImpl::InitializeContinuation, weak_factory_.GetWeakPtr(), cache_guid, @@ -136,16 +139,16 @@ void LocalDeviceInfoProviderImpl::InitializeContinuation( const std::string& session_name) { chrome::VersionInfo version_info; - local_device_info_.reset(new DeviceInfo(guid, - session_name, - version_info.CreateVersionString(), - MakeUserAgentForSyncApi(version_info), - GetLocalDeviceType(), - signin_scoped_device_id)); + local_device_info_.reset( + new sync_driver::DeviceInfo(guid, + session_name, + version_info.CreateVersionString(), + MakeUserAgentForSyncApi(version_info), + GetLocalDeviceType(), + signin_scoped_device_id)); // Notify observers. callback_list_.Notify(); } } // namespace browser_sync - diff --git a/chrome/browser/sync/glue/local_device_info_provider_impl.h b/chrome/browser/sync/glue/local_device_info_provider_impl.h index 2b71cd2..7b91fc4 100644 --- a/chrome/browser/sync/glue/local_device_info_provider_impl.h +++ b/chrome/browser/sync/glue/local_device_info_provider_impl.h @@ -6,8 +6,8 @@ #define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_IMPL_H_ #include "base/memory/weak_ptr.h" -#include "chrome/browser/sync/glue/device_info.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" +#include "components/sync_driver/device_info.h" +#include "components/sync_driver/local_device_info_provider.h" namespace chrome { class VersionInfo; @@ -15,13 +15,14 @@ class VersionInfo; namespace browser_sync { -class LocalDeviceInfoProviderImpl : public LocalDeviceInfoProvider { +class LocalDeviceInfoProviderImpl + : public sync_driver::LocalDeviceInfoProvider { public: LocalDeviceInfoProviderImpl(); virtual ~LocalDeviceInfoProviderImpl(); // LocalDeviceInfoProvider implementation. - virtual const DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; + virtual const sync_driver::DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; virtual std::string GetLocalSyncCacheGUID() const OVERRIDE; virtual void Initialize( const std::string& cache_guid, @@ -41,7 +42,7 @@ class LocalDeviceInfoProviderImpl : public LocalDeviceInfoProvider { const std::string& session_name); std::string cache_guid_; - scoped_ptr<DeviceInfo> local_device_info_; + scoped_ptr<sync_driver::DeviceInfo> local_device_info_; base::CallbackList<void(void)> callback_list_; base::WeakPtrFactory<LocalDeviceInfoProviderImpl> weak_factory_; diff --git a/chrome/browser/sync/glue/local_device_info_provider_mock.cc b/chrome/browser/sync/glue/local_device_info_provider_mock.cc index 863ca73..1c4c2db 100644 --- a/chrome/browser/sync/glue/local_device_info_provider_mock.cc +++ b/chrome/browser/sync/glue/local_device_info_provider_mock.cc @@ -18,7 +18,7 @@ LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock( const std::string& signin_scoped_device_id) : is_initialized_(true) { local_device_info_.reset( - new DeviceInfo( + new sync_driver::DeviceInfo( guid, client_name, chrome_version, @@ -29,7 +29,7 @@ LocalDeviceInfoProviderMock::LocalDeviceInfoProviderMock( LocalDeviceInfoProviderMock::~LocalDeviceInfoProviderMock() {} -const DeviceInfo* +const sync_driver::DeviceInfo* LocalDeviceInfoProviderMock::GetLocalDeviceInfo() const { return is_initialized_ ? local_device_info_.get() : NULL; } @@ -43,7 +43,7 @@ void LocalDeviceInfoProviderMock::Initialize( // Ignored for the mock provider. } -scoped_ptr<LocalDeviceInfoProvider::Subscription> +scoped_ptr<sync_driver::LocalDeviceInfoProvider::Subscription> LocalDeviceInfoProviderMock::RegisterOnInitializedCallback( const base::Closure& callback) { DCHECK(!is_initialized_); diff --git a/chrome/browser/sync/glue/local_device_info_provider_mock.h b/chrome/browser/sync/glue/local_device_info_provider_mock.h index a795aea..09c890b 100644 --- a/chrome/browser/sync/glue/local_device_info_provider_mock.h +++ b/chrome/browser/sync/glue/local_device_info_provider_mock.h @@ -5,12 +5,13 @@ #ifndef CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ #define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_MOCK_H_ -#include "chrome/browser/sync/glue/device_info.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" +#include "components/sync_driver/device_info.h" +#include "components/sync_driver/local_device_info_provider.h" namespace browser_sync { -class LocalDeviceInfoProviderMock : public LocalDeviceInfoProvider { +class LocalDeviceInfoProviderMock + : public sync_driver::LocalDeviceInfoProvider { public: // Creates uninitialized provider. LocalDeviceInfoProviderMock(); @@ -24,7 +25,7 @@ class LocalDeviceInfoProviderMock : public LocalDeviceInfoProvider { const std::string& signin_scoped_device_id); virtual ~LocalDeviceInfoProviderMock(); - virtual const DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; + virtual const sync_driver::DeviceInfo* GetLocalDeviceInfo() const OVERRIDE; virtual std::string GetLocalSyncCacheGUID() const OVERRIDE; virtual void Initialize( const std::string& cache_guid, @@ -37,7 +38,7 @@ class LocalDeviceInfoProviderMock : public LocalDeviceInfoProvider { private: bool is_initialized_; - scoped_ptr<DeviceInfo> local_device_info_; + scoped_ptr<sync_driver::DeviceInfo> local_device_info_; base::CallbackList<void(void)> callback_list_; }; diff --git a/chrome/browser/sync/glue/local_device_info_provider_unittest.cc b/chrome/browser/sync/glue/local_device_info_provider_unittest.cc index f09f59b..4932323 100644 --- a/chrome/browser/sync/glue/local_device_info_provider_unittest.cc +++ b/chrome/browser/sync/glue/local_device_info_provider_unittest.cc @@ -10,6 +10,9 @@ #include "sync/util/get_session_name.h" #include "testing/gtest/include/gtest/gtest.h" +using sync_driver::DeviceInfo; +using sync_driver::LocalDeviceInfoProvider; + namespace browser_sync { const char kLocalDeviceGuid[] = "foo"; diff --git a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc index a7d0aa0..fb02930 100644 --- a/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc +++ b/chrome/browser/sync/glue/sync_backend_host_impl_unittest.cc @@ -15,13 +15,13 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/invalidation/profile_invalidation_provider_factory.h" #include "chrome/browser/prefs/pref_service_syncable.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/test/base/testing_browser_process.h" #include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile_manager.h" #include "components/invalidation/invalidator_state.h" #include "components/invalidation/invalidator_storage.h" #include "components/invalidation/profile_invalidation_provider.h" +#include "components/sync_driver/device_info.h" #include "components/sync_driver/sync_frontend.h" #include "components/sync_driver/sync_prefs.h" #include "content/public/browser/notification_service.h" diff --git a/chrome/browser/sync/profile_sync_components_factory.h b/chrome/browser/sync/profile_sync_components_factory.h index 8c77e41..207eb03 100644 --- a/chrome/browser/sync/profile_sync_components_factory.h +++ b/chrome/browser/sync/profile_sync_components_factory.h @@ -22,7 +22,6 @@ class Profile; class ProfileSyncService; namespace browser_sync { -class LocalDeviceInfoProvider; class SyncBackendHost; } // namespace browser_sync @@ -35,6 +34,7 @@ class DataTypeManager; class DataTypeManagerObserver; class DataTypeStatusTable; class GenericChangeProcessor; +class LocalDeviceInfoProvider; class SyncPrefs; } // namespace sync_driver @@ -98,7 +98,7 @@ class ProfileSyncComponentsFactory const base::FilePath& sync_folder) = 0; // Creating this in the factory helps us mock it out in testing. - virtual scoped_ptr<browser_sync::LocalDeviceInfoProvider> + virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider> CreateLocalDeviceInfoProvider() = 0; // Legacy datatypes that need to be converted to the SyncableService API. diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.cc b/chrome/browser/sync/profile_sync_components_factory_impl.cc index a899107..a85b2a1 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.cc +++ b/chrome/browser/sync/profile_sync_components_factory_impl.cc @@ -24,7 +24,6 @@ #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/device_info_data_type_controller.h" #include "chrome/browser/sync/glue/extension_backed_data_type_controller.h" #include "chrome/browser/sync/glue/extension_data_type_controller.h" #include "chrome/browser/sync/glue/extension_setting_data_type_controller.h" @@ -58,6 +57,7 @@ #include "components/signin/core/browser/signin_manager.h" #include "components/sync_driver/data_type_manager_impl.h" #include "components/sync_driver/data_type_manager_observer.h" +#include "components/sync_driver/device_info_data_type_controller.h" #include "components/sync_driver/generic_change_processor.h" #include "components/sync_driver/proxy_data_type_controller.h" #include "components/sync_driver/shared_change_processor.h" @@ -105,7 +105,6 @@ using browser_sync::BookmarkChangeProcessor; using browser_sync::BookmarkDataTypeController; using browser_sync::BookmarkModelAssociator; using browser_sync::ChromeReportUnrecoverableError; -using browser_sync::DeviceInfoDataTypeController; using browser_sync::ExtensionBackedDataTypeController; using browser_sync::ExtensionDataTypeController; using browser_sync::ExtensionSettingDataTypeController; @@ -124,6 +123,7 @@ using sync_driver::DataTypeErrorHandler; using sync_driver::DataTypeManager; using sync_driver::DataTypeManagerImpl; using sync_driver::DataTypeManagerObserver; +using sync_driver::DeviceInfoDataTypeController; using sync_driver::ProxyDataTypeController; using sync_driver::SharedChangeProcessor; using sync_driver::UIDataTypeController; @@ -189,7 +189,10 @@ void ProfileSyncComponentsFactoryImpl::RegisterCommonDataTypes( ProfileSyncService* pss) { // TODO(stanisc): can DEVICE_INFO be one of disabled datatypes? pss->RegisterDataTypeController(new DeviceInfoDataTypeController( - this, pss->GetLocalDeviceInfoProvider())); + BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), + base::Bind(&ChromeReportUnrecoverableError), + this, + pss->GetLocalDeviceInfoProvider())); // Autofill sync is enabled by default. Register unless explicitly // disabled. @@ -437,9 +440,9 @@ ProfileSyncComponentsFactoryImpl::CreateSyncBackendHost( sync_prefs, sync_folder); } -scoped_ptr<browser_sync::LocalDeviceInfoProvider> +scoped_ptr<sync_driver::LocalDeviceInfoProvider> ProfileSyncComponentsFactoryImpl::CreateLocalDeviceInfoProvider() { - return scoped_ptr<browser_sync::LocalDeviceInfoProvider>( + return scoped_ptr<sync_driver::LocalDeviceInfoProvider>( new browser_sync::LocalDeviceInfoProviderImpl()); } diff --git a/chrome/browser/sync/profile_sync_components_factory_impl.h b/chrome/browser/sync/profile_sync_components_factory_impl.h index eb30a93..b23e736 100644 --- a/chrome/browser/sync/profile_sync_components_factory_impl.h +++ b/chrome/browser/sync/profile_sync_components_factory_impl.h @@ -60,7 +60,7 @@ class ProfileSyncComponentsFactoryImpl : public ProfileSyncComponentsFactory { const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, const base::FilePath& sync_folder) OVERRIDE; - virtual scoped_ptr<browser_sync::LocalDeviceInfoProvider> + virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider> CreateLocalDeviceInfoProvider() OVERRIDE; virtual base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.cc b/chrome/browser/sync/profile_sync_components_factory_mock.cc index 14786932..ada00f9 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.cc +++ b/chrome/browser/sync/profile_sync_components_factory_mock.cc @@ -49,12 +49,12 @@ ProfileSyncComponentsFactoryMock::MakeSyncComponents() { change_processor_.release()); } -scoped_ptr<browser_sync::LocalDeviceInfoProvider> +scoped_ptr<sync_driver::LocalDeviceInfoProvider> ProfileSyncComponentsFactoryMock::CreateLocalDeviceInfoProvider() { return local_device_.Pass(); } void ProfileSyncComponentsFactoryMock::SetLocalDeviceInfoProvider( - scoped_ptr<browser_sync::LocalDeviceInfoProvider> local_device) { + scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device) { local_device_ = local_device.Pass(); } diff --git a/chrome/browser/sync/profile_sync_components_factory_mock.h b/chrome/browser/sync/profile_sync_components_factory_mock.h index 978f050..224ea9c 100644 --- a/chrome/browser/sync/profile_sync_components_factory_mock.h +++ b/chrome/browser/sync/profile_sync_components_factory_mock.h @@ -43,10 +43,10 @@ class ProfileSyncComponentsFactoryMock : public ProfileSyncComponentsFactory { const base::WeakPtr<sync_driver::SyncPrefs>& sync_prefs, const base::FilePath& sync_folder)); - virtual scoped_ptr<browser_sync::LocalDeviceInfoProvider> + virtual scoped_ptr<sync_driver::LocalDeviceInfoProvider> CreateLocalDeviceInfoProvider() OVERRIDE; void SetLocalDeviceInfoProvider( - scoped_ptr<browser_sync::LocalDeviceInfoProvider> local_device); + scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device); MOCK_METHOD1(GetSyncableServiceForType, base::WeakPtr<syncer::SyncableService>(syncer::ModelType)); @@ -75,7 +75,7 @@ class ProfileSyncComponentsFactoryMock : public ProfileSyncComponentsFactory { scoped_ptr<sync_driver::ChangeProcessor> change_processor_; // LocalDeviceInfoProvider is initially owned by this class, // transferred to caller when CreateLocalDeviceInfoProvider is called. - scoped_ptr<browser_sync::LocalDeviceInfoProvider> local_device_; + scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; }; #endif // CHROME_BROWSER_SYNC_PROFILE_SYNC_COMPONENTS_FACTORY_MOCK_H__ diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc index a23f96e..3135388 100644 --- a/chrome/browser/sync/profile_sync_service.cc +++ b/chrome/browser/sync/profile_sync_service.cc @@ -42,7 +42,6 @@ #include "chrome/browser/signin/signin_manager_factory.h" #include "chrome/browser/sync/backend_migrator.h" #include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/favicon_cache.h" #include "chrome/browser/sync/glue/sync_backend_host.h" #include "chrome/browser/sync/glue/sync_backend_host_impl.h" @@ -74,6 +73,7 @@ #include "components/signin/core/browser/signin_metrics.h" #include "components/sync_driver/change_processor.h" #include "components/sync_driver/data_type_controller.h" +#include "components/sync_driver/device_info.h" #include "components/sync_driver/pref_names.h" #include "components/sync_driver/system_encryptor.h" #include "components/sync_driver/user_selectable_sync_type.h" @@ -105,11 +105,13 @@ using browser_sync::NotificationServiceSessionsRouter; using browser_sync::ProfileSyncServiceStartBehavior; +using browser_sync::SessionsSyncManager; using browser_sync::SyncBackendHost; using sync_driver::ChangeProcessor; using sync_driver::DataTypeController; using sync_driver::DataTypeManager; using sync_driver::DataTypeStatusTable; +using sync_driver::DeviceInfoSyncService; using syncer::ModelType; using syncer::ModelTypeSet; using syncer::JsBackend; @@ -451,7 +453,7 @@ ProfileSyncService::GetSyncedWindowDelegatesGetter() const { return sessions_sync_manager_->GetSyncedWindowDelegatesGetter(); } -browser_sync::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() +sync_driver::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() const { if (!IsDataTypeControllerRunning(syncer::DEVICE_INFO)) return NULL; @@ -459,7 +461,7 @@ browser_sync::DeviceInfoTracker* ProfileSyncService::GetDeviceInfoTracker() return device_info_sync_service_.get(); } -browser_sync::LocalDeviceInfoProvider* +sync_driver::LocalDeviceInfoProvider* ProfileSyncService::GetLocalDeviceInfoProvider() { return local_device_.get(); } @@ -1121,7 +1123,7 @@ void ProfileSyncService::OnSyncCycleCompleted() { // Trigger garbage collection of old sessions now that we've downloaded // any new session data. base::MessageLoop::current()->PostTask(FROM_HERE, base::Bind( - &browser_sync::SessionsSyncManager::DoGarbageCollection, + &SessionsSyncManager::DoGarbageCollection, base::AsWeakPtr(sessions_sync_manager_.get()))); } DVLOG(2) << "Notifying observers sync cycle completed"; diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h index 4d88648..ac43cf8 100644 --- a/chrome/browser/sync/profile_sync_service.h +++ b/chrome/browser/sync/profile_sync_service.h @@ -23,8 +23,6 @@ #include "chrome/browser/browsing_data/browsing_data_remover.h" #include "chrome/browser/sync/backend_unrecoverable_error_handler.h" #include "chrome/browser/sync/backup_rollback_controller.h" -#include "chrome/browser/sync/glue/device_info_sync_service.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" #include "chrome/browser/sync/glue/sync_backend_host.h" #include "chrome/browser/sync/profile_sync_service_base.h" #include "chrome/browser/sync/profile_sync_service_observer.h" @@ -38,6 +36,8 @@ #include "components/sync_driver/data_type_manager.h" #include "components/sync_driver/data_type_manager_observer.h" #include "components/sync_driver/data_type_status_table.h" +#include "components/sync_driver/device_info_sync_service.h" +#include "components/sync_driver/local_device_info_provider.h" #include "components/sync_driver/non_blocking_data_type_manager.h" #include "components/sync_driver/sync_frontend.h" #include "components/sync_driver/sync_prefs.h" @@ -78,6 +78,8 @@ class SyncSessionSnapshot; namespace sync_driver { class ChangeProcessor; class DataTypeManager; +class DeviceInfoSyncService; +class LocalDeviceInfoProvider; } // namespace sync_driver namespace syncer { @@ -94,10 +96,6 @@ namespace sync_pb { class EncryptedData; } // namespace sync_pb -using browser_sync::DeviceInfoSyncService; -using browser_sync::LocalDeviceInfoProvider; -using browser_sync::SessionsSyncManager; - // ProfileSyncService is the layer between browser subsystems like bookmarks, // and the sync backend. Each subsystem is logically thought of as being // a sync datatype. @@ -378,11 +376,11 @@ class ProfileSyncService : public ProfileSyncServiceBase, virtual syncer::SyncableService* GetDeviceInfoSyncableService(); // Returns DeviceInfo provider for the local device. - virtual browser_sync::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); + virtual sync_driver::LocalDeviceInfoProvider* GetLocalDeviceInfoProvider(); // Returns synced devices tracker. If DEVICE_INFO model type isn't yet // enabled or syncing, returns NULL. - virtual browser_sync::DeviceInfoTracker* GetDeviceInfoTracker() const; + virtual sync_driver::DeviceInfoTracker* GetDeviceInfoTracker() const; // Fills state_map with a map of current data types that are possible to // sync, as well as their states. @@ -1127,11 +1125,11 @@ class ProfileSyncService : public ProfileSyncServiceBase, GoogleServiceAuthError last_get_token_error_; base::Time next_token_request_time_; - scoped_ptr<LocalDeviceInfoProvider> local_device_; + scoped_ptr<sync_driver::LocalDeviceInfoProvider> local_device_; // Locally owned SyncableService implementations. - scoped_ptr<SessionsSyncManager> sessions_sync_manager_; - scoped_ptr<DeviceInfoSyncService> device_info_sync_service_; + scoped_ptr<browser_sync::SessionsSyncManager> sessions_sync_manager_; + scoped_ptr<sync_driver::DeviceInfoSyncService> device_info_sync_service_; scoped_ptr<syncer::NetworkResources> network_resources_; diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h index 25074e6..53253a2 100644 --- a/chrome/browser/sync/profile_sync_service_mock.h +++ b/chrome/browser/sync/profile_sync_service_mock.h @@ -10,11 +10,11 @@ #include "base/memory/weak_ptr.h" #include "base/strings/string16.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/change_processor.h" #include "components/sync_driver/data_type_controller.h" +#include "components/sync_driver/device_info.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/sessions/session_data_type_controller.cc b/chrome/browser/sync/sessions/session_data_type_controller.cc index fcf6dc7..b2468ba 100644 --- a/chrome/browser/sync/sessions/session_data_type_controller.cc +++ b/chrome/browser/sync/sessions/session_data_type_controller.cc @@ -24,7 +24,7 @@ SessionDataTypeController::SessionDataTypeController( sync_driver::SyncApiComponentFactory* sync_factory, Profile* profile, SyncedWindowDelegatesGetter* synced_window_getter, - LocalDeviceInfoProvider* local_device) + sync_driver::LocalDeviceInfoProvider* local_device) : UIDataTypeController( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), base::Bind(&ChromeReportUnrecoverableError), diff --git a/chrome/browser/sync/sessions/session_data_type_controller.h b/chrome/browser/sync/sessions/session_data_type_controller.h index 7201d14..0705c64 100644 --- a/chrome/browser/sync/sessions/session_data_type_controller.h +++ b/chrome/browser/sync/sessions/session_data_type_controller.h @@ -6,7 +6,7 @@ #define CHROME_BROWSER_SYNC_SESSIONS_SESSION_DATA_TYPE_CONTROLLER_H_ #include "base/prefs/pref_change_registrar.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" +#include "components/sync_driver/local_device_info_provider.h" #include "components/sync_driver/ui_data_type_controller.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -26,7 +26,7 @@ class SessionDataTypeController : public sync_driver::UIDataTypeController, SessionDataTypeController(sync_driver::SyncApiComponentFactory* factory, Profile* profile, SyncedWindowDelegatesGetter* synced_window_getter, - LocalDeviceInfoProvider* local_device); + sync_driver::LocalDeviceInfoProvider* local_device); // NotificationObserver interface. virtual void Observe(int type, @@ -52,8 +52,8 @@ class SessionDataTypeController : public sync_driver::UIDataTypeController, SyncedWindowDelegatesGetter* synced_window_getter_; content::NotificationRegistrar notification_registrar_; - LocalDeviceInfoProvider* const local_device_; - scoped_ptr<LocalDeviceInfoProvider::Subscription> subscription_; + sync_driver::LocalDeviceInfoProvider* const local_device_; + scoped_ptr<sync_driver::LocalDeviceInfoProvider::Subscription> subscription_; // Flags that indicate the reason for pending loading models. bool waiting_on_session_restore_; diff --git a/chrome/browser/sync/sessions/sessions_sync_manager.cc b/chrome/browser/sync/sessions/sessions_sync_manager.cc index c40a184..0becf03 100644 --- a/chrome/browser/sync/sessions/sessions_sync_manager.cc +++ b/chrome/browser/sync/sessions/sessions_sync_manager.cc @@ -6,12 +6,12 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" #include "chrome/browser/sync/glue/synced_tab_delegate.h" #include "chrome/browser/sync/glue/synced_window_delegate.h" #include "chrome/browser/sync/sessions/sessions_util.h" #include "chrome/browser/sync/sessions/synced_window_delegates_getter.h" #include "chrome/common/url_constants.h" +#include "components/sync_driver/local_device_info_provider.h" #include "content/public/browser/favicon_status.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" @@ -25,6 +25,8 @@ using content::NavigationEntry; using sessions::SerializedNavigationEntry; +using sync_driver::DeviceInfo; +using sync_driver::LocalDeviceInfoProvider; using syncer::SyncChange; using syncer::SyncData; diff --git a/chrome/browser/sync/sessions/sessions_sync_manager.h b/chrome/browser/sync/sessions/sessions_sync_manager.h index 92dc1e6..01ecf90 100644 --- a/chrome/browser/sync/sessions/sessions_sync_manager.h +++ b/chrome/browser/sync/sessions/sessions_sync_manager.h @@ -16,13 +16,13 @@ #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "chrome/browser/sessions/session_types.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/favicon_cache.h" #include "chrome/browser/sync/glue/synced_session.h" #include "chrome/browser/sync/glue/synced_session_tracker.h" #include "chrome/browser/sync/open_tabs_ui_delegate.h" #include "chrome/browser/sync/sessions/tab_node_pool.h" #include "components/sessions/session_id.h" +#include "components/sync_driver/device_info.h" #include "components/sync_driver/sync_prefs.h" #include "sync/api/syncable_service.h" @@ -32,6 +32,10 @@ namespace syncer { class SyncErrorFactory; } +namespace sync_driver { +class LocalDeviceInfoProvider; +} + namespace sync_pb { class SessionHeader; class SessionSpecifics; @@ -43,7 +47,6 @@ class TabNavigation; namespace browser_sync { class DataTypeErrorHandler; -class LocalDeviceInfoProvider; class SyncedTabDelegate; class SyncedWindowDelegate; class SyncedWindowDelegatesGetter; @@ -84,7 +87,7 @@ class SessionsSyncManager : public syncer::SyncableService, public LocalSessionEventHandler { public: SessionsSyncManager(Profile* profile, - LocalDeviceInfoProvider* local_device, + sync_driver::LocalDeviceInfoProvider* local_device, scoped_ptr<LocalSessionEventRouter> router); virtual ~SessionsSyncManager(); @@ -353,7 +356,7 @@ class SessionsSyncManager : public syncer::SyncableService, scoped_ptr<syncer::SyncChangeProcessor> sync_processor_; // Local device info provider, owned by ProfileSyncService. - const LocalDeviceInfoProvider* const local_device_; + const sync_driver::LocalDeviceInfoProvider* const local_device_; // Unique client tag. std::string current_machine_tag_; diff --git a/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc b/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc index 925d817..cbac398 100644 --- a/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc +++ b/chrome/browser/sync/sessions/sessions_sync_manager_unittest.cc @@ -8,7 +8,6 @@ #include "chrome/browser/chrome_notification_types.h" #include "chrome/browser/sessions/session_tab_helper.h" #include "chrome/browser/sessions/session_types.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/local_device_info_provider_mock.h" #include "chrome/browser/sync/glue/session_sync_test_helper.h" #include "chrome/browser/sync/glue/synced_tab_delegate.h" @@ -21,6 +20,7 @@ #include "chrome/test/base/browser_with_test_window_test.h" #include "components/sessions/serialized_navigation_entry_test_helper.h" #include "components/sessions/session_id.h" +#include "components/sync_driver/device_info.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_service.h" @@ -35,6 +35,8 @@ using content::WebContents; using sessions::SerializedNavigationEntry; using sessions::SerializedNavigationEntryTestHelper; +using sync_driver::DeviceInfo; +using sync_driver::LocalDeviceInfoProvider; using syncer::SyncChange; using syncer::SyncData; diff --git a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm index 437fe0d..05333b3 100644 --- a/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm +++ b/chrome/browser/ui/cocoa/wrench_menu/wrench_menu_controller_unittest.mm @@ -7,7 +7,6 @@ #include "base/strings/sys_string_conversions.h" #include "base/strings/utf_string_conversions.h" #include "chrome/app/chrome_command_ids.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/glue/local_device_info_provider_mock.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/sync/sessions/sessions_sync_manager.h" diff --git a/chrome/browser/ui/webui/history_ui.cc b/chrome/browser/ui/webui/history_ui.cc index d0b867a..a1995d4 100644 --- a/chrome/browser/ui/webui/history_ui.cc +++ b/chrome/browser/ui/webui/history_ui.cc @@ -27,7 +27,6 @@ #include "chrome/browser/history/web_history_service.h" #include "chrome/browser/history/web_history_service_factory.h" #include "chrome/browser/profiles/profile.h" -#include "chrome/browser/sync/glue/device_info.h" #include "chrome/browser/sync/profile_sync_service.h" #include "chrome/browser/sync/profile_sync_service_factory.h" #include "chrome/browser/ui/browser_finder.h" @@ -42,6 +41,7 @@ #include "components/bookmarks/browser/bookmark_utils.h" #include "components/history/core/browser/history_types.h" #include "components/search/search.h" +#include "components/sync_driver/device_info.h" #include "content/public/browser/notification_details.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/url_data_source.h" @@ -236,7 +236,7 @@ void GetDeviceNameAndType(const ProfileSyncService* sync_service, // DeviceInfoTracker becomes available when Sync backend gets initialed. // It must exist in order for remote history entries to be available. if (sync_service && sync_service->GetDeviceInfoTracker()) { - scoped_ptr<browser_sync::DeviceInfo> device_info = + scoped_ptr<sync_driver::DeviceInfo> device_info = sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); if (device_info.get()) { *name = device_info->client_name(); diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 2f33d48..682114c 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -1219,13 +1219,6 @@ 'browser/sync/glue/browser_thread_model_worker.h', 'browser/sync/glue/chrome_report_unrecoverable_error.cc', 'browser/sync/glue/chrome_report_unrecoverable_error.h', - 'browser/sync/glue/device_info.cc', - 'browser/sync/glue/device_info.h', - 'browser/sync/glue/device_info_data_type_controller.cc', - 'browser/sync/glue/device_info_data_type_controller.h', - 'browser/sync/glue/device_info_sync_service.cc', - 'browser/sync/glue/device_info_sync_service.h', - 'browser/sync/glue/device_info_tracker.h', 'browser/sync/glue/extensions_activity_monitor.cc', 'browser/sync/glue/extensions_activity_monitor.h', 'browser/sync/glue/favicon_cache.cc', @@ -1240,7 +1233,6 @@ 'browser/sync/glue/invalidation_adapter.h', 'browser/sync/glue/invalidation_helper.cc', 'browser/sync/glue/invalidation_helper.h', - 'browser/sync/glue/local_device_info_provider.h', 'browser/sync/glue/local_device_info_provider_impl.cc', 'browser/sync/glue/local_device_info_provider_impl.h', 'browser/sync/glue/non_frontend_data_type_controller.cc', diff --git a/components/sync_driver.gypi b/components/sync_driver.gypi index 5977788..7b8eb0a 100644 --- a/components/sync_driver.gypi +++ b/components/sync_driver.gypi @@ -34,10 +34,18 @@ 'sync_driver/data_type_manager_observer.h', 'sync_driver/data_type_status_table.cc', 'sync_driver/data_type_status_table.h', + 'sync_driver/device_info.cc', + 'sync_driver/device_info.h', + 'sync_driver/device_info_data_type_controller.cc', + 'sync_driver/device_info_data_type_controller.h', + 'sync_driver/device_info_sync_service.cc', + 'sync_driver/device_info_sync_service.h', + 'sync_driver/device_info_tracker.h', 'sync_driver/generic_change_processor.cc', 'sync_driver/generic_change_processor.h', 'sync_driver/generic_change_processor_factory.cc', 'sync_driver/generic_change_processor_factory.h', + 'sync_driver/local_device_info_provider.h', 'sync_driver/model_association_manager.cc', 'sync_driver/model_association_manager.h', 'sync_driver/model_associator.h', diff --git a/components/sync_driver/BUILD.gn b/components/sync_driver/BUILD.gn index 04dcc74..5a04237 100644 --- a/components/sync_driver/BUILD.gn +++ b/components/sync_driver/BUILD.gn @@ -20,10 +20,18 @@ static_library("sync_driver") { "data_type_manager_observer.h", "data_type_status_table.cc", "data_type_status_table.h", + "device_info.cc", + "device_info.h", + "device_info_data_type_controller.cc", + "device_info_data_type_controller.h", + "device_info_sync_service.cc", + "device_info_sync_service.h", + "device_info_tracker.h", "generic_change_processor.cc", "generic_change_processor.h", "generic_change_processor_factory.cc", "generic_change_processor_factory.h", + "local_device_info_provider.h", "model_association_manager.cc", "model_association_manager.h", "model_associator.h", diff --git a/chrome/browser/sync/glue/device_info.cc b/components/sync_driver/device_info.cc index 8d07eea..c80a157 100644 --- a/chrome/browser/sync/glue/device_info.cc +++ b/components/sync_driver/device_info.cc @@ -3,11 +3,9 @@ // found in the LICENSE file. #include "base/values.h" -#include "chrome/browser/sync/glue/device_info.h" -#include "content/public/browser/browser_thread.h" -#include "sync/util/get_session_name.h" +#include "components/sync_driver/device_info.h" -namespace browser_sync { +namespace sync_driver { DeviceInfo::DeviceInfo(const std::string& guid, const std::string& client_name, @@ -112,9 +110,4 @@ void DeviceInfo::set_public_id(std::string id) { public_id_ = id; } -// static. -void DeviceInfo::GetClientName(const GetClientNameCallback& callback) { - syncer::GetSessionName(content::BrowserThread::GetBlockingPool(), callback); -} - -} // namespace browser_sync +} // namespace sync_driver diff --git a/chrome/browser/sync/glue/device_info.h b/components/sync_driver/device_info.h index 3faf668..d2a8f49 100644 --- a/chrome/browser/sync/glue/device_info.h +++ b/components/sync_driver/device_info.h @@ -2,8 +2,8 @@ // 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_DEVICE_INFO_H_ -#define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ +#ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ +#define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ #include <string> @@ -15,13 +15,11 @@ namespace base { class DictionaryValue; } -namespace browser_sync { +namespace sync_driver { // A class that holds information regarding the properties of a device. class DeviceInfo { public: - typedef base::Callback<void(const std::string&)> GetClientNameCallback; - DeviceInfo(const std::string& guid, const std::string& client_name, const std::string& chrome_version, @@ -76,9 +74,6 @@ class DeviceInfo { // which extension APIs can expose to third party apps. base::DictionaryValue* ToValue(); - // Gets the local device name and passes it as a parameter to callback. - static void GetClientName(const GetClientNameCallback& callback); - private: const std::string guid_; @@ -101,6 +96,6 @@ class DeviceInfo { DISALLOW_COPY_AND_ASSIGN(DeviceInfo); }; -} // namespace browser_sync +} // namespace sync_driver -#endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_H_ +#endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_H_ diff --git a/chrome/browser/sync/glue/device_info_data_type_controller.cc b/components/sync_driver/device_info_data_type_controller.cc index 81d0fa8..592633d 100644 --- a/chrome/browser/sync/glue/device_info_data_type_controller.cc +++ b/components/sync_driver/device_info_data_type_controller.cc @@ -2,22 +2,21 @@ // 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/device_info_data_type_controller.h" +#include "components/sync_driver/device_info_data_type_controller.h" -#include "chrome/browser/sync/glue/chrome_report_unrecoverable_error.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" -#include "content/public/browser/browser_thread.h" +#include "base/callback.h" +#include "components/sync_driver/local_device_info_provider.h" -using content::BrowserThread; - -namespace browser_sync { +namespace sync_driver { DeviceInfoDataTypeController::DeviceInfoDataTypeController( - sync_driver::SyncApiComponentFactory* sync_factory, + const scoped_refptr<base::MessageLoopProxy>& ui_thread, + const base::Closure& error_callback, + SyncApiComponentFactory* sync_factory, LocalDeviceInfoProvider* local_device_info_provider) : UIDataTypeController( - BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), - base::Bind(&ChromeReportUnrecoverableError), + ui_thread, + error_callback, syncer::DEVICE_INFO, sync_factory), local_device_info_provider_(local_device_info_provider) { @@ -39,7 +38,6 @@ bool DeviceInfoDataTypeController::StartModels() { } void DeviceInfoDataTypeController::OnLocalDeviceInfoLoaded() { - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(state_, MODEL_STARTING); DCHECK(local_device_info_provider_->GetLocalDeviceInfo()); @@ -47,4 +45,4 @@ void DeviceInfoDataTypeController::OnLocalDeviceInfoLoaded() { OnModelLoaded(); } -} // namespace browser_sync +} // namespace sync_driver diff --git a/chrome/browser/sync/glue/device_info_data_type_controller.h b/components/sync_driver/device_info_data_type_controller.h index 38c7b45..aa1b067 100644 --- a/chrome/browser/sync/glue/device_info_data_type_controller.h +++ b/components/sync_driver/device_info_data_type_controller.h @@ -2,20 +2,22 @@ // 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_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ -#define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ +#ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ +#define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ #include "base/memory/scoped_ptr.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" +#include "components/sync_driver/local_device_info_provider.h" #include "components/sync_driver/ui_data_type_controller.h" -namespace browser_sync { +namespace sync_driver { // DataTypeController for DEVICE_INFO model type. -class DeviceInfoDataTypeController : public sync_driver::UIDataTypeController { +class DeviceInfoDataTypeController : public UIDataTypeController { public: DeviceInfoDataTypeController( - sync_driver::SyncApiComponentFactory* sync_factory, + const scoped_refptr<base::MessageLoopProxy>& ui_thread, + const base::Closure& error_callback, + SyncApiComponentFactory* sync_factory, LocalDeviceInfoProvider* local_device_info_provider); private: @@ -33,6 +35,6 @@ class DeviceInfoDataTypeController : public sync_driver::UIDataTypeController { DISALLOW_COPY_AND_ASSIGN(DeviceInfoDataTypeController); }; -} // namespace browser_sync +} // namespace sync_driver -#endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ +#endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_DATA_TYPE_CONTROLLER_H_ diff --git a/chrome/browser/sync/glue/device_info_sync_service.cc b/components/sync_driver/device_info_sync_service.cc index fe7ccc1..cdb98e1 100644 --- a/chrome/browser/sync/glue/device_info_sync_service.cc +++ b/components/sync_driver/device_info_sync_service.cc @@ -2,15 +2,15 @@ // 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/device_info_sync_service.h" +#include "components/sync_driver/device_info_sync_service.h" #include "base/strings/stringprintf.h" -#include "chrome/browser/sync/glue/local_device_info_provider.h" +#include "components/sync_driver/local_device_info_provider.h" #include "sync/api/sync_change.h" #include "sync/protocol/sync.pb.h" #include "sync/util/time.h" -namespace browser_sync { +namespace sync_driver { using syncer::ModelType; using syncer::SyncChange; @@ -340,4 +340,4 @@ void DeviceInfoSyncService::DeleteSyncData(const std::string& client_id) { } } -} // namespace browser_sync +} // namespace sync_driver diff --git a/chrome/browser/sync/glue/device_info_sync_service.h b/components/sync_driver/device_info_sync_service.h index d638e53..26eb9a0 100644 --- a/chrome/browser/sync/glue/device_info_sync_service.h +++ b/components/sync_driver/device_info_sync_service.h @@ -2,17 +2,17 @@ // 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_DEVICE_INFO_SYNC_SERVICE_H_ -#define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_SYNC_SERVICE_H_ +#ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ +#define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ #include "base/observer_list.h" -#include "chrome/browser/sync/glue/device_info_tracker.h" +#include "components/sync_driver/device_info_tracker.h" #include "sync/api/sync_change_processor.h" #include "sync/api/sync_data.h" #include "sync/api/sync_error_factory.h" #include "sync/api/syncable_service.h" -namespace browser_sync { +namespace sync_driver { class LocalDeviceInfoProvider; @@ -103,6 +103,6 @@ class DeviceInfoSyncService : public syncer::SyncableService, DISALLOW_COPY_AND_ASSIGN(DeviceInfoSyncService); }; -} // namespace browser_sync +} // namespace sync_driver -#endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_SYNC_SERVICE_H_ +#endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_SYNC_SERVICE_H_ diff --git a/chrome/browser/sync/glue/device_info_tracker.h b/components/sync_driver/device_info_tracker.h index 8244401..cad6e87 100644 --- a/chrome/browser/sync/glue/device_info_tracker.h +++ b/components/sync_driver/device_info_tracker.h @@ -2,14 +2,14 @@ // 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_DEVICE_INFO_TRACKER_H_ -#define CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_TRACKER_H_ +#ifndef COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_ +#define COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_ #include "base/memory/scoped_ptr.h" #include "base/memory/scoped_vector.h" -#include "chrome/browser/sync/glue/device_info.h" +#include "components/sync_driver/device_info.h" -namespace browser_sync { +namespace sync_driver { // Interface for tracking synced DeviceInfo. class DeviceInfoTracker { @@ -35,6 +35,6 @@ class DeviceInfoTracker { virtual void RemoveObserver(Observer* observer) = 0; }; -} // namespace browser_sync +} // namespace sync_driver -#endif // CHROME_BROWSER_SYNC_GLUE_DEVICE_INFO_TRACKER_H_ +#endif // COMPONENTS_SYNC_DRIVER_DEVICE_INFO_TRACKER_H_ diff --git a/chrome/browser/sync/glue/local_device_info_provider.h b/components/sync_driver/local_device_info_provider.h index 4194c8e..6036a7e 100644 --- a/chrome/browser/sync/glue/local_device_info_provider.h +++ b/components/sync_driver/local_device_info_provider.h @@ -2,13 +2,13 @@ // 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_LOCAL_DEVICE_INFO_PROVIDER_H_ -#define CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_H_ +#ifndef COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_ +#define COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_ #include <string> #include "base/callback_list.h" -namespace browser_sync { +namespace sync_driver { class DeviceInfo; @@ -45,6 +45,6 @@ class LocalDeviceInfoProvider { const base::Closure& callback) = 0; }; -} // namespace browser_sync +} // namespace sync_driver -#endif // CHROME_BROWSER_SYNC_GLUE_LOCAL_DEVICE_INFO_PROVIDER_H_ +#endif // COMPONENTS_SYNC_DRIVER_LOCAL_DEVICE_INFO_PROVIDER_H_ |