Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 // Returns: false if the local session's sync nodes were deleted and | 103 // Returns: false if the local session's sync nodes were deleted and |
| 104 // reassociation is necessary, true otherwise. | 104 // reassociation is necessary, true otherwise. |
| 105 bool AssociateTabs(const std::vector<SyncedTabDelegate*>& tabs, | 105 bool AssociateTabs(const std::vector<SyncedTabDelegate*>& tabs, |
| 106 syncer::SyncError* error); | 106 syncer::SyncError* error); |
| 107 | 107 |
| 108 // Reassociates a single tab with the sync model. Will check if the tab | 108 // Reassociates a single tab with the sync model. Will check if the tab |
| 109 // already is associated with a sync node and allocate one if necessary. | 109 // already is associated with a sync node and allocate one if necessary. |
| 110 // |error| gets set if any association error occurred. | 110 // |error| gets set if any association error occurred. |
| 111 // Returns: false if the local session's sync nodes were deleted and | 111 // Returns: false if the local session's sync nodes were deleted and |
| 112 // reassociation is necessary, true otherwise. | 112 // reassociation is necessary, true otherwise. |
| 113 bool AssociateTab(const SyncedTabDelegate& tab, | 113 bool AssociateTab(SyncedTabDelegate* tab, syncer::SyncError* error); |
|
Nicolas Zea
2013/06/06 21:27:39
comment that |tab| will be updated with the sync i
| |
| 114 syncer::SyncError* error); | |
| 115 | 114 |
| 116 // Load any foreign session info stored in sync db and update the sync db | 115 // Load any foreign session info stored in sync db and update the sync db |
| 117 // with local client data. Processes/reuses any sync nodes owned by this | 116 // with local client data. Processes/reuses any sync nodes owned by this |
| 118 // client and creates any further sync nodes needed to store local header and | 117 // client and creates any further sync nodes needed to store local header and |
| 119 // tab info. | 118 // tab info. |
| 120 virtual syncer::SyncError AssociateModels( | 119 virtual syncer::SyncError AssociateModels( |
| 121 syncer::SyncMergeResult* local_merge_result, | 120 syncer::SyncMergeResult* local_merge_result, |
| 122 syncer::SyncMergeResult* syncer_merge_result) OVERRIDE; | 121 syncer::SyncMergeResult* syncer_merge_result) OVERRIDE; |
| 123 | 122 |
| 124 // Clear local sync data buffers. Does not delete sync nodes to avoid | 123 // Clear local sync data buffers. Does not delete sync nodes to avoid |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 // Returns true if this tab belongs to this profile and belongs to a window, | 321 // Returns true if this tab belongs to this profile and belongs to a window, |
| 323 // false otherwise. | 322 // false otherwise. |
| 324 bool IsValidTab(const SyncedTabDelegate& tab) const; | 323 bool IsValidTab(const SyncedTabDelegate& tab) const; |
| 325 | 324 |
| 326 // Having a valid entry is defined as the url being valid and and having a | 325 // Having a valid entry is defined as the url being valid and and having a |
| 327 // syncable scheme (non chrome:// and file:// url's). In other words, we don't | 326 // syncable scheme (non chrome:// and file:// url's). In other words, we don't |
| 328 // want to sync a tab that is nothing but chrome:// and file:// navigations or | 327 // want to sync a tab that is nothing but chrome:// and file:// navigations or |
| 329 // invalid url's. | 328 // invalid url's. |
| 330 bool TabHasValidEntry(const SyncedTabDelegate& tab) const; | 329 bool TabHasValidEntry(const SyncedTabDelegate& tab) const; |
| 331 | 330 |
| 331 // Update the tab id of the node with |sync_id| to |new_tab_id|. Returns true | |
| 332 // if tab id was set to |new_tab_id|. | |
| 333 bool UpdateTabIdIfNeccessary(int64 sync_id, SessionID::id_type new_tab_id); | |
|
Nicolas Zea
2013/06/06 21:27:39
nit: neccessary only has one c
shashi
2013/06/11 19:15:06
Done.
| |
| 334 | |
| 332 // For testing only. | 335 // For testing only. |
| 333 void QuitLoopForSubtleTesting(); | 336 void QuitLoopForSubtleTesting(); |
| 334 | 337 |
| 335 // Unique client tag. | 338 // Unique client tag. |
| 336 std::string current_machine_tag_; | 339 std::string current_machine_tag_; |
| 337 | 340 |
| 338 // User-visible machine name. | 341 // User-visible machine name. |
| 339 std::string current_session_name_; | 342 std::string current_session_name_; |
| 340 | 343 |
| 341 // Pool of all used/available sync nodes associated with tabs. | 344 // Pool of all used/available sync nodes associated with tabs. |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 372 | 375 |
| 373 // Our favicon cache. | 376 // Our favicon cache. |
| 374 FaviconCache favicon_cache_; | 377 FaviconCache favicon_cache_; |
| 375 | 378 |
| 376 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 379 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
| 377 }; | 380 }; |
| 378 | 381 |
| 379 } // namespace browser_sync | 382 } // namespace browser_sync |
| 380 | 383 |
| 381 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 384 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
| OLD | NEW |