| Index: chrome/browser/sync/glue/typed_url_data_type_controller.h
|
| diff --git a/chrome/browser/sync/glue/typed_url_data_type_controller.h b/chrome/browser/sync/glue/typed_url_data_type_controller.h
|
| index 386a01d3d47f9d3f87a11d8e73855ccccb676cb1..2db55202c8b6e821ad9c6fc88035ae96bcde07ef 100644
|
| --- a/chrome/browser/sync/glue/typed_url_data_type_controller.h
|
| +++ b/chrome/browser/sync/glue/typed_url_data_type_controller.h
|
| @@ -8,11 +8,8 @@
|
|
|
| #include <string>
|
|
|
| -#include "base/basictypes.h"
|
| #include "base/memory/scoped_ptr.h"
|
| -#include "base/synchronization/waitable_event.h"
|
| -#include "chrome/browser/sync/glue/data_type_controller.h"
|
| -#include "chrome/browser/sync/profile_sync_service.h"
|
| +#include "chrome/browser/sync/glue/non_frontend_data_type_controller.h"
|
| #include "content/browser/cancelable_request.h"
|
| #include "content/common/notification_observer.h"
|
| #include "content/common/notification_registrar.h"
|
| @@ -21,9 +18,6 @@
|
| class NotificationSource;
|
| class NotificationDetails;
|
| class HistoryService;
|
| -class Profile;
|
| -class ProfileSyncFactory;
|
| -class ProfileSyncService;
|
|
|
| namespace history {
|
| class HistoryBackend;
|
| @@ -31,40 +25,22 @@ class HistoryBackend;
|
|
|
| namespace browser_sync {
|
|
|
| -class AssociatorInterface;
|
| -class ChangeProcessor;
|
| class ControlTask;
|
|
|
| // A class that manages the startup and shutdown of typed_url sync.
|
| -class TypedUrlDataTypeController : public DataTypeController,
|
| +class TypedUrlDataTypeController : public NonFrontendDataTypeController,
|
| public NotificationObserver,
|
| public CancelableRequestConsumerBase {
|
| public:
|
| TypedUrlDataTypeController(
|
| ProfileSyncFactory* profile_sync_factory,
|
| - Profile* profile,
|
| - ProfileSyncService* sync_service);
|
| + Profile* profile);
|
| virtual ~TypedUrlDataTypeController();
|
|
|
| - // DataTypeController implementation
|
| - virtual void Start(StartCallback* start_callback);
|
| -
|
| - virtual void Stop();
|
| -
|
| - virtual bool enabled();
|
| -
|
| + // NonFrontendDataTypeController implementation
|
| virtual syncable::ModelType type() const;
|
| -
|
| virtual browser_sync::ModelSafeGroup model_safe_group() const;
|
|
|
| - virtual std::string name() const;
|
| -
|
| - virtual State state() const;
|
| -
|
| - // UnrecoverableHandler implementation
|
| - virtual void OnUnrecoverableError(const tracked_objects::Location& from_here,
|
| - const std::string& message);
|
| -
|
| // NotificationObserver implementation.
|
| virtual void Observe(NotificationType type,
|
| const NotificationSource& source,
|
| @@ -73,50 +49,35 @@ class TypedUrlDataTypeController : public DataTypeController,
|
| // CancelableRequestConsumerBase implementation.
|
| virtual void OnRequestAdded(CancelableRequestProvider* provider,
|
| CancelableRequestProvider::Handle handle) {}
|
| -
|
| virtual void OnRequestRemoved(CancelableRequestProvider* provider,
|
| CancelableRequestProvider::Handle handle) {}
|
| -
|
| virtual void WillExecute(CancelableRequestProvider* provider,
|
| CancelableRequestProvider::Handle handle) {}
|
| -
|
| virtual void DidExecute(CancelableRequestProvider* provider,
|
| CancelableRequestProvider::Handle handle) {}
|
|
|
| + protected:
|
| + // NonFrontendDataTypeController interface.
|
| + virtual bool StartModels();
|
| + virtual bool StartAssociationAsync();
|
| + virtual void CreateSyncComponents();
|
| + virtual void StopModels();
|
| + virtual bool StopAssociationAsync();
|
| + virtual void RecordUnrecoverableError(
|
| + const tracked_objects::Location& from_here,
|
| + const std::string& message);
|
| + virtual void RecordAssociationTime(base::TimeDelta time);
|
| + virtual void RecordStartFailure(StartResult result);
|
| +
|
| private:
|
| friend class ControlTask;
|
| - void StartImpl(history::HistoryBackend* backend);
|
| - void StartDone(StartResult result, State state);
|
| - void StartDoneImpl(StartResult result, State state);
|
| - void StopImpl();
|
| - void StartFailed(StartResult result);
|
| - void OnUnrecoverableErrorImpl(const tracked_objects::Location& from_here,
|
| - const std::string& message);
|
| -
|
| - void set_state(State state) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - state_ = state;
|
| - }
|
| -
|
| - ProfileSyncFactory* profile_sync_factory_;
|
| - Profile* profile_;
|
| - ProfileSyncService* sync_service_;
|
| - State state_;
|
| -
|
| - scoped_ptr<AssociatorInterface> model_associator_;
|
| - scoped_ptr<ChangeProcessor> change_processor_;
|
| - scoped_ptr<StartCallback> start_callback_;
|
| - scoped_refptr<HistoryService> history_service_;
|
|
|
| - NotificationRegistrar notification_registrar_;
|
| -
|
| - base::Lock abort_association_lock_;
|
| - bool abort_association_;
|
| - base::WaitableEvent abort_association_complete_;
|
| + // Helper method to launch Associate() and Destroy() on the history thread.
|
| + void RunOnHistoryThread(bool start, history::HistoryBackend* backend);
|
|
|
| - // Barrier to ensure that the datatype has been stopped on the DB thread
|
| - // from the UI thread.
|
| - base::WaitableEvent datatype_stopped_;
|
| + history::HistoryBackend* backend_;
|
| + scoped_refptr<HistoryService> history_service_;
|
| + NotificationRegistrar notification_registrar_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(TypedUrlDataTypeController);
|
| };
|
|
|