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

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

Issue 9370043: Add default intents methods for web data service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactor WaitUntilCalled Created 8 years, 10 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
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/browser/webdata/web_data_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/webdata/web_data_service.cc
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index 2f1e7ad00eb219f3efdcdc404ee90b3d95cc71ef..b1a4495b77a974fc739d79efecd3f6a0c968de84 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -11,6 +11,7 @@
#include "chrome/browser/autofill/autofill_country.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
+#include "chrome/browser/intents/default_web_intent_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/ui/profile_error_dialog.h"
@@ -311,6 +312,53 @@ WebDataService::Handle WebDataService::GetAllWebIntentServices(
return request->GetHandle();
}
+void WebDataService::AddDefaultWebIntentService(
+ const DefaultWebIntentService& service) {
+ GenericRequest<DefaultWebIntentService>* request =
+ new GenericRequest<DefaultWebIntentService>(
+ this, GetNextRequestHandle(), NULL, service);
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::AddDefaultWebIntentServiceImpl, this,
+ request));
+}
+
+void WebDataService::RemoveDefaultWebIntentService(
+ const DefaultWebIntentService& service) {
+ GenericRequest<DefaultWebIntentService>* request =
+ new GenericRequest<DefaultWebIntentService>(
+ this, GetNextRequestHandle(), NULL, service);
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::RemoveDefaultWebIntentServiceImpl, this,
+ request));
+}
+
+WebDataService::Handle WebDataService::GetDefaultWebIntentServicesForAction(
+ const string16& action,
+ WebDataServiceConsumer* consumer) {
+ DCHECK(consumer);
+ GenericRequest<string16>* request = new GenericRequest<string16>(
+ this, GetNextRequestHandle(), consumer, action);
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::GetDefaultWebIntentServicesForActionImpl,
+ this, request));
+ return request->GetHandle();
+}
+
+WebDataService::Handle WebDataService::GetAllDefaultWebIntentServices(
+ WebDataServiceConsumer* consumer) {
+ DCHECK(consumer);
+ GenericRequest<std::string>* request = new GenericRequest<std::string>(
+ this, GetNextRequestHandle(), consumer, std::string());
+ RegisterRequest(request);
+ ScheduleTask(FROM_HERE,
+ Bind(&WebDataService::GetAllDefaultWebIntentServicesImpl,
+ this, request));
+ return request->GetHandle();
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// Token Service
@@ -964,6 +1012,55 @@ void WebDataService::GetAllWebIntentServicesImpl(
request->RequestComplete();
}
+void WebDataService::AddDefaultWebIntentServiceImpl(
+ GenericRequest<DefaultWebIntentService>* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ const DefaultWebIntentService& service = request->arg();
+ db_->GetWebIntentsTable()->SetDefaultService(service);
+ ScheduleCommit();
+ }
+ request->RequestComplete();
+}
+
+void WebDataService::RemoveDefaultWebIntentServiceImpl(
+ GenericRequest<DefaultWebIntentService>* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ const DefaultWebIntentService& service = request->arg();
+ db_->GetWebIntentsTable()->RemoveDefaultService(service);
+ ScheduleCommit();
+ }
+ request->RequestComplete();
+}
+
+void WebDataService::GetDefaultWebIntentServicesForActionImpl(
+ GenericRequest<string16>* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ std::vector<DefaultWebIntentService> result;
+ db_->GetWebIntentsTable()->GetDefaultServices(
+ request->arg(), &result);
+ request->SetResult(
+ new WDResult<std::vector<DefaultWebIntentService> >(
+ WEB_INTENTS_DEFAULTS_RESULT, result));
+ }
+ request->RequestComplete();
+}
+
+void WebDataService::GetAllDefaultWebIntentServicesImpl(
+ GenericRequest<std::string>* request) {
+ InitializeDatabaseIfNecessary();
+ if (db_ && !request->IsCancelled(NULL)) {
+ std::vector<DefaultWebIntentService> result;
+ db_->GetWebIntentsTable()->GetAllDefaultServices(&result);
+ request->SetResult(
+ new WDResult<std::vector<DefaultWebIntentService> >(
+ WEB_INTENTS_DEFAULTS_RESULT, result));
+ }
+ request->RequestComplete();
+}
+
////////////////////////////////////////////////////////////////////////////////
//
// Token Service implementation.
« no previous file with comments | « chrome/browser/webdata/web_data_service.h ('k') | chrome/browser/webdata/web_data_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698