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