| 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_EXTENSION_UTIL_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ |
| 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 // This file contains some low-level utility functions used by | 9 // This file contains some low-level utility functions used by |
| 10 // extensions sync. | 10 // extensions sync. |
| 11 | 11 |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 class Extension; | 14 class Extension; |
| 15 class ExtensionPrefs; | 15 class ExtensionPrefs; |
| 16 class ExtensionServiceInterface; | 16 class ExtensionServiceInterface; |
| 17 struct ExtensionSyncData; |
| 17 struct UninstalledExtensionInfo; | 18 struct UninstalledExtensionInfo; |
| 18 | 19 |
| 19 namespace sync_pb { | 20 namespace sync_pb { |
| 20 class ExtensionSpecifics; | 21 class ExtensionSpecifics; |
| 21 } // sync_pb | 22 } // sync_pb |
| 22 | 23 |
| 23 namespace browser_sync { | 24 namespace browser_sync { |
| 24 | 25 |
| 25 // Returns whether or not the given extension is one we want to sync. | 26 // Returns whether or not the given extension is one we want to sync. |
| 26 bool IsExtensionValid(const Extension& extension); | 27 bool IsExtensionValid(const Extension& extension); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const sync_pb::ExtensionSpecifics& a, | 78 const sync_pb::ExtensionSpecifics& a, |
| 78 const sync_pb::ExtensionSpecifics& b); | 79 const sync_pb::ExtensionSpecifics& b); |
| 79 | 80 |
| 80 // Fills |specifics| with information taken from |extension|, which | 81 // Fills |specifics| with information taken from |extension|, which |
| 81 // must be a syncable extension. |specifics| will be valid after this | 82 // must be a syncable extension. |specifics| will be valid after this |
| 82 // function is called. | 83 // function is called. |
| 83 void GetExtensionSpecifics(const Extension& extension, | 84 void GetExtensionSpecifics(const Extension& extension, |
| 84 const ExtensionServiceInterface& extension_service, | 85 const ExtensionServiceInterface& extension_service, |
| 85 sync_pb::ExtensionSpecifics* specifics); | 86 sync_pb::ExtensionSpecifics* specifics); |
| 86 | 87 |
| 87 // Returns whether or not the extension should be updated according to | |
| 88 // the specifics. |extension| must be syncable and |specifics| must | |
| 89 // be valid. | |
| 90 bool IsExtensionOutdated(const Extension& extension, | |
| 91 const sync_pb::ExtensionSpecifics& specifics); | |
| 92 | |
| 93 // Merge |specifics| into |merged_specifics|. Both must be valid and | 88 // Merge |specifics| into |merged_specifics|. Both must be valid and |
| 94 // have the same ID. The merge policy is currently to copy the | 89 // have the same ID. The merge policy is currently to copy the |
| 95 // non-user properties of |specifics| into |merged_specifics| (and the | 90 // non-user properties of |specifics| into |merged_specifics| (and the |
| 96 // user properties if |merge_user_properties| is set) if |specifics| | 91 // user properties if |merge_user_properties| is set) if |specifics| |
| 97 // has a more recent or the same version as |merged_specifics|. | 92 // has a more recent or the same version as |merged_specifics|. |
| 98 void MergeExtensionSpecifics( | 93 void MergeExtensionSpecifics( |
| 99 const sync_pb::ExtensionSpecifics& specifics, | 94 const sync_pb::ExtensionSpecifics& specifics, |
| 100 bool merge_user_properties, | 95 bool merge_user_properties, |
| 101 sync_pb::ExtensionSpecifics* merged_specifics); | 96 sync_pb::ExtensionSpecifics* merged_specifics); |
| 102 | 97 |
| 98 // Fills |sync_data| with the data from |specifics|. Returns true iff |
| 99 // succesful. |
| 100 bool GetExtensionSyncData( |
| 101 const sync_pb::ExtensionSpecifics& specifics, |
| 102 ExtensionSyncData* sync_data); |
| 103 |
| 103 } // namespace browser_sync | 104 } // namespace browser_sync |
| 104 | 105 |
| 105 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ | 106 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ |
| OLD | NEW |