| 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 "chrome/browser/webdata/web_database.h" |
| 10 #include "sql/statement.h" | 11 #include "sql/statement.h" |
| 11 | 12 |
| 12 bool LoginsTable::Init() { | 13 namespace { |
| 14 |
| 15 WebDatabaseTable::TypeKey GetKey() { |
| 16 return reinterpret_cast<void*>(&LoginsTable::FromWebDatabase); |
| 17 } |
| 18 |
| 19 } // namespace |
| 20 |
| 21 LoginsTable* LoginsTable::FromWebDatabase(WebDatabase* db) { |
| 22 return static_cast<LoginsTable*>(db->GetTable(GetKey())); |
| 23 } |
| 24 |
| 25 WebDatabaseTable::TypeKey LoginsTable::GetTypeKey() const { |
| 26 return GetKey(); |
| 27 } |
| 28 |
| 29 bool LoginsTable::Init(sql::Connection* db, sql::MetaTable* meta_table) { |
| 30 WebDatabaseTable::Init(db, meta_table); |
| 31 |
| 13 if (db_->DoesTableExist("logins")) { | 32 if (db_->DoesTableExist("logins")) { |
| 14 // We don't check for success. It doesn't matter that much. | 33 // We don't check for success. It doesn't matter that much. |
| 15 // If we fail we'll just try again later anyway. | 34 // If we fail we'll just try again later anyway. |
| 16 ignore_result(db_->Execute("DROP TABLE logins")); | 35 ignore_result(db_->Execute("DROP TABLE logins")); |
| 17 } | 36 } |
| 18 | 37 |
| 19 #if defined(OS_WIN) | 38 #if defined(OS_WIN) |
| 20 if (!db_->DoesTableExist("ie7_logins")) { | 39 if (!db_->DoesTableExist("ie7_logins")) { |
| 21 if (!db_->Execute("CREATE TABLE ie7_logins (" | 40 if (!db_->Execute("CREATE TABLE ie7_logins (" |
| 22 "url_hash VARCHAR NOT NULL, " | 41 "url_hash VARCHAR NOT NULL, " |
| (...skipping 17 matching lines...) Expand all Loading... |
| 40 | 59 |
| 41 bool LoginsTable::IsSyncable() { | 60 bool LoginsTable::IsSyncable() { |
| 42 return true; | 61 return true; |
| 43 } | 62 } |
| 44 | 63 |
| 45 bool LoginsTable::MigrateToVersion(int version, | 64 bool LoginsTable::MigrateToVersion(int version, |
| 46 const std::string& app_locale, | 65 const std::string& app_locale, |
| 47 bool* update_compatible_version) { | 66 bool* update_compatible_version) { |
| 48 return true; | 67 return true; |
| 49 } | 68 } |
| OLD | NEW |