Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / sync / sessions / sync_session_context.cc
blob39ae42771cc4cb31e8a9655dfee249e9747797f8
1 // Copyright (c) 2012 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.
5 #include "sync/sessions/sync_session_context.h"
7 #include "sync/sessions/debug_info_getter.h"
8 #include "sync/util/extensions_activity.h"
10 namespace syncer {
11 namespace sessions {
13 SyncSessionContext::SyncSessionContext(
14 ServerConnectionManager* connection_manager,
15 syncable::Directory* directory,
16 ExtensionsActivity* extensions_activity,
17 const std::vector<SyncEngineEventListener*>& listeners,
18 DebugInfoGetter* debug_info_getter,
19 ModelTypeRegistry* model_type_registry,
20 bool keystore_encryption_enabled,
21 bool client_enabled_pre_commit_update_avoidance,
22 const std::string& invalidator_client_id)
23 : connection_manager_(connection_manager),
24 directory_(directory),
25 extensions_activity_(extensions_activity),
26 notifications_enabled_(false),
27 max_commit_batch_size_(kDefaultMaxCommitBatchSize),
28 debug_info_getter_(debug_info_getter),
29 model_type_registry_(model_type_registry),
30 keystore_encryption_enabled_(keystore_encryption_enabled),
31 invalidator_client_id_(invalidator_client_id),
32 server_enabled_pre_commit_update_avoidance_(false),
33 client_enabled_pre_commit_update_avoidance_(
34 client_enabled_pre_commit_update_avoidance) {
35 std::vector<SyncEngineEventListener*>::const_iterator it;
36 for (it = listeners.begin(); it != listeners.end(); ++it)
37 listeners_.AddObserver(*it);
40 SyncSessionContext::~SyncSessionContext() {
43 ModelTypeSet SyncSessionContext::GetEnabledTypes() const {
44 return model_type_registry_->GetEnabledTypes();
47 void SyncSessionContext::SetRoutingInfo(
48 const ModelSafeRoutingInfo& routing_info) {
49 model_type_registry_->SetEnabledDirectoryTypes(routing_info);
52 } // namespace sessions
53 } // namespace syncer