| 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 #include "chrome/common/extensions/extension.h" |
| 15 |
| 15 class ExtensionPrefs; | 16 class ExtensionPrefs; |
| 16 class ExtensionServiceInterface; | 17 class ExtensionServiceInterface; |
| 18 class ExtensionSyncData; |
| 17 struct UninstalledExtensionInfo; | 19 struct UninstalledExtensionInfo; |
| 18 | 20 |
| 19 namespace sync_pb { | 21 namespace sync_pb { |
| 20 class ExtensionSpecifics; | 22 class ExtensionSpecifics; |
| 21 } // sync_pb | 23 } // sync_pb |
| 22 | 24 |
| 23 namespace browser_sync { | 25 namespace browser_sync { |
| 24 | 26 |
| 25 // Returns whether or not the given extension is one we want to sync. | 27 // Returns whether or not the given extension is one we want to sync. |
| 26 bool IsExtensionValid(const Extension& extension); | 28 bool IsExtensionValid(const Extension& extension); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const sync_pb::ExtensionSpecifics& a, | 79 const sync_pb::ExtensionSpecifics& a, |
| 78 const sync_pb::ExtensionSpecifics& b); | 80 const sync_pb::ExtensionSpecifics& b); |
| 79 | 81 |
| 80 // Fills |specifics| with information taken from |extension|, which | 82 // Fills |specifics| with information taken from |extension|, which |
| 81 // must be a syncable extension. |specifics| will be valid after this | 83 // must be a syncable extension. |specifics| will be valid after this |
| 82 // function is called. | 84 // function is called. |
| 83 void GetExtensionSpecifics(const Extension& extension, | 85 void GetExtensionSpecifics(const Extension& extension, |
| 84 const ExtensionServiceInterface& extension_service, | 86 const ExtensionServiceInterface& extension_service, |
| 85 sync_pb::ExtensionSpecifics* specifics); | 87 sync_pb::ExtensionSpecifics* specifics); |
| 86 | 88 |
| 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 | 89 // Merge |specifics| into |merged_specifics|. Both must be valid and |
| 94 // have the same ID. The merge policy is currently to copy the | 90 // have the same ID. The merge policy is currently to copy the |
| 95 // non-user properties of |specifics| into |merged_specifics| (and the | 91 // non-user properties of |specifics| into |merged_specifics| (and the |
| 96 // user properties if |merge_user_properties| is set) if |specifics| | 92 // user properties if |merge_user_properties| is set) if |specifics| |
| 97 // has a more recent or the same version as |merged_specifics|. | 93 // has a more recent or the same version as |merged_specifics|. |
| 98 void MergeExtensionSpecifics( | 94 void MergeExtensionSpecifics( |
| 99 const sync_pb::ExtensionSpecifics& specifics, | 95 const sync_pb::ExtensionSpecifics& specifics, |
| 100 bool merge_user_properties, | 96 bool merge_user_properties, |
| 101 sync_pb::ExtensionSpecifics* merged_specifics); | 97 sync_pb::ExtensionSpecifics* merged_specifics); |
| 102 | 98 |
| 99 // Fills |sync_data| with the data from |specifics|. Returns true iff |
| 100 // succesful. |
| 101 bool GetExtensionSyncData( |
| 102 const sync_pb::ExtensionSpecifics& specifics, |
| 103 ExtensionSyncData* sync_data); |
| 104 |
| 105 // Predicates used to filter sets of extensions. |
| 106 |
| 107 bool IsSyncableExtension(Extension::Type type, const GURL& update_url); |
| 108 |
| 109 bool IsValidAndSyncableExtension(const Extension& extension); |
| 110 |
| 111 bool IsSyncableApp(Extension::Type type); |
| 112 |
| 113 bool IsValidAndSyncableApp( |
| 114 const Extension& extension); |
| 115 |
| 103 } // namespace browser_sync | 116 } // namespace browser_sync |
| 104 | 117 |
| 105 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ | 118 #endif // CHROME_BROWSER_SYNC_GLUE_EXTENSION_UTIL_H_ |
| OLD | NEW |