Chromium Code Reviews| Index: chrome/browser/sync/sessions/sync_session.h |
| =================================================================== |
| --- chrome/browser/sync/sessions/sync_session.h (revision 71618) |
| +++ chrome/browser/sync/sessions/sync_session.h (working copy) |
| @@ -15,6 +15,8 @@ |
| #define CHROME_BROWSER_SYNC_SESSIONS_SYNC_SESSION_H_ |
| #pragma once |
| +#include <map> |
| +#include <string> |
| #include <utility> |
| #include <vector> |
| @@ -25,6 +27,7 @@ |
| #include "chrome/browser/sync/sessions/session_state.h" |
| #include "chrome/browser/sync/sessions/status_controller.h" |
| #include "chrome/browser/sync/sessions/sync_session_context.h" |
| +#include "chrome/browser/sync/syncable/model_type.h" |
| #include "chrome/browser/sync/util/extensions_activity_monitor.h" |
| namespace syncable { |
| @@ -35,9 +38,38 @@ |
| class ModelSafeWorker; |
| namespace sessions { |
| -typedef std::pair<sync_pb::GetUpdatesCallerInfo::GetUpdatesSource, |
| - syncable::ModelTypeBitSet> SyncSourceInfo; |
| +// A container that contains a set of datatypes with possible string payloads. |
| +typedef std::map<syncable::ModelType, std::string> TypePayloadMap; |
| + |
| +// Helper utils for building TypePayloadMaps. |
| +// Convert a ModelTypeBitset into a TypePayloadMap using a default payload. |
| +TypePayloadMap ModelTypeBitSetToTypePayloadMap( |
| + const syncable::ModelTypeBitSet& types, |
| + const std::string& payload); |
| +// Convert a ModelSafeRoutingInfo into a TypePayloadMap using a default payload. |
| +TypePayloadMap RoutingInfoToTypePayloadMap( |
| + const ModelSafeRoutingInfo& routes, |
| + const std::string& payload); |
| +// Coalesce |update| into |original|, overwriting only when |update| has |
|
akalin
2011/01/26 01:15:17
I think it's safer to change the sig of this into:
Nicolas Zea
2011/01/26 01:41:28
Done.
|
| +// a non-empty payload. |
| +TypePayloadMap CoalescePayloads(const TypePayloadMap& original, |
| + const TypePayloadMap& update); |
| + |
| + |
| +// A container for the source of a sync session. This includes the update |
| +// source, the datatypes triggering the sync session, and possible session |
| +// specific payloads which should be sent to the server. |
| +struct SyncSourceInfo { |
| + SyncSourceInfo(); |
| + SyncSourceInfo( |
| + const sync_pb::GetUpdatesCallerInfo::GetUpdatesSource& u, |
| + const TypePayloadMap& t); |
| + |
| + sync_pb::GetUpdatesCallerInfo::GetUpdatesSource updates_source; |
| + TypePayloadMap types; |
| +}; |
| + |
| class SyncSession { |
| public: |
| // The Delegate services events that occur during the session requiring an |