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 "components/autofill/browser/webdata/autofill_webdata_backend.h" | 5 #include "components/autofill/browser/webdata/autofill_webdata_backend.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
9 #include "components/autofill/browser/autofill_country.h" | 9 #include "components/autofill/browser/autofill_country.h" |
10 #include "components/autofill/browser/autofill_profile.h" | 10 #include "components/autofill/browser/autofill_profile.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 WebDatabase* db) { | 65 WebDatabase* db) { |
66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 66 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
67 std::vector<base::string16> values; | 67 std::vector<base::string16> values; |
68 AutofillTable::FromWebDatabase(db)->GetFormValuesForElementName( | 68 AutofillTable::FromWebDatabase(db)->GetFormValuesForElementName( |
69 name, prefix, &values, limit); | 69 name, prefix, &values, limit); |
70 return scoped_ptr<WDTypedResult>( | 70 return scoped_ptr<WDTypedResult>( |
71 new WDResult<std::vector<base::string16> >(AUTOFILL_VALUE_RESULT, | 71 new WDResult<std::vector<base::string16> >(AUTOFILL_VALUE_RESULT, |
72 values)); | 72 values)); |
73 } | 73 } |
74 | 74 |
| 75 scoped_ptr<WDTypedResult> AutofillWebDataBackend::HasFormElements( |
| 76 WebDatabase* db) { |
| 77 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
| 78 bool value = AutofillTable::FromWebDatabase(db)->HasFormElements(); |
| 79 return scoped_ptr<WDTypedResult>( |
| 80 new WDResult<bool>(AUTOFILL_VALUE_RESULT, value)); |
| 81 } |
| 82 |
75 WebDatabase::State AutofillWebDataBackend::RemoveFormElementsAddedBetween( | 83 WebDatabase::State AutofillWebDataBackend::RemoveFormElementsAddedBetween( |
76 const base::Time& delete_begin, const base::Time& delete_end, | 84 const base::Time& delete_begin, const base::Time& delete_end, |
77 WebDatabase* db) { | 85 WebDatabase* db) { |
78 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); | 86 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); |
79 AutofillChangeList changes; | 87 AutofillChangeList changes; |
80 | 88 |
81 if (AutofillTable::FromWebDatabase(db)->RemoveFormElementsAddedBetween( | 89 if (AutofillTable::FromWebDatabase(db)->RemoveFormElementsAddedBetween( |
82 delete_begin, delete_end, &changes)) { | 90 delete_begin, delete_end, &changes)) { |
83 if (!changes.empty()) { | 91 if (!changes.empty()) { |
84 // Post the notifications including the list of affected keys. | 92 // Post the notifications including the list of affected keys. |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 const WDTypedResult* result) { | 316 const WDTypedResult* result) { |
309 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); | 317 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); |
310 const WDResult<std::vector<CreditCard*> >* r = | 318 const WDResult<std::vector<CreditCard*> >* r = |
311 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); | 319 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); |
312 | 320 |
313 std::vector<CreditCard*> credit_cards = r->GetValue(); | 321 std::vector<CreditCard*> credit_cards = r->GetValue(); |
314 STLDeleteElements(&credit_cards); | 322 STLDeleteElements(&credit_cards); |
315 } | 323 } |
316 | 324 |
317 } // namespace autofill | 325 } // namespace autofill |
OLD | NEW |