OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/search_engines/keyword_table.h" | 5 #include "components/search_engines/keyword_table.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 |
7 #include <set> | 9 #include <set> |
8 | 10 |
9 #include "base/json/json_reader.h" | 11 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
11 #include "base/logging.h" | 13 #include "base/logging.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
16 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 keywords->pop_back(); | 248 keywords->pop_back(); |
247 } | 249 } |
248 } | 250 } |
249 bool succeeded = s.Succeeded(); | 251 bool succeeded = s.Succeeded(); |
250 for (std::set<TemplateURLID>::const_iterator i(bad_entries.begin()); | 252 for (std::set<TemplateURLID>::const_iterator i(bad_entries.begin()); |
251 i != bad_entries.end(); ++i) | 253 i != bad_entries.end(); ++i) |
252 succeeded &= RemoveKeyword(*i); | 254 succeeded &= RemoveKeyword(*i); |
253 return succeeded; | 255 return succeeded; |
254 } | 256 } |
255 | 257 |
256 bool KeywordTable::SetDefaultSearchProviderID(int64 id) { | 258 bool KeywordTable::SetDefaultSearchProviderID(int64_t id) { |
257 return meta_table_->SetValue(kDefaultSearchProviderKey, id); | 259 return meta_table_->SetValue(kDefaultSearchProviderKey, id); |
258 } | 260 } |
259 | 261 |
260 int64 KeywordTable::GetDefaultSearchProviderID() { | 262 int64_t KeywordTable::GetDefaultSearchProviderID() { |
261 int64 value = kInvalidTemplateURLID; | 263 int64_t value = kInvalidTemplateURLID; |
262 meta_table_->GetValue(kDefaultSearchProviderKey, &value); | 264 meta_table_->GetValue(kDefaultSearchProviderKey, &value); |
263 return value; | 265 return value; |
264 } | 266 } |
265 | 267 |
266 bool KeywordTable::SetBuiltinKeywordVersion(int version) { | 268 bool KeywordTable::SetBuiltinKeywordVersion(int version) { |
267 return meta_table_->SetValue(kBuiltinKeywordVersion, version); | 269 return meta_table_->SetValue(kBuiltinKeywordVersion, version); |
268 } | 270 } |
269 | 271 |
270 int KeywordTable::GetBuiltinKeywordVersion() { | 272 int KeywordTable::GetBuiltinKeywordVersion() { |
271 int version = 0; | 273 int version = 0; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 } | 478 } |
477 } | 479 } |
478 | 480 |
479 // Replace the old table with the new one. | 481 // Replace the old table with the new one. |
480 sql = "DROP TABLE " + name; | 482 sql = "DROP TABLE " + name; |
481 if (!db_->Execute(sql.c_str())) | 483 if (!db_->Execute(sql.c_str())) |
482 return false; | 484 return false; |
483 sql = "ALTER TABLE keywords_temp RENAME TO " + name; | 485 sql = "ALTER TABLE keywords_temp RENAME TO " + name; |
484 return db_->Execute(sql.c_str()); | 486 return db_->Execute(sql.c_str()); |
485 } | 487 } |
OLD | NEW |