OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/sync_sessions/sessions_sync_manager.h" | 5 #include "components/sync_sessions/sessions_sync_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
12 #include "base/metrics/histogram_macros.h" | 12 #include "base/metrics/histogram_macros.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 #include "components/sync/api/sync_error.h" | 14 #include "components/sync/api/sync_error.h" |
15 #include "components/sync/api/sync_error_factory.h" | 15 #include "components/sync/api/sync_error_factory.h" |
16 #include "components/sync/api/sync_merge_result.h" | 16 #include "components/sync/api/sync_merge_result.h" |
17 #include "components/sync/api/time.h" | 17 #include "components/sync/api/time.h" |
18 #include "components/sync/device_info/local_device_info_provider.h" | 18 #include "components/sync/device_info/local_device_info_provider.h" |
19 #include "components/sync/syncable/syncable_util.h" | 19 #include "components/sync/syncable/syncable_util.h" |
20 #include "components/sync_sessions/lost_navigations_recorder.h" | 20 #include "components/sync_sessions/lost_navigations_recorder.h" |
21 #include "components/sync_sessions/sync_sessions_client.h" | 21 #include "components/sync_sessions/sync_sessions_client.h" |
22 #include "components/sync_sessions/synced_tab_delegate.h" | 22 #include "components/sync_sessions/synced_tab_delegate.h" |
23 #include "components/sync_sessions/synced_window_delegate.h" | 23 #include "components/sync_sessions/synced_window_delegate.h" |
24 #include "components/sync_sessions/synced_window_delegates_getter.h" | 24 #include "components/sync_sessions/synced_window_delegates_getter.h" |
25 #include "components/variations/variations_associated_data.h" | 25 #include "components/variations/variations_associated_data.h" |
26 | 26 |
27 using sessions::SerializedNavigationEntry; | 27 using sessions::SerializedNavigationEntry; |
28 using sync_driver::DeviceInfo; | 28 using syncer::DeviceInfo; |
29 using sync_driver::LocalDeviceInfoProvider; | 29 using syncer::LocalDeviceInfoProvider; |
30 using syncer::SyncChange; | 30 using syncer::SyncChange; |
31 using syncer::SyncData; | 31 using syncer::SyncData; |
32 | 32 |
33 namespace sync_sessions { | 33 namespace sync_sessions { |
34 | 34 |
35 namespace { | 35 namespace { |
36 | 36 |
37 // Maximum number of favicons to sync. | 37 // Maximum number of favicons to sync. |
38 // TODO(zea): pull this from the server. | 38 // TODO(zea): pull this from the server. |
39 const int kMaxSyncFavicons = 200; | 39 const int kMaxSyncFavicons = 200; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return std::string(); | 73 return std::string(); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace | 77 } // namespace |
78 | 78 |
79 // |local_device| is owned by ProfileSyncService, its lifetime exceeds | 79 // |local_device| is owned by ProfileSyncService, its lifetime exceeds |
80 // lifetime of SessionSyncManager. | 80 // lifetime of SessionSyncManager. |
81 SessionsSyncManager::SessionsSyncManager( | 81 SessionsSyncManager::SessionsSyncManager( |
82 sync_sessions::SyncSessionsClient* sessions_client, | 82 sync_sessions::SyncSessionsClient* sessions_client, |
83 sync_driver::SyncPrefs* sync_prefs, | 83 syncer::SyncPrefs* sync_prefs, |
84 LocalDeviceInfoProvider* local_device, | 84 LocalDeviceInfoProvider* local_device, |
85 std::unique_ptr<LocalSessionEventRouter> router, | 85 std::unique_ptr<LocalSessionEventRouter> router, |
86 const base::Closure& sessions_updated_callback, | 86 const base::Closure& sessions_updated_callback, |
87 const base::Closure& datatype_refresh_callback) | 87 const base::Closure& datatype_refresh_callback) |
88 : sessions_client_(sessions_client), | 88 : sessions_client_(sessions_client), |
89 session_tracker_(sessions_client), | 89 session_tracker_(sessions_client), |
90 favicon_cache_(sessions_client->GetFaviconService(), | 90 favicon_cache_(sessions_client->GetFaviconService(), |
91 sessions_client->GetHistoryService(), | 91 sessions_client->GetHistoryService(), |
92 kMaxSyncFavicons), | 92 kMaxSyncFavicons), |
93 local_tab_pool_out_of_sync_(true), | 93 local_tab_pool_out_of_sync_(true), |
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 } | 1113 } |
1114 | 1114 |
1115 // static | 1115 // static |
1116 std::string SessionsSyncManager::TagHashFromSpecifics( | 1116 std::string SessionsSyncManager::TagHashFromSpecifics( |
1117 const sync_pb::SessionSpecifics& specifics) { | 1117 const sync_pb::SessionSpecifics& specifics) { |
1118 return syncer::syncable::GenerateSyncableHash(syncer::SESSIONS, | 1118 return syncer::syncable::GenerateSyncableHash(syncer::SESSIONS, |
1119 TagFromSpecifics(specifics)); | 1119 TagFromSpecifics(specifics)); |
1120 } | 1120 } |
1121 | 1121 |
1122 }; // namespace sync_sessions | 1122 }; // namespace sync_sessions |
OLD | NEW |