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

Side by Side Diff: components/autofill/browser/webdata/autofill_table.cc

Issue 14503010: Implement WebViewDatabase's hasFormData API for chromium based webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address new code review Created 7 years, 7 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 (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_table.h" 5 #include "components/autofill/browser/webdata/autofill_table.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 s.BindString16(2, next_prefix); 456 s.BindString16(2, next_prefix);
457 s.BindInt(3, limit); 457 s.BindInt(3, limit);
458 } 458 }
459 459
460 values->clear(); 460 values->clear();
461 while (s.Step()) 461 while (s.Step())
462 values->push_back(s.ColumnString16(0)); 462 values->push_back(s.ColumnString16(0));
463 return s.Succeeded(); 463 return s.Succeeded();
464 } 464 }
465 465
466 bool AutofillTable::HasFormElements() {
467 sql::Statement s(db_->GetUniqueStatement(
468 "SELECT COUNT(*) FROM autofill"));
469 if (!s.Step()) {
470 NOTREACHED();
471 return false;
472 }
473 return s.ColumnInt(0) > 0;
474 }
475
466 bool AutofillTable::RemoveFormElementsAddedBetween( 476 bool AutofillTable::RemoveFormElementsAddedBetween(
467 const Time& delete_begin, 477 const Time& delete_begin,
468 const Time& delete_end, 478 const Time& delete_end,
469 std::vector<AutofillChange>* changes) { 479 std::vector<AutofillChange>* changes) {
470 DCHECK(changes); 480 DCHECK(changes);
471 // Query for the pair_id, name, and value of all form elements that 481 // Query for the pair_id, name, and value of all form elements that
472 // were used between the given times. 482 // were used between the given times.
473 sql::Statement s(db_->GetUniqueStatement( 483 sql::Statement s(db_->GetUniqueStatement(
474 "SELECT DISTINCT a.pair_id, a.name, a.value " 484 "SELECT DISTINCT a.pair_id, a.name, a.value "
475 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id " 485 "FROM autofill_dates ad JOIN autofill a ON ad.pair_id = a.pair_id "
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 // Add origin to credit_cards. 2079 // Add origin to credit_cards.
2070 if (!db_->Execute("ALTER TABLE credit_cards " 2080 if (!db_->Execute("ALTER TABLE credit_cards "
2071 "ADD COLUMN origin VARCHAR DEFAULT ''")) { 2081 "ADD COLUMN origin VARCHAR DEFAULT ''")) {
2072 return false; 2082 return false;
2073 } 2083 }
2074 2084
2075 return transaction.Commit(); 2085 return transaction.Commit();
2076 } 2086 }
2077 2087
2078 } // namespace autofill 2088 } // namespace autofill
OLDNEW
« no previous file with comments | « components/autofill/browser/webdata/autofill_table.h ('k') | components/autofill/browser/webdata/autofill_table_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698