| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/history/url_database.h" | 5 #include "chrome/browser/history/url_database.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <limits> | 8 #include <limits> | 
| 9 | 9 | 
| 10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" | 
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" | 
| 12 #include "chrome/common/sqlite_utils.h" | 12 #include "chrome/common/sqlite_utils.h" | 
|  | 13 #include "chrome/common/url_constants.h" | 
| 13 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" | 
| 14 | 15 | 
| 15 using base::Time; | 16 using base::Time; | 
| 16 | 17 | 
| 17 namespace history { | 18 namespace history { | 
| 18 | 19 | 
| 19 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; | 20 const char URLDatabase::kURLRowFields[] = HISTORY_URL_ROW_FIELDS; | 
| 20 const int URLDatabase::kNumURLRowFields = 9; | 21 const int URLDatabase::kNumURLRowFields = 9; | 
| 21 | 22 | 
| 22 bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { | 23 bool URLDatabase::URLEnumerator::GetNextURL(URLRow* r) { | 
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 401   KeywordSearchTermVisit visit; | 402   KeywordSearchTermVisit visit; | 
| 402   while (statement->step() == SQLITE_ROW) { | 403   while (statement->step() == SQLITE_ROW) { | 
| 403     visit.term = statement->column_wstring(0); | 404     visit.term = statement->column_wstring(0); | 
| 404     visit.time = Time::FromInternalValue(statement->column_int64(1)); | 405     visit.time = Time::FromInternalValue(statement->column_int64(1)); | 
| 405     matches->push_back(visit); | 406     matches->push_back(visit); | 
| 406   } | 407   } | 
| 407 } | 408 } | 
| 408 | 409 | 
| 409 bool URLDatabase::MigrateFromVersion11ToVersion12() { | 410 bool URLDatabase::MigrateFromVersion11ToVersion12() { | 
| 410   URLRow about_row; | 411   URLRow about_row; | 
| 411   if (GetRowForURL(GURL("about:blank"), &about_row)) { | 412   if (GetRowForURL(GURL(chrome::kAboutBlankURL), &about_row)) { | 
| 412     about_row.set_favicon_id(0); | 413     about_row.set_favicon_id(0); | 
| 413     return UpdateURLRow(about_row.id(), about_row); | 414     return UpdateURLRow(about_row.id(), about_row); | 
| 414   } | 415   } | 
| 415   return true; | 416   return true; | 
| 416 } | 417 } | 
| 417 | 418 | 
| 418 bool URLDatabase::DropStarredIDFromURLs() { | 419 bool URLDatabase::DropStarredIDFromURLs() { | 
| 419   if (!DoesSqliteColumnExist(GetDB(), "urls", "starred_id", NULL)) | 420   if (!DoesSqliteColumnExist(GetDB(), "urls", "starred_id", NULL)) | 
| 420     return true;  // urls is already updated, no need to continue. | 421     return true;  // urls is already updated, no need to continue. | 
| 421 | 422 | 
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 474 } | 475 } | 
| 475 | 476 | 
| 476 void URLDatabase::CreateSupplimentaryURLIndices() { | 477 void URLDatabase::CreateSupplimentaryURLIndices() { | 
| 477   // Add a favicon index.  This is useful when we delete urls. | 478   // Add a favicon index.  This is useful when we delete urls. | 
| 478   sqlite3_exec(GetDB(), | 479   sqlite3_exec(GetDB(), | 
| 479                "CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)", | 480                "CREATE INDEX urls_favicon_id_INDEX ON urls (favicon_id)", | 
| 480                NULL, NULL, NULL); | 481                NULL, NULL, NULL); | 
| 481 } | 482 } | 
| 482 | 483 | 
| 483 }  // namespace history | 484 }  // namespace history | 
| OLD | NEW | 
|---|