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

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

Issue 7930002: Rename WebIntentData for backend storage to WebIntentServiceData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix class/struct decl Created 9 years, 3 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 request)); 214 request));
215 return request->GetHandle(); 215 return request->GetHandle();
216 } 216 }
217 217
218 ////////////////////////////////////////////////////////////////////////////// 218 //////////////////////////////////////////////////////////////////////////////
219 // 219 //
220 // Web Intents. 220 // Web Intents.
221 // 221 //
222 ////////////////////////////////////////////////////////////////////////////// 222 //////////////////////////////////////////////////////////////////////////////
223 223
224 void WebDataService::AddWebIntent(const WebIntentData& intent) { 224 void WebDataService::AddWebIntent(const WebIntentServiceData& service) {
225 GenericRequest<WebIntentData>* request = new GenericRequest<WebIntentData>( 225 GenericRequest<WebIntentServiceData>* request =
226 this, GetNextRequestHandle(), NULL, intent); 226 new GenericRequest<WebIntentServiceData>(
227 this, GetNextRequestHandle(), NULL, service);
227 RegisterRequest(request); 228 RegisterRequest(request);
228 ScheduleTask(NewRunnableMethod(this, &WebDataService::AddWebIntentImpl, 229 ScheduleTask(NewRunnableMethod(this, &WebDataService::AddWebIntentImpl,
229 request)); 230 request));
230 } 231 }
231 232
232 void WebDataService::RemoveWebIntent(const WebIntentData& intent) { 233 void WebDataService::RemoveWebIntent(const WebIntentServiceData& service) {
233 GenericRequest<WebIntentData>* request = new GenericRequest<WebIntentData>( 234 GenericRequest<WebIntentServiceData>* request =
234 this, GetNextRequestHandle(), NULL, intent); 235 new GenericRequest<WebIntentServiceData>(
236 this, GetNextRequestHandle(), NULL, service);
235 RegisterRequest(request); 237 RegisterRequest(request);
236 ScheduleTask(NewRunnableMethod(this, &WebDataService::RemoveWebIntentImpl, 238 ScheduleTask(NewRunnableMethod(this, &WebDataService::RemoveWebIntentImpl,
237 request)); 239 request));
238 } 240 }
239 241
240 WebDataService::Handle WebDataService::GetWebIntents(const string16& action, 242 WebDataService::Handle WebDataService::GetWebIntents(const string16& action,
241 WebDataServiceConsumer* consumer) { 243 WebDataServiceConsumer* consumer) {
242 DCHECK(consumer); 244 DCHECK(consumer);
243 GenericRequest<string16>* request = new GenericRequest<string16>( 245 GenericRequest<string16>* request = new GenericRequest<string16>(
244 this, GetNextRequestHandle(), consumer, action); 246 this, GetNextRequestHandle(), consumer, action);
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 request->RequestComplete(); 836 request->RequestComplete();
835 } 837 }
836 838
837 //////////////////////////////////////////////////////////////////////////////// 839 ////////////////////////////////////////////////////////////////////////////////
838 // 840 //
839 // Web Intents implementation. 841 // Web Intents implementation.
840 // 842 //
841 //////////////////////////////////////////////////////////////////////////////// 843 ////////////////////////////////////////////////////////////////////////////////
842 844
843 void WebDataService::RemoveWebIntentImpl( 845 void WebDataService::RemoveWebIntentImpl(
844 GenericRequest<WebIntentData>* request) { 846 GenericRequest<WebIntentServiceData>* request) {
845 InitializeDatabaseIfNecessary(); 847 InitializeDatabaseIfNecessary();
846 if (db_ && !request->IsCancelled(NULL)) { 848 if (db_ && !request->IsCancelled(NULL)) {
847 const WebIntentData& intent = request->arg(); 849 const WebIntentServiceData& service = request->arg();
848 db_->GetWebIntentsTable()->RemoveWebIntent(intent); 850 db_->GetWebIntentsTable()->RemoveWebIntent(service);
849 ScheduleCommit(); 851 ScheduleCommit();
850 } 852 }
851 request->RequestComplete(); 853 request->RequestComplete();
852 } 854 }
853 855
854 void WebDataService::AddWebIntentImpl(GenericRequest<WebIntentData>* request) { 856 void WebDataService::AddWebIntentImpl(
857 GenericRequest<WebIntentServiceData>* request) {
855 InitializeDatabaseIfNecessary(); 858 InitializeDatabaseIfNecessary();
856 if (db_ && !request->IsCancelled(NULL)) { 859 if (db_ && !request->IsCancelled(NULL)) {
857 const WebIntentData& intent = request->arg(); 860 const WebIntentServiceData& service = request->arg();
858 db_->GetWebIntentsTable()->SetWebIntent(intent); 861 db_->GetWebIntentsTable()->SetWebIntent(service);
859 ScheduleCommit(); 862 ScheduleCommit();
860 } 863 }
861 request->RequestComplete(); 864 request->RequestComplete();
862 } 865 }
863 866
864 867
865 void WebDataService::GetWebIntentsImpl(GenericRequest<string16>* request) { 868 void WebDataService::GetWebIntentsImpl(GenericRequest<string16>* request) {
866 InitializeDatabaseIfNecessary(); 869 InitializeDatabaseIfNecessary();
867 if (db_ && !request->IsCancelled(NULL)) { 870 if (db_ && !request->IsCancelled(NULL)) {
868 std::vector<WebIntentData> result; 871 std::vector<WebIntentServiceData> result;
869 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result); 872 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result);
870 request->SetResult( 873 request->SetResult(
871 new WDResult<std::vector<WebIntentData> >(WEB_INTENTS_RESULT, result)); 874 new WDResult<std::vector<WebIntentServiceData> >(
875 WEB_INTENTS_RESULT, result));
872 } 876 }
873 request->RequestComplete(); 877 request->RequestComplete();
874 } 878 }
875 879
876 void WebDataService::GetAllWebIntentsImpl( 880 void WebDataService::GetAllWebIntentsImpl(
877 GenericRequest<std::string>* request) { 881 GenericRequest<std::string>* request) {
878 InitializeDatabaseIfNecessary(); 882 InitializeDatabaseIfNecessary();
879 if (db_ && !request->IsCancelled(NULL)) { 883 if (db_ && !request->IsCancelled(NULL)) {
880 std::vector<WebIntentData> result; 884 std::vector<WebIntentServiceData> result;
881 db_->GetWebIntentsTable()->GetAllWebIntents(&result); 885 db_->GetWebIntentsTable()->GetAllWebIntents(&result);
882 request->SetResult( 886 request->SetResult(
883 new WDResult<std::vector<WebIntentData> >(WEB_INTENTS_RESULT, result)); 887 new WDResult<std::vector<WebIntentServiceData> >(
888 WEB_INTENTS_RESULT, result));
884 } 889 }
885 request->RequestComplete(); 890 request->RequestComplete();
886 } 891 }
887 892
888 //////////////////////////////////////////////////////////////////////////////// 893 ////////////////////////////////////////////////////////////////////////////////
889 // 894 //
890 // Token Service implementation. 895 // Token Service implementation.
891 // 896 //
892 //////////////////////////////////////////////////////////////////////////////// 897 ////////////////////////////////////////////////////////////////////////////////
893 898
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 return result_; 1439 return result_;
1435 } 1440 }
1436 1441
1437 void WebDataService::WebDataRequest::RequestComplete() { 1442 void WebDataService::WebDataRequest::RequestComplete() {
1438 WebDataService* s = service_; 1443 WebDataService* s = service_;
1439 Task* t = NewRunnableMethod(s, 1444 Task* t = NewRunnableMethod(s,
1440 &WebDataService::RequestCompleted, 1445 &WebDataService::RequestCompleted,
1441 handle_); 1446 handle_);
1442 message_loop_->PostTask(FROM_HERE, t); 1447 message_loop_->PostTask(FROM_HERE, t);
1443 } 1448 }
OLDNEW
« 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