Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/command_line.h" | |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| 10 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 11 #include "chrome/browser/autofill/autofill_country.h" | 12 #include "chrome/browser/autofill/autofill_country.h" |
| 12 #include "chrome/browser/autofill/autofill_profile.h" | 13 #include "chrome/browser/autofill/autofill_profile.h" |
| 13 #include "chrome/browser/autofill/credit_card.h" | 14 #include "chrome/browser/autofill/credit_card.h" |
| 14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/profiles/profile_manager.h" | |
| 15 #include "chrome/browser/search_engines/template_url.h" | 17 #include "chrome/browser/search_engines/template_url.h" |
| 16 #include "chrome/browser/ui/profile_error_dialog.h" | 18 #include "chrome/browser/ui/profile_error_dialog.h" |
| 17 #include "chrome/browser/webdata/autocomplete_syncable_service.h" | 19 #include "chrome/browser/webdata/autocomplete_syncable_service.h" |
| 18 #include "chrome/browser/webdata/autofill_change.h" | 20 #include "chrome/browser/webdata/autofill_change.h" |
| 19 #include "chrome/browser/webdata/autofill_entry.h" | 21 #include "chrome/browser/webdata/autofill_entry.h" |
| 20 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" | 22 #include "chrome/browser/webdata/autofill_profile_syncable_service.h" |
| 21 #include "chrome/browser/webdata/autofill_table.h" | 23 #include "chrome/browser/webdata/autofill_table.h" |
| 22 #include "chrome/browser/webdata/keyword_table.h" | 24 #include "chrome/browser/webdata/keyword_table.h" |
| 23 #include "chrome/browser/webdata/logins_table.h" | 25 #include "chrome/browser/webdata/logins_table.h" |
| 24 #include "chrome/browser/webdata/token_service_table.h" | 26 #include "chrome/browser/webdata/token_service_table.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 request_manager_(new WebDataRequestManager()), | 83 request_manager_(new WebDataRequestManager()), |
| 82 app_locale_(AutofillCountry::ApplicationLocale()), | 84 app_locale_(AutofillCountry::ApplicationLocale()), |
| 83 autocomplete_syncable_service_(NULL), | 85 autocomplete_syncable_service_(NULL), |
| 84 autofill_profile_syncable_service_(NULL), | 86 autofill_profile_syncable_service_(NULL), |
| 85 failed_init_(false), | 87 failed_init_(false), |
| 86 should_commit_(false), | 88 should_commit_(false), |
| 87 main_loop_(MessageLoop::current()) { | 89 main_loop_(MessageLoop::current()) { |
| 88 // WebDataService requires DB thread if instantiated. | 90 // WebDataService requires DB thread if instantiated. |
| 89 // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL) | 91 // Set WebDataServiceFactory::GetInstance()->SetTestingFactory(&profile, NULL) |
| 90 // if you do not want to instantiate WebDataService in your test. | 92 // if you do not want to instantiate WebDataService in your test. |
| 93 DCHECK(!ProfileManager::IsImportProcess(*CommandLine::ForCurrentProcess())); | |
|
Peter Kasting
2013/02/22 19:57:56
Nit: The comment above is for the statement below.
| |
| 91 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB)); | 94 DCHECK(BrowserThread::IsWellKnownThread(BrowserThread::DB)); |
| 92 } | 95 } |
| 93 | 96 |
| 94 // static | 97 // static |
| 95 void WebDataService::NotifyOfMultipleAutofillChanges( | 98 void WebDataService::NotifyOfMultipleAutofillChanges( |
| 96 WebDataService* web_data_service) { | 99 WebDataService* web_data_service) { |
| 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 100 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 98 | 101 |
| 99 if (!web_data_service) | 102 if (!web_data_service) |
| 100 return; | 103 return; |
| (...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 | 949 |
| 947 void WebDataService::DestroyAutofillCreditCardResult( | 950 void WebDataService::DestroyAutofillCreditCardResult( |
| 948 const WDTypedResult* result) { | 951 const WDTypedResult* result) { |
| 949 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); | 952 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); |
| 950 const WDResult<std::vector<CreditCard*> >* r = | 953 const WDResult<std::vector<CreditCard*> >* r = |
| 951 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); | 954 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); |
| 952 | 955 |
| 953 std::vector<CreditCard*> credit_cards = r->GetValue(); | 956 std::vector<CreditCard*> credit_cards = r->GetValue(); |
| 954 STLDeleteElements(&credit_cards); | 957 STLDeleteElements(&credit_cards); |
| 955 } | 958 } |
| OLD | NEW |