| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/password_manager/core/browser/login_database.h" | 5 #include "components/password_manager/core/browser/login_database.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 #include "sql/statement.h" | 32 #include "sql/statement.h" |
| 33 #include "sql/transaction.h" | 33 #include "sql/transaction.h" |
| 34 #include "url/origin.h" | 34 #include "url/origin.h" |
| 35 #include "url/url_constants.h" | 35 #include "url/url_constants.h" |
| 36 | 36 |
| 37 using autofill::PasswordForm; | 37 using autofill::PasswordForm; |
| 38 | 38 |
| 39 namespace password_manager { | 39 namespace password_manager { |
| 40 | 40 |
| 41 // The current version number of the login database schema. | 41 // The current version number of the login database schema. |
| 42 const int kCurrentVersionNumber = 16; | 42 const int kCurrentVersionNumber = 17; |
| 43 // The oldest version of the schema such that a legacy Chrome client using that | 43 // The oldest version of the schema such that a legacy Chrome client using that |
| 44 // version can still read/write the current database. | 44 // version can still read/write the current database. |
| 45 const int kCompatibleVersionNumber = 14; | 45 const int kCompatibleVersionNumber = 14; |
| 46 | 46 |
| 47 base::Pickle SerializeVector(const std::vector<base::string16>& vec) { | 47 base::Pickle SerializeVector(const std::vector<base::string16>& vec) { |
| 48 base::Pickle p; | 48 base::Pickle p; |
| 49 for (size_t i = 0; i < vec.size(); ++i) { | 49 for (size_t i = 0; i < vec.size(); ++i) { |
| 50 p.WriteString16(vec[i]); | 50 p.WriteString16(vec[i]); |
| 51 } | 51 } |
| 52 return p; | 52 return p; |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 case 14: | 612 case 14: |
| 613 // No change of schema. Version 15 was introduced to force all databases | 613 // No change of schema. Version 15 was introduced to force all databases |
| 614 // through an otherwise no-op migration process that will, however, now | 614 // through an otherwise no-op migration process that will, however, now |
| 615 // correctly set the 'compatible version number'. Previously, it was | 615 // correctly set the 'compatible version number'. Previously, it was |
| 616 // always being set to (and forever left at) version 1. | 616 // always being set to (and forever left at) version 1. |
| 617 meta_table_.SetCompatibleVersionNumber(kCompatibleVersionNumber); | 617 meta_table_.SetCompatibleVersionNumber(kCompatibleVersionNumber); |
| 618 case 15: | 618 case 15: |
| 619 // Recreate the statistics. | 619 // Recreate the statistics. |
| 620 if (!stats_table_.MigrateToVersion(16)) | 620 if (!stats_table_.MigrateToVersion(16)) |
| 621 return false; | 621 return false; |
| 622 case 16: { |
| 623 // No change in scheme: just disable auto sign-in by default in |
| 624 // preparation to launch the credential management API. |
| 625 if (!db_.Execute("UPDATE logins SET skip_zero_click = 1")) |
| 626 return false; |
| 627 // Fall through. |
| 628 } |
| 622 | 629 |
| 623 // ------------------------------------------------------------------------- | 630 // ------------------------------------------------------------------------- |
| 624 // DO NOT FORGET to update |kCompatibleVersionNumber| if you add a migration | 631 // DO NOT FORGET to update |kCompatibleVersionNumber| if you add a migration |
| 625 // step that is a breaking change. This is needed so that an older version | 632 // step that is a breaking change. This is needed so that an older version |
| 626 // of the browser can fail with a meaningful error when opening a newer | 633 // of the browser can fail with a meaningful error when opening a newer |
| 627 // database, as opposed to failing on the first database operation. | 634 // database, as opposed to failing on the first database operation. |
| 628 // ------------------------------------------------------------------------- | 635 // ------------------------------------------------------------------------- |
| 629 case kCurrentVersionNumber: | 636 case kCurrentVersionNumber: |
| 630 // Already up to date. | 637 // Already up to date. |
| 631 meta_table_.SetVersionNumber(kCurrentVersionNumber); | 638 meta_table_.SetVersionNumber(kCurrentVersionNumber); |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", | 1303 UMA_HISTOGRAM_ENUMERATION("PasswordManager.PslDomainMatchTriggering", |
| 1297 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); | 1304 psl_domain_match_metric, PSL_DOMAIN_MATCH_COUNT); |
| 1298 } | 1305 } |
| 1299 | 1306 |
| 1300 if (!statement->Succeeded()) | 1307 if (!statement->Succeeded()) |
| 1301 return false; | 1308 return false; |
| 1302 return true; | 1309 return true; |
| 1303 } | 1310 } |
| 1304 | 1311 |
| 1305 } // namespace password_manager | 1312 } // namespace password_manager |
| OLD | NEW |