bookmark_data_type_controller.h revision ddb351dbec246cf1fab5ec20d2d5520909041de1
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#ifndef CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
6#define CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
7#pragma once
8
9#include <string>
10
11#include "chrome/browser/sync/glue/frontend_data_type_controller.h"
12#include "content/common/notification_observer.h"
13#include "content/common/notification_registrar.h"
14
15class NotificationDetails;
16class NotificationType;
17class NotificationSource;
18
19namespace browser_sync {
20
21// A class that manages the startup and shutdown of bookmark sync.
22class BookmarkDataTypeController : public FrontendDataTypeController,
23                                   public NotificationObserver {
24 public:
25  BookmarkDataTypeController(
26      ProfileSyncFactory* profile_sync_factory,
27      Profile* profile,
28      ProfileSyncService* sync_service);
29  virtual ~BookmarkDataTypeController();
30
31  // FrontendDataTypeController interface.
32  virtual syncable::ModelType type() const;
33
34  // NotificationObserver interface.
35  virtual void Observe(NotificationType type,
36                       const NotificationSource& source,
37                       const NotificationDetails& details);
38
39 private:
40  // FrontendDataTypeController interface.
41  virtual bool StartModels();
42  virtual void CleanupState();
43  virtual void CreateSyncComponents();
44  virtual void RecordUnrecoverableError(
45      const tracked_objects::Location& from_here,
46      const std::string& message);
47  virtual void RecordAssociationTime(base::TimeDelta time);
48  virtual void RecordStartFailure(StartResult result);
49
50  NotificationRegistrar registrar_;
51
52  DISALLOW_COPY_AND_ASSIGN(BookmarkDataTypeController);
53};
54
55}  // namespace browser_sync
56
57#endif  // CHROME_BROWSER_SYNC_GLUE_BOOKMARK_DATA_TYPE_CONTROLLER_H__
58