| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/keyword_table.h" | 5 #include "chrome/browser/webdata/keyword_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/metrics/stats_counters.h" | 9 #include "base/metrics/stats_counters.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() { | 378 bool KeywordTable::MigrateToVersion38AddLastModifiedColumn() { |
| 379 return db_->Execute( | 379 return db_->Execute( |
| 380 "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0"); | 380 "ALTER TABLE keywords ADD COLUMN last_modified INTEGER DEFAULT 0"); |
| 381 } | 381 } |
| 382 | 382 |
| 383 bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() { | 383 bool KeywordTable::MigrateToVersion39AddSyncGUIDColumn() { |
| 384 return db_->Execute( | 384 return db_->Execute( |
| 385 "ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR"); | 385 "ALTER TABLE keywords ADD COLUMN sync_guid VARCHAR"); |
| 386 } | 386 } |
| 387 | 387 |
| 388 bool KeywordTable::MigrateToVersion40AddDefaultSearchEngineBackup() { | 388 bool KeywordTable::MigrateToVersion40AddDefaultSearchProviderBackup() { |
| 389 int64 value = 0; | 389 int64 value = 0; |
| 390 if (!meta_table_->GetValue(kDefaultSearchProviderKey, &value)) { | 390 if (!meta_table_->GetValue(kDefaultSearchProviderKey, &value)) { |
| 391 // Set default search provider ID and its backup. | 391 // Set default search provider ID and its backup. |
| 392 return SetDefaultSearchProviderID(0); |
| 393 } |
| 394 return SetDefaultSearchProviderBackupID(value); |
| 395 } |
| 396 |
| 397 bool KeywordTable::MigrateToVersion41RewriteDefaultSearchProviderBackup() { |
| 398 // Due to crbug.com/101815 version 40 may contain corrupt or empty |
| 399 // signature. So ignore the signature and simply rewrite it. |
| 400 int64 value = 0; |
| 401 if (!meta_table_->GetValue(kDefaultSearchProviderKey, &value)) { |
| 402 // Set default search provider ID and its backup. |
| 392 return SetDefaultSearchProviderID(0); | 403 return SetDefaultSearchProviderID(0); |
| 393 } | 404 } |
| 394 return SetDefaultSearchProviderBackupID(value); | 405 return SetDefaultSearchProviderBackupID(value); |
| 395 } | 406 } |
| 396 | 407 |
| 397 bool KeywordTable::SetDefaultSearchProviderBackupID(int64 id) { | 408 bool KeywordTable::SetDefaultSearchProviderBackupID(int64 id) { |
| 398 return | 409 return |
| 399 meta_table_->SetValue(kDefaultSearchProviderBackupKey, id) && | 410 meta_table_->SetValue(kDefaultSearchProviderBackupKey, id) && |
| 400 SetDefaultSearchProviderBackupIDSignature(id); | 411 SetDefaultSearchProviderBackupIDSignature(id); |
| 401 } | 412 } |
| 402 | 413 |
| 403 bool KeywordTable::SetDefaultSearchProviderBackupIDSignature(int64 id) { | 414 bool KeywordTable::SetDefaultSearchProviderBackupIDSignature(int64 id) { |
| 404 return meta_table_->SetValue( | 415 return meta_table_->SetValue( |
| 405 kDefaultSearchProviderBackupSignatureKey, | 416 kDefaultSearchProviderBackupSignatureKey, |
| 406 GetSearchProviderIDSignature(id)); | 417 GetSearchProviderIDSignature(id)); |
| 407 } | 418 } |
| OLD | NEW |