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_EXTENSION_MODEL_ASSOCIATOR_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 // thread. | 48 // thread. |
49 } | 49 } |
50 | 50 |
51 // Used by ExtensionChangeProcessor. | 51 // Used by ExtensionChangeProcessor. |
52 // | 52 // |
53 // TODO(akalin): These functions can actually be moved to the | 53 // TODO(akalin): These functions can actually be moved to the |
54 // ChangeProcessor after some refactoring. | 54 // ChangeProcessor after some refactoring. |
55 | 55 |
56 // TODO(akalin): Return an error string instead of just a bool. | 56 // TODO(akalin): Return an error string instead of just a bool. |
57 bool OnClientUpdate(const std::string& id); | 57 bool OnClientUpdate(const std::string& id); |
58 void OnServerUpdate(const sync_pb::ExtensionSpecifics& server_data); | 58 |
59 void OnServerRemove(const std::string& id); | 59 // |extension| may be NULL (if the client does not have the |
| 60 // extension installed). |
| 61 void OnServerUpdate(const sync_pb::ExtensionSpecifics& server_data, |
| 62 Extension* extension); |
60 | 63 |
61 private: | 64 private: |
62 // Returns the extension service from |sync_service_|. Never | 65 // Returns the extension service from |sync_service_|. Never |
63 // returns NULL. | 66 // returns NULL. |
64 ExtensionsService* GetExtensionsService(); | 67 ExtensionsService* GetExtensionsService(); |
65 | 68 |
66 bool GetExtensionDataFromClient( | |
67 const std::string& id, sync_pb::ExtensionSpecifics* client_data); | |
68 | |
69 bool GetExtensionDataFromServer( | 69 bool GetExtensionDataFromServer( |
70 const std::string& id, sync_api::WriteTransaction* trans, | 70 const std::string& id, sync_api::WriteTransaction* trans, |
71 const sync_api::ReadNode& root, | 71 const sync_api::ReadNode& root, |
72 sync_pb::ExtensionSpecifics* server_data); | 72 sync_pb::ExtensionSpecifics* server_data); |
73 | 73 |
74 // Updates the server data from the given extension data. | 74 // Updates the server data from the given extension data. |
75 // extension_data->ServerNeedsUpdate() must hold before this | 75 // extension_data->ServerNeedsUpdate() must hold before this |
76 // function is called. Returns whether or not the update was | 76 // function is called. Returns whether or not the update was |
77 // successful. If the update was successful, | 77 // successful. If the update was successful, |
78 // extension_data->ServerNeedsUpdate() will be false after this | 78 // extension_data->ServerNeedsUpdate() will be false after this |
(...skipping 20 matching lines...) Expand all Loading... |
99 | 99 |
100 // Weak pointer. | 100 // Weak pointer. |
101 ProfileSyncService* sync_service_; | 101 ProfileSyncService* sync_service_; |
102 | 102 |
103 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); | 103 DISALLOW_COPY_AND_ASSIGN(ExtensionModelAssociator); |
104 }; | 104 }; |
105 | 105 |
106 } // namespace browser_sync | 106 } // namespace browser_sync |
107 | 107 |
108 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ | 108 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_MODEL_ASSOCIATOR_H_ |
OLD | NEW |