Chromium Code Reviews| Index: chrome/browser/webdata/web_data_service.h |
| diff --git a/chrome/browser/webdata/web_data_service.h b/chrome/browser/webdata/web_data_service.h |
| index f50d204f98bbb25837bb088c900d0759d0cf63f2..576bd5f400e4a17e91698c182ff279956044185e 100644 |
| --- a/chrome/browser/webdata/web_data_service.h |
| +++ b/chrome/browser/webdata/web_data_service.h |
| @@ -13,6 +13,7 @@ |
| #include <string> |
| #include <vector> |
| +#include "base/callback.h" |
|
erikwright (departed)
2013/01/14 15:51:36
I don't see why this is required here, but if it i
|
| #include "base/callback_forward.h" |
| #include "base/file_path.h" |
| #include "base/location.h" |
| @@ -70,6 +71,8 @@ struct WebIntentServiceData; |
| typedef std::vector<AutofillChange> AutofillChangeList; |
| +typedef base::Callback<scoped_ptr<WDTypedResult>(void)> ResultTask; |
| + |
| // Result from GetWebAppImages. |
| struct WDAppImagesResult { |
| WDAppImagesResult(); |
| @@ -338,9 +341,6 @@ class WebDataService |
| content::BrowserThread::UI>; |
| friend class base::DeleteHelper<WebDataService>; |
| - typedef GenericRequest2<std::vector<const TemplateURLData*>, |
| - KeywordTable::Keywords> SetKeywordsRequest; |
| - |
| // Invoked on the main thread if initializing the db fails. |
| void DBInitFailed(sql::InitStatus init_status); |
| @@ -366,6 +366,20 @@ class WebDataService |
| void ScheduleTask(const tracked_objects::Location& from_here, |
| const base::Closure& task); |
| + void ScheduleDBTask(const tracked_objects::Location& from_here, |
| + const base::Closure& task); |
| + |
| + WebDataService::Handle ScheduleDBTaskWithResult( |
| + const tracked_objects::Location& from_here, |
| + const ResultTask& task, |
| + WebDataServiceConsumer* consumer); |
| + |
| + void DBTaskWrapper(const base::Closure& task, |
| + WebDataRequest* request); |
| + |
| + void DBResultTaskWrapper(const ResultTask& task, |
| + WebDataRequest* request); |
| + |
| // Schedule a commit if one is not already pending. |
| void ScheduleCommit(); |
| @@ -374,22 +388,23 @@ class WebDataService |
| // Keywords. |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| - void AddKeywordImpl(GenericRequest<TemplateURLData>* request); |
| - void RemoveKeywordImpl(GenericRequest<TemplateURLID>* request); |
| - void UpdateKeywordImpl(GenericRequest<TemplateURLData>* request); |
| - void GetKeywordsImpl(WebDataRequest* request); |
| - void SetDefaultSearchProviderImpl(GenericRequest<TemplateURLID>* r); |
| - void SetBuiltinKeywordVersionImpl(GenericRequest<int>* r); |
| + void AddKeywordImpl(const TemplateURLData& data); |
| + void RemoveKeywordImpl(TemplateURLID id); |
| + void UpdateKeywordImpl(const TemplateURLData& data); |
| + scoped_ptr<WDTypedResult> GetKeywordsImpl(); |
| + void SetDefaultSearchProviderImpl(TemplateURLID r); |
| + void SetBuiltinKeywordVersionImpl(int version); |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| // Web Apps. |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| - void SetWebAppImageImpl(GenericRequest2<GURL, SkBitmap>* request); |
| - void SetWebAppHasAllImagesImpl(GenericRequest2<GURL, bool>* request); |
| - void RemoveWebAppImpl(GenericRequest<GURL>* request); |
| - void GetWebAppImagesImpl(GenericRequest<GURL>* request); |
| + |
| + void SetWebAppImageImpl(const GURL& app_url, const SkBitmap& image); |
| + void SetWebAppHasAllImagesImpl(const GURL& app_url, bool has_all_images); |
| + void RemoveWebAppImpl(const GURL& app_url); |
| + scoped_ptr<WDTypedResult> GetWebAppImagesImpl(const GURL& app_url); |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| @@ -397,20 +412,20 @@ class WebDataService |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| void AddWebIntentServiceImpl( |
| - GenericRequest<webkit_glue::WebIntentServiceData>* request); |
| + const webkit_glue::WebIntentServiceData& service); |
| void RemoveWebIntentServiceImpl( |
| - GenericRequest<webkit_glue::WebIntentServiceData>* request); |
| - void GetWebIntentServicesImpl(GenericRequest<string16>* request); |
| - void GetWebIntentServicesForURLImpl(GenericRequest<string16>* request); |
| - void GetAllWebIntentServicesImpl(GenericRequest<std::string>* request); |
| - void AddDefaultWebIntentServiceImpl( |
| - GenericRequest<DefaultWebIntentService>* request); |
| + const webkit_glue::WebIntentServiceData& service); |
| + scoped_ptr<WDTypedResult> GetWebIntentServicesImpl(const string16& action); |
| + scoped_ptr<WDTypedResult> GetWebIntentServicesForURLImpl( |
| + const string16& service_url); |
| + scoped_ptr<WDTypedResult> GetAllWebIntentServicesImpl(); |
| + void AddDefaultWebIntentServiceImpl(const DefaultWebIntentService& service); |
| void RemoveDefaultWebIntentServiceImpl( |
| - GenericRequest<DefaultWebIntentService>* request); |
| - void RemoveWebIntentServiceDefaultsImpl(GenericRequest<GURL>* request); |
| - void GetDefaultWebIntentServicesForActionImpl( |
| - GenericRequest<string16>* request); |
| - void GetAllDefaultWebIntentServicesImpl(GenericRequest<std::string>* request); |
| + const DefaultWebIntentService& service); |
| + void RemoveWebIntentServiceDefaultsImpl(const GURL& service_url); |
| + scoped_ptr<WDTypedResult> GetDefaultWebIntentServicesForActionImpl( |
| + const string16& action); |
| + scoped_ptr<WDTypedResult> GetAllDefaultWebIntentServicesImpl(); |
| ////////////////////////////////////////////////////////////////////////////// |
| // |
| @@ -418,10 +433,10 @@ class WebDataService |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| - void RemoveAllTokensImpl(GenericRequest<std::string>* request); |
| - void SetTokenForServiceImpl( |
| - GenericRequest2<std::string, std::string>* request); |
| - void GetAllTokensImpl(GenericRequest<std::string>* request); |
| + void RemoveAllTokensImpl(); |
| + void SetTokenForServiceImpl(const std::string& service, |
| + const std::string& token); |
| + scoped_ptr<WDTypedResult> GetAllTokensImpl(); |
| #if defined(OS_WIN) |
| ////////////////////////////////////////////////////////////////////////////// |
| @@ -429,9 +444,9 @@ class WebDataService |
| // Password manager. |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| - void AddIE7LoginImpl(GenericRequest<IE7PasswordInfo>* request); |
| - void RemoveIE7LoginImpl(GenericRequest<IE7PasswordInfo>* request); |
| - void GetIE7LoginImpl(GenericRequest<IE7PasswordInfo>* request); |
| + void AddIE7LoginImpl(const IE7PasswordInfo& info); |
| + void RemoveIE7LoginImpl(const IE7PasswordInfo& info); |
| + scoped_ptr<WDTypedResult> GetIE7LoginImpl(const IE7PasswordInfo& info); |
| #endif // defined(OS_WIN) |
| ////////////////////////////////////////////////////////////////////////////// |
| @@ -439,26 +454,25 @@ class WebDataService |
| // Autofill. |
| // |
| ////////////////////////////////////////////////////////////////////////////// |
| - void AddFormElementsImpl( |
| - GenericRequest<std::vector<FormFieldData> >* request); |
| - void GetFormValuesForElementNameImpl(WebDataRequest* request, |
| + void AddFormElementsImpl(const std::vector<FormFieldData>& fields); |
| + scoped_ptr<WDTypedResult> GetFormValuesForElementNameImpl( |
| const string16& name, const string16& prefix, int limit); |
| void RemoveFormElementsAddedBetweenImpl( |
| - GenericRequest2<base::Time, base::Time>* request); |
| - void RemoveExpiredFormElementsImpl(WebDataRequest* request); |
| - void RemoveFormValueForElementNameImpl( |
| - GenericRequest2<string16, string16>* request); |
| - void AddAutofillProfileImpl(GenericRequest<AutofillProfile>* request); |
| - void UpdateAutofillProfileImpl(GenericRequest<AutofillProfile>* request); |
| - void RemoveAutofillProfileImpl(GenericRequest<std::string>* request); |
| - void GetAutofillProfilesImpl(WebDataRequest* request); |
| - void EmptyMigrationTrashImpl(GenericRequest<bool>* request); |
| - void AddCreditCardImpl(GenericRequest<CreditCard>* request); |
| - void UpdateCreditCardImpl(GenericRequest<CreditCard>* request); |
| - void RemoveCreditCardImpl(GenericRequest<std::string>* request); |
| - void GetCreditCardsImpl(WebDataRequest* request); |
| + const base::Time& delete_begin, const base::Time& delete_end); |
| + void RemoveExpiredFormElementsImpl(); |
| + void RemoveFormValueForElementNameImpl(const string16& name, |
| + const string16& value); |
| + void AddAutofillProfileImpl(const AutofillProfile& profile); |
| + void UpdateAutofillProfileImpl(const AutofillProfile& profile); |
| + void RemoveAutofillProfileImpl(const std::string& guid); |
| + scoped_ptr<WDTypedResult> GetAutofillProfilesImpl(); |
| + void EmptyMigrationTrashImpl(bool notify_sync); |
| + void AddCreditCardImpl(const CreditCard& credit_card); |
| + void UpdateCreditCardImpl(const CreditCard& credit_card); |
| + void RemoveCreditCardImpl(const std::string& guid); |
| + scoped_ptr<WDTypedResult> GetCreditCardsImpl(); |
| void RemoveAutofillProfilesAndCreditCardsModifiedBetweenImpl( |
| - GenericRequest2<base::Time, base::Time>* request); |
| + const base::Time& delete_begin, const base::Time& delete_end); |
| // Callbacks to ensure that sensitive info is destroyed if request is |
| // cancelled. |