Chromium Code Reviews| Index: chrome/browser/sync/chrome_sync_client.cc |
| diff --git a/chrome/browser/sync/chrome_sync_client.cc b/chrome/browser/sync/chrome_sync_client.cc |
| index 106e7e18a0b93b253daf9eded99211676ffa8b32..c215e0ece0e8b0955005e6caae17af3824c2f44f 100644 |
| --- a/chrome/browser/sync/chrome_sync_client.cc |
| +++ b/chrome/browser/sync/chrome_sync_client.cc |
| @@ -20,6 +20,7 @@ |
| #include "chrome/browser/themes/theme_syncable_service.h" |
| #include "chrome/browser/undo/bookmark_undo_service_factory.h" |
| #include "chrome/browser/web_data_service_factory.h" |
| +#include "chrome/common/url_constants.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" |
| @@ -31,6 +32,7 @@ |
| #include "components/sync_driver/sync_api_component_factory.h" |
| #include "components/syncable_prefs/pref_service_syncable.h" |
| #include "content/public/browser/browser_thread.h" |
| +#include "content/public/common/url_constants.h" |
| #if defined(ENABLE_APP_LIST) |
| #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| @@ -70,10 +72,32 @@ |
| namespace browser_sync { |
| +// Chrome implementation of SyncSesssionsClient. Needs to be in a separate class |
|
maxbogue
2015/10/17 21:53:58
s/sss/ss/
Nicolas Zea
2015/10/20 23:14:41
Done.
|
| +// due to possible multiple inheritance issues, wherein ChromeSyncClient might |
| +// inherit from other interfaces with same methods. |
| +class SyncSessionsClientImpl : public sync_sessions::SyncSessionsClient { |
| + public: |
| + SyncSessionsClientImpl() {} |
| + ~SyncSessionsClientImpl() override {} |
| + |
| + // SyncSesssionsClient implementation. |
|
maxbogue
2015/10/17 21:53:58
s/sss/ss/
Nicolas Zea
2015/10/20 23:14:41
Done.
|
| + bool ShouldSyncURL(const GURL& url) const override { |
| + if (url == GURL(chrome::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(content::kChromeUIScheme) && |
| + !url.SchemeIs(chrome::kChromeNativeScheme) && !url.SchemeIsFile(); |
| + } |
| +}; |
| + |
| ChromeSyncClient::ChromeSyncClient( |
| Profile* profile, |
| scoped_ptr<sync_driver::SyncApiComponentFactory> component_factory) |
| - : profile_(profile), component_factory_(component_factory.Pass()) {} |
| + : profile_(profile), |
| + component_factory_(component_factory.Pass()), |
| + sync_sessions_client_(new SyncSessionsClientImpl()) {} |
| ChromeSyncClient::~ChromeSyncClient() { |
| } |
| @@ -137,6 +161,10 @@ BookmarkUndoService* ChromeSyncClient::GetBookmarkUndoServiceIfExists() { |
| return BookmarkUndoServiceFactory::GetForProfileIfExists(profile_); |
| } |
| +sync_sessions::SyncSessionsClient* ChromeSyncClient::GetSyncSessionsClient() { |
| + return sync_sessions_client_.get(); |
| +} |
| + |
| base::WeakPtr<syncer::SyncableService> |
| ChromeSyncClient::GetSyncableServiceForType(syncer::ModelType type) { |
| if (!profile_) { // For tests. |