Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8435)

Unified Diff: chrome/browser/webdata/web_data_service.h

Issue 11783091: Remove GenericRequest templates from WebDataService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix WIN error Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a2afe4afe5fa376af82c857d5f983441b2f989c6 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"
#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<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);
+ 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);
+ WDTypedResult* GetWebAppImagesImpl(const GURL& app_url);
//////////////////////////////////////////////////////////////////////////////
//
@@ -397,20 +412,19 @@ 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);
+ WDTypedResult* GetWebIntentServicesImpl(const string16& action);
+ WDTypedResult* GetWebIntentServicesForURLImpl(const string16& service_url);
+ 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);
+ WDTypedResult* GetDefaultWebIntentServicesForActionImpl(
+ const string16& action);
+ WDTypedResult* GetAllDefaultWebIntentServicesImpl();
//////////////////////////////////////////////////////////////////////////////
//
@@ -418,10 +432,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);
+ WDTypedResult* GetAllTokensImpl();
#if defined(OS_WIN)
//////////////////////////////////////////////////////////////////////////////
@@ -429,9 +443,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);
+ WDTypedResult* GetIE7LoginImpl(const IE7PasswordInfo& info);
#endif // defined(OS_WIN)
//////////////////////////////////////////////////////////////////////////////
@@ -439,26 +453,25 @@ class WebDataService
// Autofill.
//
//////////////////////////////////////////////////////////////////////////////
- void AddFormElementsImpl(
- GenericRequest<std::vector<FormFieldData> >* request);
- void GetFormValuesForElementNameImpl(WebDataRequest* request,
+ void AddFormElementsImpl(const std::vector<FormFieldData>& fields);
+ 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);
+ 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);
+ 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.

Powered by Google App Engine
This is Rietveld 408576698