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

Side by Side Diff: chrome/browser/webdata/web_data_service.cc

Issue 7633011: Added WebIntents GetAll support (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/webdata/web_data_service.h" 5 #include "chrome/browser/webdata/web_data_service.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/task.h" 9 #include "base/task.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 GenericRequest<string16>* request = new GenericRequest<string16>( 243 GenericRequest<string16>* request = new GenericRequest<string16>(
244 this, GetNextRequestHandle(), consumer, action); 244 this, GetNextRequestHandle(), consumer, action);
245 RegisterRequest(request); 245 RegisterRequest(request);
246 ScheduleTask( 246 ScheduleTask(
247 NewRunnableMethod(this, 247 NewRunnableMethod(this,
248 &WebDataService::GetWebIntentsImpl, 248 &WebDataService::GetWebIntentsImpl,
249 request)); 249 request));
250 return request->GetHandle(); 250 return request->GetHandle();
251 } 251 }
252 252
253 WebDataService::Handle WebDataService::GetAllWebIntents(
254 WebDataServiceConsumer* consumer) {
255 DCHECK(consumer);
256 GenericRequest<std::string>* request = new GenericRequest<std::string>(
257 this, GetNextRequestHandle(), consumer, std::string());
258 RegisterRequest(request);
259 ScheduleTask(
Greg Billock 2011/08/12 17:34:25 Do these need to schedule on the DB thread or File
groby-ooo-7-16 2011/08/12 19:51:38 They're scheduled on the DB thread - see http://go
260 NewRunnableMethod(this,
261 &WebDataService::GetAllWebIntentsImpl,
262 request));
263 return request->GetHandle();
264 }
253 265
254 //////////////////////////////////////////////////////////////////////////////// 266 ////////////////////////////////////////////////////////////////////////////////
255 // 267 //
256 // Token Service 268 // Token Service
257 // 269 //
258 //////////////////////////////////////////////////////////////////////////////// 270 ////////////////////////////////////////////////////////////////////////////////
259 271
260 void WebDataService::SetTokenForService(const std::string& service, 272 void WebDataService::SetTokenForService(const std::string& service,
261 const std::string& token) { 273 const std::string& token) {
262 GenericRequest2<std::string, std::string>* request = 274 GenericRequest2<std::string, std::string>* request =
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 InitializeDatabaseIfNecessary(); 866 InitializeDatabaseIfNecessary();
855 if (db_ && !request->IsCancelled()) { 867 if (db_ && !request->IsCancelled()) {
856 std::vector<WebIntentData> result; 868 std::vector<WebIntentData> result;
857 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result); 869 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result);
858 request->SetResult( 870 request->SetResult(
859 new WDResult<std::vector<WebIntentData> >(WEB_INTENTS_RESULT, result)); 871 new WDResult<std::vector<WebIntentData> >(WEB_INTENTS_RESULT, result));
860 } 872 }
861 request->RequestComplete(); 873 request->RequestComplete();
862 } 874 }
863 875
876 void WebDataService::GetAllWebIntentsImpl(
877 GenericRequest<std::string>* request) {
878 InitializeDatabaseIfNecessary();
879 if (db_ && !request->IsCancelled()) {
880 std::vector<WebIntentData> result;
881 db_->GetWebIntentsTable()->GetAllWebIntents(&result);
882 request->SetResult(
883 new WDResult<std::vector<WebIntentData> >(WEB_INTENTS_RESULT, result));
884 }
885 request->RequestComplete();
886 }
887
864 //////////////////////////////////////////////////////////////////////////////// 888 ////////////////////////////////////////////////////////////////////////////////
865 // 889 //
866 // Token Service implementation. 890 // Token Service implementation.
867 // 891 //
868 //////////////////////////////////////////////////////////////////////////////// 892 ////////////////////////////////////////////////////////////////////////////////
869 893
870 // argument std::string is unused 894 // argument std::string is unused
871 void WebDataService::RemoveAllTokensImpl( 895 void WebDataService::RemoveAllTokensImpl(
872 GenericRequest<std::string>* request) { 896 GenericRequest<std::string>* request) {
873 InitializeDatabaseIfNecessary(); 897 InitializeDatabaseIfNecessary();
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1409 return result_; 1433 return result_;
1410 } 1434 }
1411 1435
1412 void WebDataService::WebDataRequest::RequestComplete() { 1436 void WebDataService::WebDataRequest::RequestComplete() {
1413 WebDataService* s = service_; 1437 WebDataService* s = service_;
1414 Task* t = NewRunnableMethod(s, 1438 Task* t = NewRunnableMethod(s,
1415 &WebDataService::RequestCompleted, 1439 &WebDataService::RequestCompleted,
1416 handle_); 1440 handle_);
1417 message_loop_->PostTask(FROM_HERE, t); 1441 message_loop_->PostTask(FROM_HERE, t);
1418 } 1442 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698