blob: b4a175eed0d5c9991e6fc22a28030b2e39ffa0e2 [file] [log] [blame]
// Copyright (c) 2012 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.
#ifndef CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
#define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
#include "base/compiler_specific.h"
#include "base/memory/ref_counted.h"
#include "base/scoped_observer.h"
#include "chrome/browser/sync/glue/non_ui_data_type_controller.h"
#include "components/autofill/core/browser/personal_data_manager_observer.h"
namespace autofill {
class PersonalDataManager;
} // namespace autofill
namespace browser_sync {
class AutofillProfileDataTypeController
: public NonUIDataTypeController,
public autofill::PersonalDataManagerObserver {
public:
AutofillProfileDataTypeController(
ProfileSyncComponentsFactory* profile_sync_factory,
Profile* profile,
ProfileSyncService* sync_service);
// NonUIDataTypeController implementation.
virtual syncer::ModelType type() const OVERRIDE;
virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE;
// PersonalDataManagerObserver implementation:
virtual void OnPersonalDataChanged() OVERRIDE;
protected:
virtual ~AutofillProfileDataTypeController();
// NonUIDataTypeController implementation.
virtual bool PostTaskOnBackendThread(
const tracked_objects::Location& from_here,
const base::Closure& task) OVERRIDE;
virtual bool StartModels() OVERRIDE;
virtual void StopModels() OVERRIDE;
private:
// Callback to notify that WebDatabase has loaded.
void WebDatabaseLoaded();
autofill::PersonalDataManager* personal_data_;
bool callback_registered_;
DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController);
};
} // namespace browser_sync
#endif // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_