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


// Copyright (c) 2009 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 "base/scoped_ptr.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/common/notification_registrar.h"
#include "chrome/common/notification_observer.h"

class NotificationDetails;
class NotificationType;
class NotificationSource;
class Profile;
class ProfileSyncService;
class ProfileSyncFactory;

namespace browser_sync {

class AssociatorInterface;
class ChangeProcessor;

// A class that manages the startup and shutdown of bookmark sync.
class BookmarkDataTypeController : public DataTypeController,
                                   public NotificationObserver {
      ProfileSyncFactory* profile_sync_factory,
      Profile* profile,
      ProfileSyncService* sync_service);
  virtual ~BookmarkDataTypeController();

  // DataTypeController interface.
  virtual void Start(StartCallback* start_callback);

  virtual void Stop();

  virtual bool enabled() {
    return true;

  virtual syncable::ModelType type() {
    return syncable::BOOKMARKS;

  virtual browser_sync::ModelSafeGroup model_safe_group() {
    return browser_sync::GROUP_UI;

  virtual const char* name() const {
    // For logging only.
    return "bookmark";

  virtual State state() {
    return state_;

  // UnrecoverableErrorHandler interface.
  virtual void OnUnrecoverableError();

  // NotificationObserver interface.
  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details);

  // Runs model association and change processor registration.
  void Associate();

  // Helper method to run the stashed start callback with a given result.
  void FinishStart(StartResult result);

  // Cleans up state and calls callback when star fails.
  void StartFailed(StartResult result);

  ProfileSyncFactory* profile_sync_factory_;
  Profile* profile_;
  ProfileSyncService* sync_service_;

  State state_;

  scoped_ptr<StartCallback> start_callback_;
  scoped_ptr<AssociatorInterface> model_associator_;
  scoped_ptr<ChangeProcessor> change_processor_;
  NotificationRegistrar registrar_;


}  // namespace browser_sync


Generated by  Doxygen 1.6.0   Back to index