OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 virtual void Associate(const TabContentsWrapper* tab, int64 sync_id); | 110 virtual void Associate(const TabContentsWrapper* tab, int64 sync_id); |
111 | 111 |
112 // Looks up the specified sync node, and marks that tab as closed, then marks | 112 // Looks up the specified sync node, and marks that tab as closed, then marks |
113 // the node as free and deletes association. | 113 // the node as free and deletes association. |
114 virtual void Disassociate(int64 sync_id); | 114 virtual void Disassociate(int64 sync_id); |
115 | 115 |
116 // Load any foreign session info stored in sync db and update the sync db | 116 // 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 | 117 // 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 | 118 // client and creates any further sync nodes needed to store local header and |
119 // tab info. | 119 // tab info. |
120 virtual bool AssociateModels(); | 120 virtual bool AssociateModels(SyncError* error); |
121 | 121 |
122 // Initializes the given sync node from the given chrome node id. | 122 // Initializes the given sync node from the given chrome node id. |
123 // Returns false if no sync node was found for the given chrome node id or | 123 // Returns false if no sync node was found for the given chrome node id or |
124 // if the initialization of sync node fails. | 124 // if the initialization of sync node fails. |
125 virtual bool InitSyncNodeFromChromeId(const std::string& id, | 125 virtual bool InitSyncNodeFromChromeId(const std::string& id, |
126 sync_api::BaseNode* sync_node); | 126 sync_api::BaseNode* sync_node); |
127 | 127 |
128 // Clear local sync data buffers. Does not delete sync nodes to avoid | 128 // Clear local sync data buffers. Does not delete sync nodes to avoid |
129 // tombstones. TODO(zea): way to eventually delete orphaned nodes. | 129 // tombstones. TODO(zea): way to eventually delete orphaned nodes. |
130 virtual bool DisassociateModels(); | 130 virtual bool DisassociateModels(SyncError* error); |
131 | 131 |
132 // Returns the tag used to uniquely identify this machine's session in the | 132 // Returns the tag used to uniquely identify this machine's session in the |
133 // sync model. | 133 // sync model. |
134 inline const std::string& GetCurrentMachineTag() { | 134 inline const std::string& GetCurrentMachineTag() { |
135 DCHECK(!current_machine_tag_.empty()); | 135 DCHECK(!current_machine_tag_.empty()); |
136 return current_machine_tag_; | 136 return current_machine_tag_; |
137 } | 137 } |
138 | 138 |
139 // Load and associate window and tab data for a foreign session | 139 // Load and associate window and tab data for a foreign session |
140 bool AssociateForeignSpecifics(const sync_pb::SessionSpecifics& specifics, | 140 bool AssociateForeignSpecifics(const sync_pb::SessionSpecifics& specifics, |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // is made. | 424 // is made. |
425 bool waiting_for_change_; | 425 bool waiting_for_change_; |
426 ScopedRunnableMethodFactory<SessionModelAssociator> test_method_factory_; | 426 ScopedRunnableMethodFactory<SessionModelAssociator> test_method_factory_; |
427 | 427 |
428 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 428 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
429 }; | 429 }; |
430 | 430 |
431 } // namespace browser_sync | 431 } // namespace browser_sync |
432 | 432 |
433 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 433 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
OLD | NEW |