| 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/logins_table.h" | 5 #include "chrome/browser/webdata/logins_table.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/webdata/common/web_database.h" | 10 #include "components/webdata/common/web_database.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } // namespace | 22 } // namespace |
| 23 | 23 |
| 24 LoginsTable* LoginsTable::FromWebDatabase(WebDatabase* db) { | 24 LoginsTable* LoginsTable::FromWebDatabase(WebDatabase* db) { |
| 25 return static_cast<LoginsTable*>(db->GetTable(GetKey())); | 25 return static_cast<LoginsTable*>(db->GetTable(GetKey())); |
| 26 } | 26 } |
| 27 | 27 |
| 28 WebDatabaseTable::TypeKey LoginsTable::GetTypeKey() const { | 28 WebDatabaseTable::TypeKey LoginsTable::GetTypeKey() const { |
| 29 return GetKey(); | 29 return GetKey(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 bool LoginsTable::Init(sql::Connection* db, sql::MetaTable* meta_table) { | 32 bool LoginsTable::CreateTablesIfNecessary() { |
| 33 WebDatabaseTable::Init(db, meta_table); | |
| 34 | |
| 35 if (db_->DoesTableExist("logins")) { | 33 if (db_->DoesTableExist("logins")) { |
| 36 // We don't check for success. It doesn't matter that much. | 34 // We don't check for success. It doesn't matter that much. |
| 37 // If we fail we'll just try again later anyway. | 35 // If we fail we'll just try again later anyway. |
| 38 ignore_result(db_->Execute("DROP TABLE logins")); | 36 ignore_result(db_->Execute("DROP TABLE logins")); |
| 39 } | 37 } |
| 40 | 38 |
| 41 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
| 42 if (!db_->DoesTableExist("ie7_logins")) { | 40 if (!db_->DoesTableExist("ie7_logins")) { |
| 43 if (!db_->Execute("CREATE TABLE ie7_logins (" | 41 if (!db_->Execute("CREATE TABLE ie7_logins (" |
| 44 "url_hash VARCHAR NOT NULL, " | 42 "url_hash VARCHAR NOT NULL, " |
| (...skipping 16 matching lines...) Expand all Loading... |
| 61 } | 59 } |
| 62 | 60 |
| 63 bool LoginsTable::IsSyncable() { | 61 bool LoginsTable::IsSyncable() { |
| 64 return true; | 62 return true; |
| 65 } | 63 } |
| 66 | 64 |
| 67 bool LoginsTable::MigrateToVersion(int version, | 65 bool LoginsTable::MigrateToVersion(int version, |
| 68 bool* update_compatible_version) { | 66 bool* update_compatible_version) { |
| 69 return true; | 67 return true; |
| 70 } | 68 } |
| OLD | NEW |