Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / components / sync_driver / backend_data_type_configurer.cc
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5
6 #include "components/sync_driver/backend_data_type_configurer.h"
7
8 namespace browser_sync {
9
10 // static
11 syncer::ModelTypeSet
12 BackendDataTypeConfigurer::GetDataTypesInState(
13     DataTypeConfigState state, const DataTypeConfigStateMap& state_map) {
14   syncer::ModelTypeSet types;
15   for (DataTypeConfigStateMap::const_iterator type_it = state_map.begin();
16         type_it != state_map.end(); ++type_it) {
17     if (type_it->second == state)
18       types.Put(type_it->first);
19   }
20   return types;
21 }
22
23 // static
24 void BackendDataTypeConfigurer::SetDataTypesState(
25     DataTypeConfigState state, syncer::ModelTypeSet types,
26     DataTypeConfigStateMap* state_map) {
27   for (syncer::ModelTypeSet::Iterator it = types.First(); it.Good(); it.Inc()) {
28     (*state_map)[it.Get()] = state;
29   }
30 }
31
32 }  // namespace browser_sync