| OLD | NEW |
| 1 // Copyright (c) 2010 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_EXTENSION_SYNC_TRAITS_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "chrome/browser/sync/syncable/model_type.h" | 9 #include "chrome/browser/sync/syncable/model_type.h" |
| 10 | 10 |
| 11 class Extension; | 11 class Extension; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 42 // successful. | 42 // successful. |
| 43 typedef bool (*ExtensionSpecificsEntityGetter)( | 43 typedef bool (*ExtensionSpecificsEntityGetter)( |
| 44 const sync_pb::EntitySpecifics&, sync_pb::ExtensionSpecifics*); | 44 const sync_pb::EntitySpecifics&, sync_pb::ExtensionSpecifics*); |
| 45 | 45 |
| 46 // Represents the properties needed for syncing data types that | 46 // Represents the properties needed for syncing data types that |
| 47 // involve extensions (e.g., "real" extensions, apps). | 47 // involve extensions (e.g., "real" extensions, apps). |
| 48 struct ExtensionSyncTraits { | 48 struct ExtensionSyncTraits { |
| 49 ExtensionSyncTraits( | 49 ExtensionSyncTraits( |
| 50 syncable::ModelType model_type, | 50 syncable::ModelType model_type, |
| 51 IsValidAndSyncablePredicate is_valid_and_syncable, | 51 IsValidAndSyncablePredicate is_valid_and_syncable, |
| 52 ShouldHandleExtensionUninstallPredicate | |
| 53 should_handle_extension_uninstall, | |
| 54 const char* root_node_tag, | 52 const char* root_node_tag, |
| 55 ExtensionSpecificsGetter extension_specifics_getter, | 53 ExtensionSpecificsGetter extension_specifics_getter, |
| 56 ExtensionSpecificsSetter extension_specifics_setter, | 54 ExtensionSpecificsSetter extension_specifics_setter, |
| 57 ExtensionSpecificsEntityGetter extension_specifics_entity_getter); | 55 ExtensionSpecificsEntityGetter extension_specifics_entity_getter); |
| 58 ~ExtensionSyncTraits(); | 56 ~ExtensionSyncTraits(); |
| 59 | 57 |
| 60 // The sync type for the data type. | 58 // The sync type for the data type. |
| 61 const syncable::ModelType model_type; | 59 const syncable::ModelType model_type; |
| 62 // A checker to make sure that the downloaded extension is valid and | 60 // A checker to make sure that the downloaded extension is valid and |
| 63 // syncable. | 61 // syncable. |
| 64 const IsValidAndSyncablePredicate is_valid_and_syncable; | 62 const IsValidAndSyncablePredicate is_valid_and_syncable; |
| 65 // A checker to know which extension uninstall events to handle. | |
| 66 const ShouldHandleExtensionUninstallPredicate | |
| 67 should_handle_extension_uninstall; | |
| 68 // The tag with which the top-level data type node is marked. | 63 // The tag with which the top-level data type node is marked. |
| 69 const char* const root_node_tag; | 64 const char* const root_node_tag; |
| 70 // The function that retrieves a ExtensionSpecifics reference (which | 65 // The function that retrieves a ExtensionSpecifics reference (which |
| 71 // may be embedded in another specifics object) from a sync node. | 66 // may be embedded in another specifics object) from a sync node. |
| 72 const ExtensionSpecificsGetter extension_specifics_getter; | 67 const ExtensionSpecificsGetter extension_specifics_getter; |
| 73 // The function that embeds an ExtensionSpecifics into a sync node. | 68 // The function that embeds an ExtensionSpecifics into a sync node. |
| 74 const ExtensionSpecificsSetter extension_specifics_setter; | 69 const ExtensionSpecificsSetter extension_specifics_setter; |
| 75 // The function that retrieves a ExtensionSpecifics (if possible) | 70 // The function that retrieves a ExtensionSpecifics (if possible) |
| 76 // from an EntitySpecifics. | 71 // from an EntitySpecifics. |
| 77 ExtensionSpecificsEntityGetter extension_specifics_entity_getter; | 72 ExtensionSpecificsEntityGetter extension_specifics_entity_getter; |
| 78 }; | 73 }; |
| 79 | 74 |
| 80 // Gets traits for extensions sync. | 75 // Gets traits for extensions sync. |
| 81 ExtensionSyncTraits GetExtensionSyncTraits(); | 76 ExtensionSyncTraits GetExtensionSyncTraits(); |
| 82 | 77 |
| 83 // Gets traits for apps sync. | 78 // Gets traits for apps sync. |
| 84 ExtensionSyncTraits GetAppSyncTraits(); | 79 ExtensionSyncTraits GetAppSyncTraits(); |
| 85 | 80 |
| 86 } // namespace browser_sync | 81 } // namespace browser_sync |
| 87 | 82 |
| 88 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_ | 83 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_SYNC_TRAITS_H_ |
| OLD | NEW |