| 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 #ifndef COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 5 #ifndef COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| 6 #define COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 6 #define COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "components/sync_sessions/favicon_cache.h" | 26 #include "components/sync_sessions/favicon_cache.h" |
| 27 #include "components/sync_sessions/local_session_event_router.h" | 27 #include "components/sync_sessions/local_session_event_router.h" |
| 28 #include "components/sync_sessions/lost_navigations_recorder.h" | 28 #include "components/sync_sessions/lost_navigations_recorder.h" |
| 29 #include "components/sync_sessions/open_tabs_ui_delegate.h" | 29 #include "components/sync_sessions/open_tabs_ui_delegate.h" |
| 30 #include "components/sync_sessions/revisit/page_revisit_broadcaster.h" | 30 #include "components/sync_sessions/revisit/page_revisit_broadcaster.h" |
| 31 #include "components/sync_sessions/synced_session.h" | 31 #include "components/sync_sessions/synced_session.h" |
| 32 #include "components/sync_sessions/synced_session_tracker.h" | 32 #include "components/sync_sessions/synced_session_tracker.h" |
| 33 #include "components/sync_sessions/tab_node_pool.h" | 33 #include "components/sync_sessions/tab_node_pool.h" |
| 34 | 34 |
| 35 namespace syncer { | 35 namespace syncer { |
| 36 class LocalDeviceInfoProvider; |
| 36 class SyncErrorFactory; | 37 class SyncErrorFactory; |
| 37 } | |
| 38 | |
| 39 namespace sync_driver { | |
| 40 class LocalDeviceInfoProvider; | |
| 41 class SyncPrefs; | 38 class SyncPrefs; |
| 42 } | 39 } // namespace syncer |
| 43 | 40 |
| 44 namespace sync_pb { | 41 namespace sync_pb { |
| 45 class SessionHeader; | 42 class SessionHeader; |
| 46 class SessionSpecifics; | 43 class SessionSpecifics; |
| 47 class SessionTab; | 44 class SessionTab; |
| 48 class SessionWindow; | 45 class SessionWindow; |
| 49 class TabNavigation; | 46 class TabNavigation; |
| 50 } // namespace sync_pb | 47 } // namespace sync_pb |
| 51 | 48 |
| 52 namespace extensions { | 49 namespace extensions { |
| 53 class ExtensionSessionsTest; | 50 class ExtensionSessionsTest; |
| 54 } // namespace extensions | 51 } // namespace extensions |
| 55 | 52 |
| 56 namespace sync_sessions { | 53 namespace sync_sessions { |
| 57 | 54 |
| 58 class SyncedTabDelegate; | 55 class SyncedTabDelegate; |
| 59 class SyncedWindowDelegatesGetter; | 56 class SyncedWindowDelegatesGetter; |
| 60 | 57 |
| 61 // Contains all logic for associating the Chrome sessions model and | 58 // Contains all logic for associating the Chrome sessions model and |
| 62 // the sync sessions model. | 59 // the sync sessions model. |
| 63 class SessionsSyncManager : public syncer::SyncableService, | 60 class SessionsSyncManager : public syncer::SyncableService, |
| 64 public OpenTabsUIDelegate, | 61 public OpenTabsUIDelegate, |
| 65 public LocalSessionEventHandler { | 62 public LocalSessionEventHandler { |
| 66 public: | 63 public: |
| 67 SessionsSyncManager(SyncSessionsClient* sessions_client, | 64 SessionsSyncManager(SyncSessionsClient* sessions_client, |
| 68 sync_driver::SyncPrefs* sync_prefs, | 65 syncer::SyncPrefs* sync_prefs, |
| 69 sync_driver::LocalDeviceInfoProvider* local_device, | 66 syncer::LocalDeviceInfoProvider* local_device, |
| 70 std::unique_ptr<LocalSessionEventRouter> router, | 67 std::unique_ptr<LocalSessionEventRouter> router, |
| 71 const base::Closure& sessions_updated_callback, | 68 const base::Closure& sessions_updated_callback, |
| 72 const base::Closure& datatype_refresh_callback); | 69 const base::Closure& datatype_refresh_callback); |
| 73 ~SessionsSyncManager() override; | 70 ~SessionsSyncManager() override; |
| 74 | 71 |
| 75 // syncer::SyncableService implementation. | 72 // syncer::SyncableService implementation. |
| 76 syncer::SyncMergeResult MergeDataAndStartSyncing( | 73 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 77 syncer::ModelType type, | 74 syncer::ModelType type, |
| 78 const syncer::SyncDataList& initial_sync_data, | 75 const syncer::SyncDataList& initial_sync_data, |
| 79 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, | 76 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor, |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 | 334 |
| 338 // Tracks whether our local representation of which sync nodes map to what | 335 // Tracks whether our local representation of which sync nodes map to what |
| 339 // tabs (belonging to the current local session) is inconsistent. This can | 336 // tabs (belonging to the current local session) is inconsistent. This can |
| 340 // happen if a foreign client deems our session as "stale" and decides to | 337 // happen if a foreign client deems our session as "stale" and decides to |
| 341 // delete it. Rather than respond by bullishly re-creating our nodes | 338 // delete it. Rather than respond by bullishly re-creating our nodes |
| 342 // immediately, which could lead to ping-pong sequences, we give the benefit | 339 // immediately, which could lead to ping-pong sequences, we give the benefit |
| 343 // of the doubt and hold off until another local navigation occurs, which | 340 // of the doubt and hold off until another local navigation occurs, which |
| 344 // proves that we are still relevant. | 341 // proves that we are still relevant. |
| 345 bool local_tab_pool_out_of_sync_; | 342 bool local_tab_pool_out_of_sync_; |
| 346 | 343 |
| 347 sync_driver::SyncPrefs* sync_prefs_; | 344 syncer::SyncPrefs* sync_prefs_; |
| 348 | 345 |
| 349 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; | 346 std::unique_ptr<syncer::SyncErrorFactory> error_handler_; |
| 350 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; | 347 std::unique_ptr<syncer::SyncChangeProcessor> sync_processor_; |
| 351 | 348 |
| 352 // Local device info provider, owned by ProfileSyncService. | 349 // Local device info provider, owned by ProfileSyncService. |
| 353 const sync_driver::LocalDeviceInfoProvider* const local_device_; | 350 const syncer::LocalDeviceInfoProvider* const local_device_; |
| 354 | 351 |
| 355 // Unique client tag. | 352 // Unique client tag. |
| 356 std::string current_machine_tag_; | 353 std::string current_machine_tag_; |
| 357 | 354 |
| 358 // User-visible machine name. | 355 // User-visible machine name. |
| 359 std::string current_session_name_; | 356 std::string current_session_name_; |
| 360 | 357 |
| 361 // SyncID for the sync node containing all the window information for this | 358 // SyncID for the sync node containing all the window information for this |
| 362 // client. | 359 // client. |
| 363 int local_session_header_node_id_; | 360 int local_session_header_node_id_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 379 | 376 |
| 380 // Callback to inform sync that a sync data refresh is requested. | 377 // Callback to inform sync that a sync data refresh is requested. |
| 381 base::Closure datatype_refresh_callback_; | 378 base::Closure datatype_refresh_callback_; |
| 382 | 379 |
| 383 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); | 380 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); |
| 384 }; | 381 }; |
| 385 | 382 |
| 386 } // namespace sync_sessions | 383 } // namespace sync_sessions |
| 387 | 384 |
| 388 #endif // COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 385 #endif // COMPONENTS_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| OLD | NEW |