Home | History | Annotate | Download | only in glue
      1 // Copyright (c) 2012 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_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
      6 #define CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
      7 
      8 #include "base/compiler_specific.h"
      9 #include "base/memory/ref_counted.h"
     10 #include "base/scoped_observer.h"
     11 #include "chrome/browser/sync/glue/non_ui_data_type_controller.h"
     12 #include "components/autofill/core/browser/personal_data_manager_observer.h"
     13 
     14 namespace autofill {
     15 class PersonalDataManager;
     16 }  // namespace autofill
     17 
     18 namespace browser_sync {
     19 
     20 class AutofillProfileDataTypeController
     21     : public NonUIDataTypeController,
     22       public autofill::PersonalDataManagerObserver {
     23  public:
     24   AutofillProfileDataTypeController(
     25       ProfileSyncComponentsFactory* profile_sync_factory,
     26       Profile* profile,
     27       ProfileSyncService* sync_service);
     28 
     29   // NonUIDataTypeController implementation.
     30   virtual syncer::ModelType type() const OVERRIDE;
     31   virtual syncer::ModelSafeGroup model_safe_group() const OVERRIDE;
     32 
     33   // PersonalDataManagerObserver implementation:
     34   virtual void OnPersonalDataChanged() OVERRIDE;
     35 
     36  protected:
     37   virtual ~AutofillProfileDataTypeController();
     38 
     39   // NonUIDataTypeController implementation.
     40   virtual bool PostTaskOnBackendThread(
     41       const tracked_objects::Location& from_here,
     42       const base::Closure& task) OVERRIDE;
     43   virtual bool StartModels() OVERRIDE;
     44   virtual void StopModels() OVERRIDE;
     45 
     46  private:
     47   // Callback to notify that WebDatabase has loaded.
     48   void WebDatabaseLoaded();
     49 
     50   autofill::PersonalDataManager* personal_data_;
     51   bool callback_registered_;
     52 
     53   DISALLOW_COPY_AND_ASSIGN(AutofillProfileDataTypeController);
     54 };
     55 
     56 }  // namespace browser_sync
     57 
     58 #endif  // CHROME_BROWSER_SYNC_GLUE_AUTOFILL_PROFILE_DATA_TYPE_CONTROLLER_H_
     59