| 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 "components/history/core/browser/thumbnail_database.h" | 5 #include "components/history/core/browser/thumbnail_database.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "components/history/core/browser/url_database.h" | 22 #include "components/history/core/browser/url_database.h" |
| 23 #include "sql/recovery.h" | 23 #include "sql/recovery.h" |
| 24 #include "sql/statement.h" | 24 #include "sql/statement.h" |
| 25 #include "sql/transaction.h" | 25 #include "sql/transaction.h" |
| 26 #include "third_party/sqlite/sqlite3.h" | 26 #include "third_party/sqlite/sqlite3.h" |
| 27 | 27 |
| 28 #if defined(OS_MACOSX) && !defined(OS_IOS) | 28 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 29 #include "base/mac/mac_util.h" | 29 #include "base/mac/mac_util.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace history { |
| 33 |
| 32 // Description of database tables: | 34 // Description of database tables: |
| 33 // | 35 // |
| 34 // icon_mapping | 36 // icon_mapping |
| 35 // id Unique ID. | 37 // id Unique ID. |
| 36 // page_url Page URL which has one or more associated favicons. | 38 // page_url Page URL which has one or more associated favicons. |
| 37 // icon_id The ID of favicon that this mapping maps to. | 39 // icon_id The ID of favicon that this mapping maps to. |
| 38 // | 40 // |
| 39 // favicons This table associates a row to each favicon for a | 41 // favicons This table associates a row to each favicon for a |
| 40 // |page_url| in the |icon_mapping| table. This is the | 42 // |page_url| in the |icon_mapping| table. This is the |
| 41 // default favicon |page_url|/favicon.ico plus any favicons | 43 // default favicon |page_url|/favicon.ico plus any favicons |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 RecoverDatabaseOrRaze(db, db_path); | 563 RecoverDatabaseOrRaze(db, db_path); |
| 562 } | 564 } |
| 563 | 565 |
| 564 // The default handling is to assert on debug and to ignore on release. | 566 // The default handling is to assert on debug and to ignore on release. |
| 565 if (!sql::Connection::ShouldIgnoreSqliteError(extended_error)) | 567 if (!sql::Connection::ShouldIgnoreSqliteError(extended_error)) |
| 566 DLOG(FATAL) << db->GetErrorMessage(); | 568 DLOG(FATAL) << db->GetErrorMessage(); |
| 567 } | 569 } |
| 568 | 570 |
| 569 } // namespace | 571 } // namespace |
| 570 | 572 |
| 571 namespace history { | |
| 572 | |
| 573 ThumbnailDatabase::IconMappingEnumerator::IconMappingEnumerator() { | 573 ThumbnailDatabase::IconMappingEnumerator::IconMappingEnumerator() { |
| 574 } | 574 } |
| 575 | 575 |
| 576 ThumbnailDatabase::IconMappingEnumerator::~IconMappingEnumerator() { | 576 ThumbnailDatabase::IconMappingEnumerator::~IconMappingEnumerator() { |
| 577 } | 577 } |
| 578 | 578 |
| 579 bool ThumbnailDatabase::IconMappingEnumerator::GetNextIconMapping( | 579 bool ThumbnailDatabase::IconMappingEnumerator::GetNextIconMapping( |
| 580 IconMapping* icon_mapping) { | 580 IconMapping* icon_mapping) { |
| 581 if (!statement_.Step()) | 581 if (!statement_.Step()) |
| 582 return false; | 582 return false; |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 meta_table_.SetVersionNumber(7); | 1313 meta_table_.SetVersionNumber(7); |
| 1314 meta_table_.SetCompatibleVersionNumber(std::min(7, kCompatibleVersionNumber)); | 1314 meta_table_.SetCompatibleVersionNumber(std::min(7, kCompatibleVersionNumber)); |
| 1315 return true; | 1315 return true; |
| 1316 } | 1316 } |
| 1317 | 1317 |
| 1318 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { | 1318 bool ThumbnailDatabase::IsFaviconDBStructureIncorrect() { |
| 1319 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); | 1319 return !db_.IsSQLValid("SELECT id, url, icon_type FROM favicons"); |
| 1320 } | 1320 } |
| 1321 | 1321 |
| 1322 } // namespace history | 1322 } // namespace history |
| OLD | NEW |