Logo Search packages:      
Sourcecode: chromium-browser version File versions  Download package


// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.


#include "base/basictypes.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/change_processor.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_type.h"
#include "chrome/common/notification_registrar.h"

class NotificationDetails;
class NotificationSource;
class Profile;

namespace browser_sync {

class ExtensionModelAssociator;
class UnrecoverableErrorHandler;

// This class is responsible for taking changes from the
// ExtensionService and applying them to the sync_api 'syncable'
// model, and vice versa. All operations and use of this class are
// from the UI thread.
class ExtensionChangeProcessor : public ChangeProcessor,
                                 public NotificationObserver {
  // Does not take ownership of either argument.
  // TODO(akalin): Create a Delegate interface and take that instead.
  // That'll enable us to unit test this class.
      UnrecoverableErrorHandler* error_handler,
      ExtensionModelAssociator* extension_model_associator);
  virtual ~ExtensionChangeProcessor();

  // NotificationObserver implementation.
  // BrowserExtensionProvider -> sync_api model change application.
  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details);

  // ChangeProcessor implementation.
  // sync_api model -> BrowserExtensionProvider change application.
  virtual void ApplyChangesFromSyncModel(
      const sync_api::BaseTransaction* trans,
      const sync_api::SyncManager::ChangeRecord* changes,
      int change_count);

  // ChangeProcessor implementation.
  virtual void StartImpl(Profile* profile);
  virtual void StopImpl();

  void StartObserving();
  void StopObserving();

  ExtensionModelAssociator* extension_model_associator_;
  NotificationRegistrar notification_registrar_;
  // Owner of the ExtensionService.  Non-NULL iff |running()| is true.
  Profile* profile_;


}  // namespace browser_sync


Generated by  Doxygen 1.6.0   Back to index