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

Side by Side Diff: components/autofill/core/browser/webdata/autofill_webdata_backend_impl.cc

Issue 480953002: Implement "Autofill form data" import for Firefox (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review feedback (simplify Read method) Created 6 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/core/browser/webdata/autofill_webdata_backend_impl .h" 5 #include "components/autofill/core/browser/webdata/autofill_webdata_backend_impl .h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_vector.h" 9 #include "base/memory/scoped_vector.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 std::vector<AutofillProfile*> profiles; 238 std::vector<AutofillProfile*> profiles;
239 AutofillTable::FromWebDatabase(db)->GetAutofillProfiles(&profiles); 239 AutofillTable::FromWebDatabase(db)->GetAutofillProfiles(&profiles);
240 return scoped_ptr<WDTypedResult>( 240 return scoped_ptr<WDTypedResult>(
241 new WDDestroyableResult<std::vector<AutofillProfile*> >( 241 new WDDestroyableResult<std::vector<AutofillProfile*> >(
242 AUTOFILL_PROFILES_RESULT, 242 AUTOFILL_PROFILES_RESULT,
243 profiles, 243 profiles,
244 base::Bind(&AutofillWebDataBackendImpl::DestroyAutofillProfileResult, 244 base::Bind(&AutofillWebDataBackendImpl::DestroyAutofillProfileResult,
245 base::Unretained(this)))); 245 base::Unretained(this))));
246 } 246 }
247 247
248 WebDatabase::State AutofillWebDataBackendImpl::UpdateAutofillEntries(
249 const std::vector<autofill::AutofillEntry>& autofill_entries,
250 WebDatabase* db) {
251 DCHECK(db_thread_->BelongsToCurrentThread());
252 if (!AutofillTable::FromWebDatabase(db)
253 ->UpdateAutofillEntries(autofill_entries))
254 return WebDatabase::COMMIT_NOT_NEEDED;
255
256 return WebDatabase::COMMIT_NEEDED;
257 }
258
248 WebDatabase::State AutofillWebDataBackendImpl::AddCreditCard( 259 WebDatabase::State AutofillWebDataBackendImpl::AddCreditCard(
249 const CreditCard& credit_card, WebDatabase* db) { 260 const CreditCard& credit_card, WebDatabase* db) {
250 DCHECK(db_thread_->BelongsToCurrentThread()); 261 DCHECK(db_thread_->BelongsToCurrentThread());
251 if (!AutofillTable::FromWebDatabase(db)->AddCreditCard(credit_card)) { 262 if (!AutofillTable::FromWebDatabase(db)->AddCreditCard(credit_card)) {
252 NOTREACHED(); 263 NOTREACHED();
253 return WebDatabase::COMMIT_NOT_NEEDED; 264 return WebDatabase::COMMIT_NOT_NEEDED;
254 } 265 }
255 266
256 return WebDatabase::COMMIT_NEEDED; 267 return WebDatabase::COMMIT_NEEDED;
257 } 268 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 const WDTypedResult* result) { 391 const WDTypedResult* result) {
381 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT); 392 DCHECK(result->GetType() == AUTOFILL_CREDITCARDS_RESULT);
382 const WDResult<std::vector<CreditCard*> >* r = 393 const WDResult<std::vector<CreditCard*> >* r =
383 static_cast<const WDResult<std::vector<CreditCard*> >*>(result); 394 static_cast<const WDResult<std::vector<CreditCard*> >*>(result);
384 395
385 std::vector<CreditCard*> credit_cards = r->GetValue(); 396 std::vector<CreditCard*> credit_cards = r->GetValue();
386 STLDeleteElements(&credit_cards); 397 STLDeleteElements(&credit_cards);
387 } 398 }
388 399
389 } // namespace autofill 400 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698