| 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 CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| 6 #define CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 6 #define CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 82 |
| 83 // Contains all logic for associating the Chrome sessions model and | 83 // Contains all logic for associating the Chrome sessions model and |
| 84 // the sync sessions model. | 84 // the sync sessions model. |
| 85 class SessionsSyncManager : public syncer::SyncableService, | 85 class SessionsSyncManager : public syncer::SyncableService, |
| 86 public OpenTabsUIDelegate, | 86 public OpenTabsUIDelegate, |
| 87 public LocalSessionEventHandler { | 87 public LocalSessionEventHandler { |
| 88 public: | 88 public: |
| 89 SessionsSyncManager(Profile* profile, | 89 SessionsSyncManager(Profile* profile, |
| 90 sync_driver::LocalDeviceInfoProvider* local_device, | 90 sync_driver::LocalDeviceInfoProvider* local_device, |
| 91 scoped_ptr<LocalSessionEventRouter> router); | 91 scoped_ptr<LocalSessionEventRouter> router); |
| 92 virtual ~SessionsSyncManager(); | 92 ~SessionsSyncManager() override; |
| 93 | 93 |
| 94 // syncer::SyncableService implementation. | 94 // syncer::SyncableService implementation. |
| 95 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 95 syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 96 syncer::ModelType type, | 96 syncer::ModelType type, |
| 97 const syncer::SyncDataList& initial_sync_data, | 97 const syncer::SyncDataList& initial_sync_data, |
| 98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 98 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
| 99 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; | 99 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
| 100 virtual void StopSyncing(syncer::ModelType type) override; | 100 void StopSyncing(syncer::ModelType type) override; |
| 101 virtual syncer::SyncDataList GetAllSyncData( | 101 syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const override; |
| 102 syncer::ModelType type) const override; | 102 syncer::SyncError ProcessSyncChanges( |
| 103 virtual syncer::SyncError ProcessSyncChanges( | |
| 104 const tracked_objects::Location& from_here, | 103 const tracked_objects::Location& from_here, |
| 105 const syncer::SyncChangeList& change_list) override; | 104 const syncer::SyncChangeList& change_list) override; |
| 106 | 105 |
| 107 // OpenTabsUIDelegate implementation. | 106 // OpenTabsUIDelegate implementation. |
| 108 virtual bool GetSyncedFaviconForPageURL( | 107 bool GetSyncedFaviconForPageURL( |
| 109 const std::string& pageurl, | 108 const std::string& pageurl, |
| 110 scoped_refptr<base::RefCountedMemory>* favicon_png) const override; | 109 scoped_refptr<base::RefCountedMemory>* favicon_png) const override; |
| 111 virtual bool GetAllForeignSessions( | 110 bool GetAllForeignSessions( |
| 112 std::vector<const SyncedSession*>* sessions) override; | 111 std::vector<const SyncedSession*>* sessions) override; |
| 113 virtual bool GetForeignSession( | 112 bool GetForeignSession(const std::string& tag, |
| 114 const std::string& tag, | 113 std::vector<const SessionWindow*>* windows) override; |
| 115 std::vector<const SessionWindow*>* windows) override; | 114 bool GetForeignTab(const std::string& tag, |
| 116 virtual bool GetForeignTab(const std::string& tag, | 115 const SessionID::id_type tab_id, |
| 117 const SessionID::id_type tab_id, | 116 const SessionTab** tab) override; |
| 118 const SessionTab** tab) override; | 117 void DeleteForeignSession(const std::string& tag) override; |
| 119 virtual void DeleteForeignSession(const std::string& tag) override; | 118 bool GetLocalSession(const SyncedSession** local_session) override; |
| 120 virtual bool GetLocalSession(const SyncedSession* * local_session) override; | |
| 121 | 119 |
| 122 // LocalSessionEventHandler implementation. | 120 // LocalSessionEventHandler implementation. |
| 123 virtual void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; | 121 void OnLocalTabModified(SyncedTabDelegate* modified_tab) override; |
| 124 virtual void OnFaviconPageUrlsUpdated( | 122 void OnFaviconPageUrlsUpdated( |
| 125 const std::set<GURL>& updated_favicon_page_urls) override; | 123 const std::set<GURL>& updated_favicon_page_urls) override; |
| 126 | 124 |
| 127 // Returns the tag used to uniquely identify this machine's session in the | 125 // Returns the tag used to uniquely identify this machine's session in the |
| 128 // sync model. | 126 // sync model. |
| 129 const std::string& current_machine_tag() const { | 127 const std::string& current_machine_tag() const { |
| 130 DCHECK(!current_machine_tag_.empty()); | 128 DCHECK(!current_machine_tag_.empty()); |
| 131 return current_machine_tag_; | 129 return current_machine_tag_; |
| 132 } | 130 } |
| 133 | 131 |
| 134 // Return the virtual URL of the current tab, even if it's pending. | 132 // Return the virtual URL of the current tab, even if it's pending. |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 372 |
| 375 scoped_ptr<LocalSessionEventRouter> local_event_router_; | 373 scoped_ptr<LocalSessionEventRouter> local_event_router_; |
| 376 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; | 374 scoped_ptr<SyncedWindowDelegatesGetter> synced_window_getter_; |
| 377 | 375 |
| 378 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); | 376 DISALLOW_COPY_AND_ASSIGN(SessionsSyncManager); |
| 379 }; | 377 }; |
| 380 | 378 |
| 381 } // namespace browser_sync | 379 } // namespace browser_sync |
| 382 | 380 |
| 383 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ | 381 #endif // CHROME_BROWSER_SYNC_SESSIONS_SESSIONS_SYNC_MANAGER_H_ |
| OLD | NEW |