Home | History | Annotate | Download | only in sessions
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/sync/sessions/sync_session_context.h"
      6 
      7 #include "chrome/browser/sync/util/extensions_activity_monitor.h"
      8 #include "chrome/browser/sync/sessions/session_state.h"
      9 #include "content/browser/browser_thread.h"
     10 
     11 namespace browser_sync {
     12 namespace sessions {
     13 
     14 SyncSessionContext::SyncSessionContext(
     15     ServerConnectionManager* connection_manager,
     16     syncable::DirectoryManager* directory_manager,
     17     ModelSafeWorkerRegistrar* model_safe_worker_registrar,
     18     const std::vector<SyncEngineEventListener*>& listeners)
     19     : resolver_(NULL),
     20       connection_manager_(connection_manager),
     21       directory_manager_(directory_manager),
     22       registrar_(model_safe_worker_registrar),
     23       extensions_activity_monitor_(new ExtensionsActivityMonitor()),
     24       notifications_enabled_(false),
     25       max_commit_batch_size_(kDefaultMaxCommitBatchSize) {
     26   std::vector<SyncEngineEventListener*>::const_iterator it;
     27   for (it = listeners.begin(); it != listeners.end(); ++it)
     28     listeners_.AddObserver(*it);
     29 }
     30 
     31 SyncSessionContext::~SyncSessionContext() {
     32   // In unittests, there may be no UI thread, so the above will fail.
     33   if (!BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE,
     34                                 extensions_activity_monitor_)) {
     35     delete extensions_activity_monitor_;
     36   }
     37 }
     38 
     39 }  // namespace sessions
     40 }  // namespace browser_sync
     41