OLD | NEW |
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 815 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
826 // | 826 // |
827 // Web Intents implementation. | 827 // Web Intents implementation. |
828 // | 828 // |
829 //////////////////////////////////////////////////////////////////////////////// | 829 //////////////////////////////////////////////////////////////////////////////// |
830 | 830 |
831 void WebDataService::RemoveWebIntentImpl( | 831 void WebDataService::RemoveWebIntentImpl( |
832 GenericRequest<WebIntentData>* request) { | 832 GenericRequest<WebIntentData>* request) { |
833 InitializeDatabaseIfNecessary(); | 833 InitializeDatabaseIfNecessary(); |
834 if (db_ && !request->IsCancelled()) { | 834 if (db_ && !request->IsCancelled()) { |
835 const WebIntentData& intent = request->arg(); | 835 const WebIntentData& intent = request->arg(); |
836 db_->GetWebIntentsTable()->RemoveWebIntent(intent.action, | 836 db_->GetWebIntentsTable()->RemoveWebIntent(intent); |
837 intent.type, | |
838 intent.service_url); | |
839 ScheduleCommit(); | 837 ScheduleCommit(); |
840 } | 838 } |
841 request->RequestComplete(); | 839 request->RequestComplete(); |
842 } | 840 } |
843 | 841 |
844 void WebDataService::AddWebIntentImpl(GenericRequest<WebIntentData>* request) { | 842 void WebDataService::AddWebIntentImpl(GenericRequest<WebIntentData>* request) { |
845 InitializeDatabaseIfNecessary(); | 843 InitializeDatabaseIfNecessary(); |
846 if (db_ && !request->IsCancelled()) { | 844 if (db_ && !request->IsCancelled()) { |
847 const WebIntentData& intent = request->arg(); | 845 const WebIntentData& intent = request->arg(); |
848 db_->GetWebIntentsTable()->SetWebIntent(intent.action, | 846 db_->GetWebIntentsTable()->SetWebIntent(intent); |
849 intent.type, | |
850 intent.service_url); | |
851 ScheduleCommit(); | 847 ScheduleCommit(); |
852 } | 848 } |
853 request->RequestComplete(); | 849 request->RequestComplete(); |
854 } | 850 } |
855 | 851 |
856 | 852 |
857 void WebDataService::GetWebIntentsImpl(GenericRequest<string16>* request) { | 853 void WebDataService::GetWebIntentsImpl(GenericRequest<string16>* request) { |
858 InitializeDatabaseIfNecessary(); | 854 InitializeDatabaseIfNecessary(); |
859 if (db_ && !request->IsCancelled()) { | 855 if (db_ && !request->IsCancelled()) { |
860 std::vector<WebIntentData> result; | 856 std::vector<WebIntentData> result; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1413 return result_; | 1409 return result_; |
1414 } | 1410 } |
1415 | 1411 |
1416 void WebDataService::WebDataRequest::RequestComplete() { | 1412 void WebDataService::WebDataRequest::RequestComplete() { |
1417 WebDataService* s = service_; | 1413 WebDataService* s = service_; |
1418 Task* t = NewRunnableMethod(s, | 1414 Task* t = NewRunnableMethod(s, |
1419 &WebDataService::RequestCompleted, | 1415 &WebDataService::RequestCompleted, |
1420 handle_); | 1416 handle_); |
1421 message_loop_->PostTask(FROM_HERE, t); | 1417 message_loop_->PostTask(FROM_HERE, t); |
1422 } | 1418 } |
OLD | NEW |