diff options
author | vabr <vabr@chromium.org> | 2015-11-27 02:59:19 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-27 11:00:05 +0000 |
commit | 7a6f62ee3328bc717d433f5c3a2cc7b937ef79e3 (patch) | |
tree | 832c585f9fdc85f5ff94e5c64513820efea55c1d /ios | |
parent | e8cef80cb86a9da6ddbb660d3f547f43ea09cd68 (diff) | |
download | chromium_src-7a6f62ee3328bc717d433f5c3a2cc7b937ef79e3.zip chromium_src-7a6f62ee3328bc717d433f5c3a2cc7b937ef79e3.tar.gz chromium_src-7a6f62ee3328bc717d433f5c3a2cc7b937ef79e3.tar.bz2 |
Introduce IOSChromeSyncClient (upstream)
This is the upstream part of the downstream CL 307417013.
BUG=544795, 548612, 453435
Review URL: https://codereview.chromium.org/1471073006
Cr-Commit-Position: refs/heads/master@{#361976}
Diffstat (limited to 'ios')
-rw-r--r-- | ios/chrome/browser/BUILD.gn | 4 | ||||
-rw-r--r-- | ios/chrome/browser/DEPS | 2 | ||||
-rw-r--r-- | ios/chrome/browser/sync/ios_chrome_sync_client.cc | 392 | ||||
-rw-r--r-- | ios/chrome/browser/sync/ios_chrome_sync_client.h | 82 | ||||
-rw-r--r-- | ios/chrome/ios_chrome.gyp | 4 | ||||
-rw-r--r-- | ios/public/provider/chrome/browser/chrome_browser_provider.cc | 8 | ||||
-rw-r--r-- | ios/public/provider/chrome/browser/chrome_browser_provider.h | 9 |
7 files changed, 500 insertions, 1 deletions
diff --git a/ios/chrome/browser/BUILD.gn b/ios/chrome/browser/BUILD.gn index d1eb8e3..c8aed00 100644 --- a/ios/chrome/browser/BUILD.gn +++ b/ios/chrome/browser/BUILD.gn @@ -307,6 +307,8 @@ source_set("browser") { "suggestions/suggestions_service_factory.mm", "sync/glue/sync_start_util.cc", "sync/glue/sync_start_util.h", + "sync/ios_chrome_sync_client.cc", + "sync/ios_chrome_sync_client.h", "sync/ios_chrome_synced_tab_delegate.cc", "sync/ios_chrome_synced_tab_delegate.h", "sync/sessions/ios_chrome_local_session_event_router.cc", @@ -440,6 +442,8 @@ source_set("browser") { "//components/autofill/ios/browser", "//components/bookmarks/browser", "//components/bookmarks/managed", + "//components/browser_sync/browser", + "//components/browser_sync/common", "//components/component_updater", "//components/content_settings/core/browser", "//components/crash/core/browser", diff --git a/ios/chrome/browser/DEPS b/ios/chrome/browser/DEPS index 99cebf3..b7084d0 100644 --- a/ios/chrome/browser/DEPS +++ b/ios/chrome/browser/DEPS @@ -5,6 +5,8 @@ include_rules = [ "+components/autofill/core/common", "+components/autofill/ios/browser", "+components/bookmarks", + "+components/browser_sync/browser", + "+components/browser_sync/common", "+components/component_updater", "+components/content_settings/core", "+components/crash/core/browser", diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.cc b/ios/chrome/browser/sync/ios_chrome_sync_client.cc new file mode 100644 index 0000000..27e4cf0 --- /dev/null +++ b/ios/chrome/browser/sync/ios_chrome_sync_client.cc @@ -0,0 +1,392 @@ +// Copyright 2015 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 "ios/chrome/browser/sync/ios_chrome_sync_client.h" + +#include "base/bind.h" +#include "base/command_line.h" +#include "components/autofill/core/browser/webdata/autocomplete_syncable_service.h" +#include "components/autofill/core/browser/webdata/autofill_profile_syncable_service.h" +#include "components/autofill/core/browser/webdata/autofill_wallet_metadata_syncable_service.h" +#include "components/autofill/core/browser/webdata/autofill_wallet_syncable_service.h" +#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" +#include "components/browser_sync/browser/profile_sync_components_factory_impl.h" +#include "components/browser_sync/browser/profile_sync_service.h" +#include "components/browser_sync/common/browser_sync_switches.h" +#include "components/dom_distiller/core/dom_distiller_service.h" +#include "components/history/core/browser/history_model_worker.h" +#include "components/history/core/browser/history_service.h" +#include "components/invalidation/impl/profile_invalidation_provider.h" +#include "components/keyed_service/core/service_access_type.h" +#include "components/password_manager/core/browser/password_store.h" +#include "components/password_manager/sync/browser/password_model_worker.h" +#include "components/search_engines/search_engine_data_type_controller.h" +#include "components/signin/core/browser/profile_oauth2_token_service.h" +#include "components/sync_driver/glue/browser_thread_model_worker.h" +#include "components/sync_driver/glue/chrome_report_unrecoverable_error.h" +#include "components/sync_driver/glue/ui_model_worker.h" +#include "components/sync_driver/sync_api_component_factory.h" +#include "components/sync_driver/sync_util.h" +#include "components/sync_driver/ui_data_type_controller.h" +#include "components/sync_sessions/favicon_cache.h" +#include "components/sync_sessions/local_session_event_router.h" +#include "components/sync_sessions/sync_sessions_client.h" +#include "components/sync_sessions/synced_window_delegates_getter.h" +#include "components/syncable_prefs/pref_service_syncable.h" +#include "ios/chrome/browser/autofill/personal_data_manager_factory.h" +#include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" +#include "ios/chrome/browser/chrome_url_constants.h" +#include "ios/chrome/browser/dom_distiller/dom_distiller_service_factory.h" +#include "ios/chrome/browser/favicon/favicon_service_factory.h" +#include "ios/chrome/browser/history/history_service_factory.h" +#include "ios/chrome/browser/invalidation/ios_chrome_profile_invalidation_provider_factory.h" +#include "ios/chrome/browser/passwords/ios_chrome_password_store_factory.h" +#include "ios/chrome/browser/pref_names.h" +#include "ios/chrome/browser/signin/oauth2_token_service_factory.h" +#include "ios/chrome/browser/sync/glue/sync_start_util.h" +#include "ios/chrome/browser/sync/sessions/ios_chrome_local_session_event_router.h" +#include "ios/chrome/browser/web_data_service_factory.h" +#include "ios/chrome/common/channel_info.h" +#include "ios/public/provider/chrome/browser/browser_state/chrome_browser_state.h" +#include "ios/public/provider/chrome/browser/chrome_browser_provider.h" +#include "ios/public/provider/chrome/browser/keyed_service_provider.h" +#include "ios/web/public/web_thread.h" +#include "sync/internal_api/public/engine/passive_model_worker.h" +#include "sync/util/extensions_activity.h" +#include "ui/base/device_form_factor.h" + +namespace { + +// iOS implementation of SyncSessionsClient. Needs to be in a separate class +// due to possible multiple inheritance issues, wherein IOSChromeSyncClient +// might inherit from other interfaces with same methods. +class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { + public: + explicit SyncSessionsClientImpl(ios::ChromeBrowserState* browser_state) + : browser_state_(browser_state), + window_delegates_getter_( + ios::GetChromeBrowserProvider() + ->CreateSyncedWindowDelegatesGetter(browser_state)) {} + + ~SyncSessionsClientImpl() override {} + + // SyncSessionsClient implementation. + bookmarks::BookmarkModel* GetBookmarkModel() override { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::BookmarkModelFactory::GetForBrowserState(browser_state_); + } + + favicon::FaviconService* GetFaviconService() override { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::FaviconServiceFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); + } + + history::HistoryService* GetHistoryService() override { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::HistoryServiceFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); + } + + bool ShouldSyncURL(const GURL& url) const override { + if (url == GURL(kChromeUIHistoryURL)) { + // The history page is treated specially as we want it to trigger syncable + // events for UI purposes. + return true; + } + return url.is_valid() && !url.SchemeIs(kChromeUIScheme) && + !url.SchemeIsFile(); + } + + browser_sync::SyncedWindowDelegatesGetter* GetSyncedWindowDelegatesGetter() + override { + return window_delegates_getter_.get(); + } + + scoped_ptr<browser_sync::LocalSessionEventRouter> GetLocalSessionEventRouter() + override { + syncer::SyncableService::StartSyncFlare flare( + ios::sync_start_util::GetFlareForSyncableService( + browser_state_->GetStatePath())); + return make_scoped_ptr( + new IOSChromeLocalSessionEventRouter(browser_state_, this, flare)); + } + + private: + ios::ChromeBrowserState* const browser_state_; + const scoped_ptr<browser_sync::SyncedWindowDelegatesGetter> + window_delegates_getter_; + + DISALLOW_COPY_AND_ASSIGN(SyncSessionsClientImpl); +}; + +} // namespace + +IOSChromeSyncClient::IOSChromeSyncClient(ios::ChromeBrowserState* browser_state) + : browser_state_(browser_state), + sync_sessions_client_(new SyncSessionsClientImpl(browser_state)), + dummy_extensions_activity_(new syncer::ExtensionsActivity()), + weak_ptr_factory_(this) {} + +IOSChromeSyncClient::~IOSChromeSyncClient() {} + +void IOSChromeSyncClient::Initialize(sync_driver::SyncService* sync_service) { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + // Component factory may already be set in tests. + if (!GetSyncApiComponentFactory()) { + const GURL sync_service_url = GetSyncServiceURL( + *base::CommandLine::ForCurrentProcess(), ::GetChannel()); + ProfileOAuth2TokenService* token_service = + OAuth2TokenServiceFactory::GetForBrowserState(browser_state_); + + net::URLRequestContextGetter* url_request_context_getter = + browser_state_->GetRequestContext(); + + component_factory_.reset(new ProfileSyncComponentsFactoryImpl( + this, ::GetChannel(), ::GetVersionString(), + ui::GetDeviceFormFactor() == ui::DEVICE_FORM_FACTOR_TABLET, + *base::CommandLine::ForCurrentProcess(), + ios::prefs::kSavingBrowserHistoryDisabled, sync_service_url, + web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), + web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), + token_service, url_request_context_getter)); + } + sync_service_ = sync_service; + web_data_service_ = GetWebDataService(); + password_store_ = GetPasswordStore(); +} + +sync_driver::SyncService* IOSChromeSyncClient::GetSyncService() { + // TODO(crbug.com/558298): bring back this DCHECK after Typed URLs are + // converted to SyncableService. + // DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return sync_service_; +} + +PrefService* IOSChromeSyncClient::GetPrefService() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return browser_state_->GetPrefs(); +} + +bookmarks::BookmarkModel* IOSChromeSyncClient::GetBookmarkModel() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::BookmarkModelFactory::GetForBrowserState(browser_state_); +} + +favicon::FaviconService* IOSChromeSyncClient::GetFaviconService() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::FaviconServiceFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); +} + +history::HistoryService* IOSChromeSyncClient::GetHistoryService() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::HistoryServiceFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); +} + +autofill::PersonalDataManager* IOSChromeSyncClient::GetPersonalDataManager() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return PersonalDataManagerFactory::GetForBrowserState(browser_state_); +} + +scoped_refptr<password_manager::PasswordStore> +IOSChromeSyncClient::GetPasswordStore() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + // TODO(crbug.com/558320) Is EXPLICIT_ACCESS appropriate here? + return IOSChromePasswordStoreFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); +} + +sync_driver::ClearBrowsingDataCallback +IOSChromeSyncClient::GetClearBrowsingDataCallback() { + return base::Bind(&IOSChromeSyncClient::ClearBrowsingData, + base::Unretained(this)); +} + +base::Closure IOSChromeSyncClient::GetPasswordStateChangedCallback() { + return base::Bind( + &IOSChromePasswordStoreFactory::OnPasswordsSyncedStatePotentiallyChanged, + base::Unretained(browser_state_)); +} + +sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod +IOSChromeSyncClient::GetRegisterPlatformTypesCallback() { + // The iOS port does not have any platform-specific datatypes. + return sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod(); +} + +scoped_refptr<autofill::AutofillWebDataService> +IOSChromeSyncClient::GetWebDataService() { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + return ios::WebDataServiceFactory::GetAutofillWebDataForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); +} + +BookmarkUndoService* IOSChromeSyncClient::GetBookmarkUndoServiceIfExists() { + // TODO(crbug.com/561569) Implement this. + return nullptr; +} + +invalidation::InvalidationService* +IOSChromeSyncClient::GetInvalidationService() { + invalidation::ProfileInvalidationProvider* provider = + IOSChromeProfileInvalidationProviderFactory::GetForBrowserState( + browser_state_); + if (provider) + return provider->GetInvalidationService(); + return nullptr; +} + +scoped_refptr<syncer::ExtensionsActivity> +IOSChromeSyncClient::GetExtensionsActivity() { + // TODO(crbug.com/562048) Get rid of dummy_extensions_activity_ and return + // nullptr. + return dummy_extensions_activity_; +} + +sync_sessions::SyncSessionsClient* +IOSChromeSyncClient::GetSyncSessionsClient() { + return sync_sessions_client_.get(); +} + +base::WeakPtr<syncer::SyncableService> +IOSChromeSyncClient::GetSyncableServiceForType(syncer::ModelType type) { + switch (type) { + case syncer::DEVICE_INFO: + return static_cast<ProfileSyncService*>( + ios::GetKeyedServiceProvider()->GetSyncServiceForBrowserState( + browser_state_)) + ->GetDeviceInfoSyncableService() + ->AsWeakPtr(); + case syncer::PREFERENCES: + return browser_state_->GetSyncablePrefs() + ->GetSyncableService(syncer::PREFERENCES) + ->AsWeakPtr(); + case syncer::PRIORITY_PREFERENCES: + return browser_state_->GetSyncablePrefs() + ->GetSyncableService(syncer::PRIORITY_PREFERENCES) + ->AsWeakPtr(); + case syncer::AUTOFILL: + case syncer::AUTOFILL_PROFILE: + case syncer::AUTOFILL_WALLET_DATA: + case syncer::AUTOFILL_WALLET_METADATA: { + if (!web_data_service_) + return base::WeakPtr<syncer::SyncableService>(); + if (type == syncer::AUTOFILL) { + return autofill::AutocompleteSyncableService::FromWebDataService( + web_data_service_.get()) + ->AsWeakPtr(); + } else if (type == syncer::AUTOFILL_PROFILE) { + return autofill::AutofillProfileSyncableService::FromWebDataService( + web_data_service_.get()) + ->AsWeakPtr(); + } else if (type == syncer::AUTOFILL_WALLET_METADATA) { + return autofill::AutofillWalletMetadataSyncableService:: + FromWebDataService(web_data_service_.get()) + ->AsWeakPtr(); + } + return autofill::AutofillWalletSyncableService::FromWebDataService( + web_data_service_.get()) + ->AsWeakPtr(); + } + case syncer::HISTORY_DELETE_DIRECTIVES: { + history::HistoryService* history = + ios::HistoryServiceFactory::GetForBrowserState( + browser_state_, ServiceAccessType::EXPLICIT_ACCESS); + return history ? history->AsWeakPtr() + : base::WeakPtr<history::HistoryService>(); + } + case syncer::FAVICON_IMAGES: + case syncer::FAVICON_TRACKING: { + browser_sync::FaviconCache* favicons = + static_cast<ProfileSyncService*>( + ios::GetKeyedServiceProvider()->GetSyncServiceForBrowserState( + browser_state_)) + ->GetFaviconCache(); + return favicons ? favicons->AsWeakPtr() + : base::WeakPtr<syncer::SyncableService>(); + } + case syncer::ARTICLES: { + dom_distiller::DomDistillerService* service = + dom_distiller::DomDistillerServiceFactory::GetForBrowserState( + browser_state_); + if (service) + return service->GetSyncableService()->AsWeakPtr(); + return base::WeakPtr<syncer::SyncableService>(); + } + case syncer::SESSIONS: { + return static_cast<ProfileSyncService*>( + ios::GetKeyedServiceProvider()->GetSyncServiceForBrowserState( + browser_state_)) + ->GetSessionsSyncableService() + ->AsWeakPtr(); + } + case syncer::PASSWORDS: { + return password_store_ ? password_store_->GetPasswordSyncableService() + : base::WeakPtr<syncer::SyncableService>(); + } + default: + // TODO(crbug.com/562170) The following datatypes still need to be + // transitioned to the syncer::SyncableService API: + // Bookmarks + // Typed URLs + NOTREACHED(); + return base::WeakPtr<syncer::SyncableService>(); + } +} + +scoped_refptr<syncer::ModelSafeWorker> +IOSChromeSyncClient::CreateModelWorkerForGroup( + syncer::ModelSafeGroup group, + syncer::WorkerLoopDestructionObserver* observer) { + DCHECK_CURRENTLY_ON_WEB_THREAD(web::WebThread::UI); + switch (group) { + case syncer::GROUP_DB: + return new browser_sync::BrowserThreadModelWorker( + web::WebThread::GetTaskRunnerForThread(web::WebThread::DB), + syncer::GROUP_DB, observer); + case syncer::GROUP_FILE: + return new browser_sync::BrowserThreadModelWorker( + web::WebThread::GetTaskRunnerForThread(web::WebThread::FILE), + syncer::GROUP_FILE, observer); + case syncer::GROUP_UI: + return new browser_sync::UIModelWorker( + web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), observer); + case syncer::GROUP_PASSIVE: + return new syncer::PassiveModelWorker(observer); + case syncer::GROUP_HISTORY: { + history::HistoryService* history_service = GetHistoryService(); + if (!history_service) + return nullptr; + return new browser_sync::HistoryModelWorker( + history_service->AsWeakPtr(), + web::WebThread::GetTaskRunnerForThread(web::WebThread::UI), observer); + } + case syncer::GROUP_PASSWORD: { + scoped_refptr<password_manager::PasswordStore> password_store = + GetPasswordStore(); + if (!password_store) + return nullptr; + return new browser_sync::PasswordModelWorker(password_store, observer); + } + default: + return nullptr; + } +} + +sync_driver::SyncApiComponentFactory* +IOSChromeSyncClient::GetSyncApiComponentFactory() { + return component_factory_.get(); +} + +void IOSChromeSyncClient::ClearBrowsingData(base::Time start, base::Time end) { + // This method should never be called on iOS. + NOTREACHED(); +} + +void IOSChromeSyncClient::SetSyncApiComponentFactoryForTesting( + scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory) { + component_factory_ = component_factory.Pass(); +} diff --git a/ios/chrome/browser/sync/ios_chrome_sync_client.h b/ios/chrome/browser/sync/ios_chrome_sync_client.h new file mode 100644 index 0000000..a3bbcbb --- /dev/null +++ b/ios/chrome/browser/sync/ios_chrome_sync_client.h @@ -0,0 +1,82 @@ +// Copyright 2015 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 IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__ +#define IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__ + +#include "base/macros.h" +#include "base/memory/weak_ptr.h" +#include "components/sync_driver/sync_client.h" + +namespace ios { +class ChromeBrowserState; +} + +namespace sync_driver { +class SyncApiComponentFactory; +class SyncService; +} + +class IOSChromeSyncClient : public sync_driver::SyncClient { + public: + explicit IOSChromeSyncClient(ios::ChromeBrowserState* browser_state); + ~IOSChromeSyncClient() override; + + // SyncClient implementation. + void Initialize(sync_driver::SyncService* sync_service) override; + sync_driver::SyncService* GetSyncService() override; + PrefService* GetPrefService() override; + bookmarks::BookmarkModel* GetBookmarkModel() override; + favicon::FaviconService* GetFaviconService() override; + history::HistoryService* GetHistoryService() override; + scoped_refptr<password_manager::PasswordStore> GetPasswordStore() override; + sync_driver::ClearBrowsingDataCallback GetClearBrowsingDataCallback() + override; + base::Closure GetPasswordStateChangedCallback() override; + sync_driver::SyncApiComponentFactory::RegisterDataTypesMethod + GetRegisterPlatformTypesCallback() override; + autofill::PersonalDataManager* GetPersonalDataManager() override; + invalidation::InvalidationService* GetInvalidationService() override; + scoped_refptr<autofill::AutofillWebDataService> GetWebDataService() override; + BookmarkUndoService* GetBookmarkUndoServiceIfExists() override; + scoped_refptr<syncer::ExtensionsActivity> GetExtensionsActivity() override; + sync_sessions::SyncSessionsClient* GetSyncSessionsClient() override; + base::WeakPtr<syncer::SyncableService> GetSyncableServiceForType( + syncer::ModelType type) override; + scoped_refptr<syncer::ModelSafeWorker> CreateModelWorkerForGroup( + syncer::ModelSafeGroup group, + syncer::WorkerLoopDestructionObserver* observer) override; + sync_driver::SyncApiComponentFactory* GetSyncApiComponentFactory() override; + + void SetSyncApiComponentFactoryForTesting( + scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory); + + private: + void ClearBrowsingData(base::Time start, base::Time end); + + ios::ChromeBrowserState* const browser_state_; + + // The sync api component factory in use by this client. + scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory_; + + // Members that must be fetched on the UI thread but accessed on their + // respective backend threads. + scoped_refptr<autofill::AutofillWebDataService> web_data_service_; + scoped_refptr<password_manager::PasswordStore> password_store_; + + scoped_ptr<sync_sessions::SyncSessionsClient> sync_sessions_client_; + + // TODO(crbug.com/558298): this is a member only because Typed URLs needs + // access to the UserShare and Cryptographer outside of the UI thread. Remove + // this once that's no longer the case. + sync_driver::SyncService* sync_service_; // Weak. + + const scoped_refptr<syncer::ExtensionsActivity> dummy_extensions_activity_; + + base::WeakPtrFactory<IOSChromeSyncClient> weak_ptr_factory_; + + DISALLOW_COPY_AND_ASSIGN(IOSChromeSyncClient); +}; + +#endif // IOS_CHROME_BROWSER_SYNC_IOS_CHROME_SYNC_CLIENT_H__ diff --git a/ios/chrome/ios_chrome.gyp b/ios/chrome/ios_chrome.gyp index b77e7e6..5b6c7af 100644 --- a/ios/chrome/ios_chrome.gyp +++ b/ios/chrome/ios_chrome.gyp @@ -51,6 +51,8 @@ '../../components/components.gyp:autofill_ios_browser', '../../components/components.gyp:bookmarks_browser', '../../components/components.gyp:bookmarks_managed', + '../../components/components.gyp:browser_sync_browser', + '../../components/components.gyp:browser_sync_common', '../../components/components.gyp:component_updater', '../../components/components.gyp:content_settings_core_browser', '../../components/components.gyp:crash_core_browser', @@ -453,6 +455,8 @@ 'browser/suggestions/suggestions_service_factory.mm', 'browser/sync/glue/sync_start_util.cc', 'browser/sync/glue/sync_start_util.h', + 'browser/sync/ios_chrome_sync_client.cc', + 'browser/sync/ios_chrome_sync_client.h', 'browser/sync/ios_chrome_synced_tab_delegate.cc', 'browser/sync/ios_chrome_synced_tab_delegate.h', 'browser/sync/sessions/ios_chrome_local_session_event_router.cc', diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.cc b/ios/public/provider/chrome/browser/chrome_browser_provider.cc index 9435b17..a12824c 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.cc +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.cc @@ -9,9 +9,9 @@ #include "base/logging.h" #include "components/metrics/metrics_provider.h" #include "components/sync_sessions/local_session_event_router.h" +#include "components/sync_sessions/synced_window_delegates_getter.h" #include "ios/public/provider/chrome/browser/browsing_data/ios_chrome_browsing_data_remover_provider.h" #include "ios/public/provider/chrome/browser/keyed_service_provider.h" -#include "ios/public/provider/chrome/browser/keyed_service_provider.h" namespace ios { @@ -132,4 +132,10 @@ bool ChromeBrowserProvider::IsSafeBrowsingEnabled( void ChromeBrowserProvider::OnMetricsServicesManagerClientDestroyed() {} +scoped_ptr<browser_sync::SyncedWindowDelegatesGetter> +ChromeBrowserProvider::CreateSyncedWindowDelegatesGetter( + ios::ChromeBrowserState* browser_state) { + return nullptr; +} + } // namespace ios diff --git a/ios/public/provider/chrome/browser/chrome_browser_provider.h b/ios/public/provider/chrome/browser/chrome_browser_provider.h index a557d91..470b3e4 100644 --- a/ios/public/provider/chrome/browser/chrome_browser_provider.h +++ b/ios/public/provider/chrome/browser/chrome_browser_provider.h @@ -11,6 +11,7 @@ #include <vector> #include "base/callback_forward.h" +#include "base/memory/scoped_ptr.h" #include "components/favicon_base/favicon_callback.h" class AutocompleteProvider; @@ -25,6 +26,10 @@ class CardUnmaskPromptController; class CardUnmaskPromptView; } +namespace browser_sync { +class SyncedWindowDelegatesGetter; +} + namespace net { class URLRequestContextGetter; } @@ -130,6 +135,10 @@ class ChromeBrowserProvider { // Called when the IOSChromeMetricsServiceClientManager instance is // destroyed. virtual void OnMetricsServicesManagerClientDestroyed(); + + // Returns the SyncedWindowDelegatesGetter implementation. + virtual scoped_ptr<browser_sync::SyncedWindowDelegatesGetter> + CreateSyncedWindowDelegatesGetter(ios::ChromeBrowserState* browser_state); }; } // namespace ios |