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

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

Issue 8144013: Add a check to the registry before the intent infobar is shown. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix up merge Created 9 years, 1 month 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/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread.h" 10 #include "base/threading/thread.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 257 }
258 258
259 void WebDataService::RemoveWebIntent(const WebIntentServiceData& service) { 259 void WebDataService::RemoveWebIntent(const WebIntentServiceData& service) {
260 GenericRequest<WebIntentServiceData>* request = 260 GenericRequest<WebIntentServiceData>* request =
261 new GenericRequest<WebIntentServiceData>( 261 new GenericRequest<WebIntentServiceData>(
262 this, GetNextRequestHandle(), NULL, service); 262 this, GetNextRequestHandle(), NULL, service);
263 RegisterRequest(request); 263 RegisterRequest(request);
264 ScheduleTask(Bind(&WebDataService::RemoveWebIntentImpl, this, request)); 264 ScheduleTask(Bind(&WebDataService::RemoveWebIntentImpl, this, request));
265 } 265 }
266 266
267 WebDataService::Handle WebDataService::GetWebIntents(const string16& action, 267 WebDataService::Handle WebDataService::GetWebIntents(
268 WebDataServiceConsumer* consumer) { 268 const string16& action,
269 WebDataServiceConsumer* consumer) {
269 DCHECK(consumer); 270 DCHECK(consumer);
270 GenericRequest<string16>* request = new GenericRequest<string16>( 271 GenericRequest<string16>* request = new GenericRequest<string16>(
271 this, GetNextRequestHandle(), consumer, action); 272 this, GetNextRequestHandle(), consumer, action);
272 RegisterRequest(request); 273 RegisterRequest(request);
273 ScheduleTask(Bind(&WebDataService::GetWebIntentsImpl, this, request)); 274 ScheduleTask(Bind(&WebDataService::GetWebIntentsImpl, this, request));
274 return request->GetHandle(); 275 return request->GetHandle();
275 } 276 }
276 277
278 WebDataService::Handle WebDataService::GetWebIntentsForURL(
279 const string16& service_url,
280 WebDataServiceConsumer* consumer) {
281 DCHECK(consumer);
282 GenericRequest<string16>* request = new GenericRequest<string16>(
283 this, GetNextRequestHandle(), consumer, service_url);
284 RegisterRequest(request);
285 ScheduleTask(Bind(&WebDataService::GetWebIntentsForURLImpl, this, request));
286 return request->GetHandle();
287 }
288
289
277 WebDataService::Handle WebDataService::GetAllWebIntents( 290 WebDataService::Handle WebDataService::GetAllWebIntents(
278 WebDataServiceConsumer* consumer) { 291 WebDataServiceConsumer* consumer) {
279 DCHECK(consumer); 292 DCHECK(consumer);
280 GenericRequest<std::string>* request = new GenericRequest<std::string>( 293 GenericRequest<std::string>* request = new GenericRequest<std::string>(
281 this, GetNextRequestHandle(), consumer, std::string()); 294 this, GetNextRequestHandle(), consumer, std::string());
282 RegisterRequest(request); 295 RegisterRequest(request);
283 ScheduleTask(Bind(&WebDataService::GetAllWebIntentsImpl, this, request)); 296 ScheduleTask(Bind(&WebDataService::GetAllWebIntentsImpl, this, request));
284 return request->GetHandle(); 297 return request->GetHandle();
285 } 298 }
286 299
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
877 if (db_ && !request->IsCancelled(NULL)) { 890 if (db_ && !request->IsCancelled(NULL)) {
878 std::vector<WebIntentServiceData> result; 891 std::vector<WebIntentServiceData> result;
879 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result); 892 db_->GetWebIntentsTable()->GetWebIntents(request->arg(), &result);
880 request->SetResult( 893 request->SetResult(
881 new WDResult<std::vector<WebIntentServiceData> >( 894 new WDResult<std::vector<WebIntentServiceData> >(
882 WEB_INTENTS_RESULT, result)); 895 WEB_INTENTS_RESULT, result));
883 } 896 }
884 request->RequestComplete(); 897 request->RequestComplete();
885 } 898 }
886 899
900 void WebDataService::GetWebIntentsForURLImpl(
901 GenericRequest<string16>* request) {
902 InitializeDatabaseIfNecessary();
903 if (db_ && !request->IsCancelled(NULL)) {
904 std::vector<WebIntentServiceData> result;
905 db_->GetWebIntentsTable()->GetWebIntentsForURL(
906 request->arg(), &result);
907 request->SetResult(
908 new WDResult<std::vector<WebIntentServiceData> >(
909 WEB_INTENTS_RESULT, result));
910 }
911 request->RequestComplete();
912 }
913
887 void WebDataService::GetAllWebIntentsImpl( 914 void WebDataService::GetAllWebIntentsImpl(
888 GenericRequest<std::string>* request) { 915 GenericRequest<std::string>* request) {
889 InitializeDatabaseIfNecessary(); 916 InitializeDatabaseIfNecessary();
890 if (db_ && !request->IsCancelled(NULL)) { 917 if (db_ && !request->IsCancelled(NULL)) {
891 std::vector<WebIntentServiceData> result; 918 std::vector<WebIntentServiceData> result;
892 db_->GetWebIntentsTable()->GetAllWebIntents(&result); 919 db_->GetWebIntentsTable()->GetAllWebIntents(&result);
893 request->SetResult( 920 request->SetResult(
894 new WDResult<std::vector<WebIntentServiceData> >( 921 new WDResult<std::vector<WebIntentServiceData> >(
895 WEB_INTENTS_RESULT, result)); 922 WEB_INTENTS_RESULT, result));
896 } 923 }
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 } 1487 }
1461 1488
1462 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const { 1489 const WDTypedResult* WebDataService::WebDataRequest::GetResult() const {
1463 return result_; 1490 return result_;
1464 } 1491 }
1465 1492
1466 void WebDataService::WebDataRequest::RequestComplete() { 1493 void WebDataService::WebDataRequest::RequestComplete() {
1467 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted, 1494 message_loop_->PostTask(FROM_HERE, Bind(&WebDataService::RequestCompleted,
1468 service_.get(), handle_)); 1495 service_.get(), handle_));
1469 } 1496 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698