#ifndef ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_
#define ANDROID_WEBVIEW_BROWSER_AW_FORM_DATABASE_SERVICE_H_
#include "base/basictypes.h"
#include "base/files/file_path.h"
#include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
#include "components/webdata/common/web_data_service_consumer.h"
#include "components/webdata/common/web_database_service.h"
namespace base {
class WaitableEvent;
};
namespace android_webview {
class AwFormDatabaseService : public WebDataServiceConsumer {
public:
AwFormDatabaseService(const base::FilePath path);
virtual ~AwFormDatabaseService();
void Shutdown();
bool HasFormData();
void ClearFormData();
scoped_refptr<autofill::AutofillWebDataService>
get_autofill_webdata_service();
virtual void OnWebDataServiceRequestDone(
WebDataServiceBase::Handle h,
const WDTypedResult* result) OVERRIDE;
private:
struct PendingQuery {
bool* result;
base::WaitableEvent* completion;
};
typedef std::map<WebDataServiceBase::Handle, PendingQuery> QueryMap;
void ClearFormDataImpl();
void HasFormDataImpl(base::WaitableEvent* completion, bool* result);
QueryMap result_map_;
scoped_refptr<autofill::AutofillWebDataService> autofill_data_;
scoped_refptr<WebDatabaseService> web_database_;
DISALLOW_COPY_AND_ASSIGN(AwFormDatabaseService);
};
}
#endif