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/extensions/activity_log/activity_database.h" | 5 #include "chrome/browser/extensions/activity_log/activity_database.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 timer_.Stop(); | 195 timer_.Stop(); |
196 timer_.Start(FROM_HERE, | 196 timer_.Start(FROM_HERE, |
197 base::TimeDelta::FromMilliseconds(ms), | 197 base::TimeDelta::FromMilliseconds(ms), |
198 this, | 198 this, |
199 &ActivityDatabase::RecordBatchedActionsWhileTesting); | 199 &ActivityDatabase::RecordBatchedActionsWhileTesting); |
200 } | 200 } |
201 | 201 |
202 // static | 202 // static |
203 bool ActivityDatabase::InitializeTable(sql::Connection* db, | 203 bool ActivityDatabase::InitializeTable(sql::Connection* db, |
204 const char* table_name, | 204 const char* table_name, |
205 const char* content_fields[], | 205 const char* const content_fields[], |
206 const char* field_types[], | 206 const char* const field_types[], |
207 const int num_content_fields) { | 207 const int num_content_fields) { |
208 if (!db->DoesTableExist(table_name)) { | 208 if (!db->DoesTableExist(table_name)) { |
209 std::string table_creator = | 209 std::string table_creator = |
210 base::StringPrintf("CREATE TABLE %s (", table_name); | 210 base::StringPrintf("CREATE TABLE %s (", table_name); |
211 for (int i = 0; i < num_content_fields; i++) { | 211 for (int i = 0; i < num_content_fields; i++) { |
212 table_creator += base::StringPrintf("%s%s %s", | 212 table_creator += base::StringPrintf("%s%s %s", |
213 i == 0 ? "" : ", ", | 213 i == 0 ? "" : ", ", |
214 content_fields[i], | 214 content_fields[i], |
215 field_types[i]); | 215 field_types[i]); |
216 } | 216 } |
(...skipping 12 matching lines...) Expand all Loading... |
229 field_types[i]); | 229 field_types[i]); |
230 if (!db->Execute(table_updater.c_str())) | 230 if (!db->Execute(table_updater.c_str())) |
231 return false; | 231 return false; |
232 } | 232 } |
233 } | 233 } |
234 } | 234 } |
235 return true; | 235 return true; |
236 } | 236 } |
237 | 237 |
238 } // namespace extensions | 238 } // namespace extensions |
OLD | NEW |