| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 return MigrateToVersion40AddDefaultSearchProviderBackup(); | 368 return MigrateToVersion40AddDefaultSearchProviderBackup(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 bool KeywordTable::MigrateToVersion42AddKeywordsBackupTable() { | 371 bool KeywordTable::MigrateToVersion42AddKeywordsBackupTable() { |
| 372 return UpdateBackupSignature(); | 372 return UpdateBackupSignature(); |
| 373 } | 373 } |
| 374 | 374 |
| 375 std::string KeywordTable::GetSignatureData() { | 375 std::string KeywordTable::GetSignatureData() { |
| 376 int64 backup_value = 0; | 376 int64 backup_value = 0; |
| 377 if (!meta_table_->GetValue(kDefaultSearchIDBackupKey, &backup_value)) { | 377 if (!meta_table_->GetValue(kDefaultSearchIDBackupKey, &backup_value)) { |
| 378 NOTREACHED() << "Couldn't get id backup."; | 378 LOG(ERROR) << "No backup id for signing."; |
| 379 return std::string(); | 379 return std::string(); |
| 380 } | 380 } |
| 381 std::string backup_data = base::Int64ToString(backup_value); | 381 std::string backup_data = base::Int64ToString(backup_value); |
| 382 | 382 |
| 383 std::string backup_url; | 383 std::string backup_url; |
| 384 if (!meta_table_->GetValue(kDefaultSearchBackupKey, &backup_url)) { | 384 if (!meta_table_->GetValue(kDefaultSearchBackupKey, &backup_url)) { |
| 385 NOTREACHED() << "Couldn't get backup url"; | 385 LOG(ERROR) << "No backup for signing."; |
| 386 return std::string(); | 386 return std::string(); |
| 387 } | 387 } |
| 388 backup_data += backup_url; | 388 backup_data += backup_url; |
| 389 | 389 |
| 390 sql::Statement s(db_->GetCachedStatement(SQL_FROM_HERE, | 390 sql::Statement s(db_->GetCachedStatement(SQL_FROM_HERE, |
| 391 "SELECT id || short_name || keyword || favicon_url || url || " | 391 "SELECT id || short_name || keyword || favicon_url || url || " |
| 392 "safe_for_autoreplace || originating_url || date_created || " | 392 "safe_for_autoreplace || originating_url || date_created || " |
| 393 "usage_count || input_encodings || show_in_default_list || " | 393 "usage_count || input_encodings || show_in_default_list || " |
| 394 "suggest_url || prepopulate_id || autogenerate_keyword || logo_id || " | 394 "suggest_url || prepopulate_id || autogenerate_keyword || logo_id || " |
| 395 "created_by_policy || instant_url || last_modified || sync_guid " | 395 "created_by_policy || instant_url || last_modified || sync_guid " |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 } | 532 } |
| 533 | 533 |
| 534 bool KeywordTable::UpdateDefaultSearchProviderBackup(TemplateURLID id) { | 534 bool KeywordTable::UpdateDefaultSearchProviderBackup(TemplateURLID id) { |
| 535 std::string backup; | 535 std::string backup; |
| 536 if (id != 0 && !GetTemplateURLBackup(id, &backup)) { | 536 if (id != 0 && !GetTemplateURLBackup(id, &backup)) { |
| 537 NOTREACHED() << "Failed to get the keyword with id " << id; | 537 NOTREACHED() << "Failed to get the keyword with id " << id; |
| 538 return false; | 538 return false; |
| 539 } | 539 } |
| 540 return meta_table_->SetValue(kDefaultSearchBackupKey, backup); | 540 return meta_table_->SetValue(kDefaultSearchBackupKey, backup); |
| 541 } | 541 } |
| OLD | NEW |