OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // foreign session windows list each time |GetSessionData| is called by the | 45 // foreign session windows list each time |GetSessionData| is called by the |
46 // ForeignSessionHandler. | 46 // ForeignSessionHandler. |
47 class SessionModelAssociator : public PerDataTypeAssociatorInterface< | 47 class SessionModelAssociator : public PerDataTypeAssociatorInterface< |
48 sync_pb::SessionSpecifics, std::string>, public NonThreadSafe { | 48 sync_pb::SessionSpecifics, std::string>, public NonThreadSafe { |
49 public: | 49 public: |
50 | 50 |
51 // Does not take ownership of sync_service. | 51 // Does not take ownership of sync_service. |
52 explicit SessionModelAssociator(ProfileSyncService* sync_service); | 52 explicit SessionModelAssociator(ProfileSyncService* sync_service); |
53 virtual ~SessionModelAssociator(); | 53 virtual ~SessionModelAssociator(); |
54 | 54 |
55 | |
56 // AssociatorInterface and PerDataTypeAssociator Interface implementation. | 55 // AssociatorInterface and PerDataTypeAssociator Interface implementation. |
57 virtual void AbortAssociation() { | 56 virtual void AbortAssociation() { |
58 return; | |
59 // No implementation needed, this associator runs on the main | 57 // No implementation needed, this associator runs on the main |
60 // thread. | 58 // thread. |
61 } | 59 } |
62 | 60 |
63 // Dummy method, we do everything all-at-once in UpdateFromSyncModel. | 61 // Dummy method, we do everything all-at-once in UpdateFromSyncModel. |
64 virtual void Associate(const sync_pb::SessionSpecifics* specifics, | 62 virtual void Associate(const sync_pb::SessionSpecifics* specifics, |
65 int64 sync_id) { | 63 int64 sync_id) { |
66 } | 64 } |
67 | 65 |
68 // Updates the sync model with the local client data. (calls | 66 // Updates the sync model with the local client data. (calls |
(...skipping 24 matching lines...) Expand all Loading... |
93 // Returns sync id for the given chrome model id. | 91 // Returns sync id for the given chrome model id. |
94 // Returns sync_api::kInvalidId if the sync node is not found for the given | 92 // Returns sync_api::kInvalidId if the sync node is not found for the given |
95 // chrome id. | 93 // chrome id. |
96 virtual int64 GetSyncIdFromChromeId(const std::string& id); | 94 virtual int64 GetSyncIdFromChromeId(const std::string& id); |
97 | 95 |
98 | 96 |
99 // Initializes the given sync node from the given chrome node id. | 97 // Initializes the given sync node from the given chrome node id. |
100 // Returns false if no sync node was found for the given chrome node id or | 98 // Returns false if no sync node was found for the given chrome node id or |
101 // if the initialization of sync node fails. | 99 // if the initialization of sync node fails. |
102 virtual bool InitSyncNodeFromChromeId(const std::string& id, | 100 virtual bool InitSyncNodeFromChromeId(const std::string& id, |
103 sync_api::BaseNode* sync_node) { | 101 sync_api::BaseNode* sync_node); |
104 return false; | |
105 } | |
106 | 102 |
107 // The has_nodes out parameter is set to true if the sync model has | 103 // The has_nodes out parameter is set to true if the sync model has |
108 // nodes other than the permanent tagged nodes. The method may | 104 // nodes other than the permanent tagged nodes. The method may |
109 // return false if an error occurred. | 105 // return false if an error occurred. |
110 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); | 106 virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes); |
111 | 107 |
112 // Returns the tag used to uniquely identify this machine's session in the | 108 // Returns the tag used to uniquely identify this machine's session in the |
113 // sync model. | 109 // sync model. |
114 std::string GetCurrentMachineTag(); | 110 std::string GetCurrentMachineTag(); |
115 | 111 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 207 |
212 // Consumer used to obtain the current session. | 208 // Consumer used to obtain the current session. |
213 CancelableRequestConsumer consumer_; | 209 CancelableRequestConsumer consumer_; |
214 | 210 |
215 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); | 211 DISALLOW_COPY_AND_ASSIGN(SessionModelAssociator); |
216 }; | 212 }; |
217 | 213 |
218 } // namespace browser_sync | 214 } // namespace browser_sync |
219 | 215 |
220 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ | 216 #endif // CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_ |
OLD | NEW |