| 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/keyword_table.h" | 5 #include "chrome/browser/webdata/keyword_table.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 s->BindString(starting_column + 8, JoinString(data.input_encodings, ';')); | 94 s->BindString(starting_column + 8, JoinString(data.input_encodings, ';')); |
| 95 s->BindBool(starting_column + 9, data.show_in_default_list); | 95 s->BindBool(starting_column + 9, data.show_in_default_list); |
| 96 s->BindString(starting_column + 10, data.suggestions_url); | 96 s->BindString(starting_column + 10, data.suggestions_url); |
| 97 s->BindInt(starting_column + 11, data.prepopulate_id); | 97 s->BindInt(starting_column + 11, data.prepopulate_id); |
| 98 s->BindBool(starting_column + 12, data.created_by_policy); | 98 s->BindBool(starting_column + 12, data.created_by_policy); |
| 99 s->BindString(starting_column + 13, data.instant_url); | 99 s->BindString(starting_column + 13, data.instant_url); |
| 100 s->BindInt64(starting_column + 14, data.last_modified.ToTimeT()); | 100 s->BindInt64(starting_column + 14, data.last_modified.ToTimeT()); |
| 101 s->BindString(starting_column + 15, data.sync_guid); | 101 s->BindString(starting_column + 15, data.sync_guid); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Signs search provider id and returns its signature. | |
| 105 std::string GetSearchProviderIDSignature(int64 id) { | |
| 106 return protector::SignSetting(base::Int64ToString(id)); | |
| 107 } | |
| 108 | |
| 109 // Checks if signature for search provider id is correct and returns the | |
| 110 // result. | |
| 111 bool IsSearchProviderIDValid(int64 id, const std::string& signature) { | |
| 112 return protector::IsSettingValid(base::Int64ToString(id), signature); | |
| 113 } | |
| 114 | |
| 115 } // anonymous namespace | 104 } // anonymous namespace |
| 116 | 105 |
| 117 KeywordTable::KeywordTable(sql::Connection* db, sql::MetaTable* meta_table) | 106 KeywordTable::KeywordTable(sql::Connection* db, sql::MetaTable* meta_table) |
| 118 : WebDatabaseTable(db, meta_table), | 107 : WebDatabaseTable(db, meta_table), |
| 119 backup_overwritten_(false) { | 108 backup_overwritten_(false) { |
| 120 } | 109 } |
| 121 | 110 |
| 122 KeywordTable::~KeywordTable() {} | 111 KeywordTable::~KeywordTable() {} |
| 123 | 112 |
| 124 bool KeywordTable::Init() { | 113 bool KeywordTable::Init() { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 } | 619 } |
| 631 } | 620 } |
| 632 | 621 |
| 633 // Replace the old table with the new one. | 622 // Replace the old table with the new one. |
| 634 sql = "DROP TABLE " + name; | 623 sql = "DROP TABLE " + name; |
| 635 if (!db_->Execute(sql.c_str())) | 624 if (!db_->Execute(sql.c_str())) |
| 636 return false; | 625 return false; |
| 637 sql = "ALTER TABLE keywords_temp RENAME TO " + name; | 626 sql = "ALTER TABLE keywords_temp RENAME TO " + name; |
| 638 return db_->Execute(sql.c_str()); | 627 return db_->Execute(sql.c_str()); |
| 639 } | 628 } |
| OLD | NEW |