Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: components/search_engines/keyword_table.cc

Issue 1223153003: Move JoinString to the base namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: windows Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 columns.push_back("search_url_post_params"); 73 columns.push_back("search_url_post_params");
74 columns.push_back("suggest_url_post_params"); 74 columns.push_back("suggest_url_post_params");
75 columns.push_back("instant_url_post_params"); 75 columns.push_back("instant_url_post_params");
76 columns.push_back("image_url_post_params"); 76 columns.push_back("image_url_post_params");
77 } 77 }
78 if (version >= 53) { 78 if (version >= 53) {
79 // Column added in version 53. 79 // Column added in version 53.
80 columns.push_back("new_tab_url"); 80 columns.push_back("new_tab_url");
81 } 81 }
82 82
83 return JoinString(columns, std::string(concatenated ? " || " : ", ")); 83 return base::JoinString(columns, std::string(concatenated ? " || " : ", "));
84 } 84 }
85 85
86 86
87 // Inserts the data from |data| into |s|. |s| is assumed to have slots for all 87 // Inserts the data from |data| into |s|. |s| is assumed to have slots for all
88 // the columns in the keyword table. |id_column| is the slot number to bind 88 // the columns in the keyword table. |id_column| is the slot number to bind
89 // |data|'s |id| to; |starting_column| is the slot number of the first of a 89 // |data|'s |id| to; |starting_column| is the slot number of the first of a
90 // contiguous set of slots to bind all the other fields to. 90 // contiguous set of slots to bind all the other fields to.
91 void BindURLToStatement(const TemplateURLData& data, 91 void BindURLToStatement(const TemplateURLData& data,
92 sql::Statement* s, 92 sql::Statement* s,
93 int id_column, 93 int id_column,
(...skipping 14 matching lines...) Expand all
108 s->BindString(starting_column + 2, data.favicon_url.is_valid() ? 108 s->BindString(starting_column + 2, data.favicon_url.is_valid() ?
109 history::URLDatabase::GURLToDatabaseURL(data.favicon_url) : 109 history::URLDatabase::GURLToDatabaseURL(data.favicon_url) :
110 std::string()); 110 std::string());
111 s->BindString(starting_column + 3, data.url()); 111 s->BindString(starting_column + 3, data.url());
112 s->BindBool(starting_column + 4, data.safe_for_autoreplace); 112 s->BindBool(starting_column + 4, data.safe_for_autoreplace);
113 s->BindString(starting_column + 5, data.originating_url.is_valid() ? 113 s->BindString(starting_column + 5, data.originating_url.is_valid() ?
114 history::URLDatabase::GURLToDatabaseURL(data.originating_url) : 114 history::URLDatabase::GURLToDatabaseURL(data.originating_url) :
115 std::string()); 115 std::string());
116 s->BindInt64(starting_column + 6, data.date_created.ToTimeT()); 116 s->BindInt64(starting_column + 6, data.date_created.ToTimeT());
117 s->BindInt(starting_column + 7, data.usage_count); 117 s->BindInt(starting_column + 7, data.usage_count);
118 s->BindString(starting_column + 8, JoinString(data.input_encodings, ';')); 118 s->BindString(starting_column + 8,
119 base::JoinString(data.input_encodings, ";"));
119 s->BindBool(starting_column + 9, data.show_in_default_list); 120 s->BindBool(starting_column + 9, data.show_in_default_list);
120 s->BindString(starting_column + 10, data.suggestions_url); 121 s->BindString(starting_column + 10, data.suggestions_url);
121 s->BindInt(starting_column + 11, data.prepopulate_id); 122 s->BindInt(starting_column + 11, data.prepopulate_id);
122 s->BindBool(starting_column + 12, data.created_by_policy); 123 s->BindBool(starting_column + 12, data.created_by_policy);
123 s->BindString(starting_column + 13, data.instant_url); 124 s->BindString(starting_column + 13, data.instant_url);
124 s->BindInt64(starting_column + 14, data.last_modified.ToTimeT()); 125 s->BindInt64(starting_column + 14, data.last_modified.ToTimeT());
125 s->BindString(starting_column + 15, data.sync_guid); 126 s->BindString(starting_column + 15, data.sync_guid);
126 s->BindString(starting_column + 16, alternate_urls); 127 s->BindString(starting_column + 16, alternate_urls);
127 s->BindString(starting_column + 17, data.search_terms_replacement_key); 128 s->BindString(starting_column + 17, data.search_terms_replacement_key);
128 s->BindString(starting_column + 18, data.image_url); 129 s->BindString(starting_column + 18, data.image_url);
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 474 }
474 } 475 }
475 476
476 // Replace the old table with the new one. 477 // Replace the old table with the new one.
477 sql = "DROP TABLE " + name; 478 sql = "DROP TABLE " + name;
478 if (!db_->Execute(sql.c_str())) 479 if (!db_->Execute(sql.c_str()))
479 return false; 480 return false;
480 sql = "ALTER TABLE keywords_temp RENAME TO " + name; 481 sql = "ALTER TABLE keywords_temp RENAME TO " + name;
481 return db_->Execute(sql.c_str()); 482 return db_->Execute(sql.c_str());
482 } 483 }
OLDNEW
« no previous file with comments | « components/search_engines/default_search_pref_migration_unittest.cc ('k') | components/search_engines/template_url.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698