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 <set> | 7 #include <set> |
8 | 8 |
9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 data->image_url = s.ColumnString(19); | 306 data->image_url = s.ColumnString(19); |
307 data->new_tab_url = s.ColumnString(24); | 307 data->new_tab_url = s.ColumnString(24); |
308 data->search_url_post_params = s.ColumnString(20); | 308 data->search_url_post_params = s.ColumnString(20); |
309 data->suggestions_url_post_params = s.ColumnString(21); | 309 data->suggestions_url_post_params = s.ColumnString(21); |
310 data->instant_url_post_params = s.ColumnString(22); | 310 data->instant_url_post_params = s.ColumnString(22); |
311 data->image_url_post_params = s.ColumnString(23); | 311 data->image_url_post_params = s.ColumnString(23); |
312 data->favicon_url = GURL(s.ColumnString(3)); | 312 data->favicon_url = GURL(s.ColumnString(3)); |
313 data->originating_url = GURL(s.ColumnString(6)); | 313 data->originating_url = GURL(s.ColumnString(6)); |
314 data->show_in_default_list = s.ColumnBool(10); | 314 data->show_in_default_list = s.ColumnBool(10); |
315 data->safe_for_autoreplace = s.ColumnBool(5); | 315 data->safe_for_autoreplace = s.ColumnBool(5); |
316 base::SplitString(s.ColumnString(9), ';', &data->input_encodings); | 316 data->input_encodings = base::SplitString( |
| 317 s.ColumnString(9), ";", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
317 data->id = s.ColumnInt64(0); | 318 data->id = s.ColumnInt64(0); |
318 data->date_created = Time::FromTimeT(s.ColumnInt64(7)); | 319 data->date_created = Time::FromTimeT(s.ColumnInt64(7)); |
319 data->last_modified = Time::FromTimeT(s.ColumnInt64(15)); | 320 data->last_modified = Time::FromTimeT(s.ColumnInt64(15)); |
320 data->created_by_policy = s.ColumnBool(13); | 321 data->created_by_policy = s.ColumnBool(13); |
321 data->usage_count = s.ColumnInt(8); | 322 data->usage_count = s.ColumnInt(8); |
322 data->prepopulate_id = s.ColumnInt(12); | 323 data->prepopulate_id = s.ColumnInt(12); |
323 data->sync_guid = s.ColumnString(16); | 324 data->sync_guid = s.ColumnString(16); |
324 | 325 |
325 data->alternate_urls.clear(); | 326 data->alternate_urls.clear(); |
326 base::JSONReader json_reader; | 327 base::JSONReader json_reader; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 } | 476 } |
476 } | 477 } |
477 | 478 |
478 // Replace the old table with the new one. | 479 // Replace the old table with the new one. |
479 sql = "DROP TABLE " + name; | 480 sql = "DROP TABLE " + name; |
480 if (!db_->Execute(sql.c_str())) | 481 if (!db_->Execute(sql.c_str())) |
481 return false; | 482 return false; |
482 sql = "ALTER TABLE keywords_temp RENAME TO " + name; | 483 sql = "ALTER TABLE keywords_temp RENAME TO " + name; |
483 return db_->Execute(sql.c_str()); | 484 return db_->Execute(sql.c_str()); |
484 } | 485 } |
OLD | NEW |