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/diagnostics/sqlite_diagnostics.h" | 5 #include "chrome/browser/diagnostics/sqlite_diagnostics.h" |
6 | 6 |
7 #include "base/base_paths.h" | 7 #include "base/base_paths.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
19 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
20 #include "chromeos/chromeos_constants.h" | 20 #include "chromeos/chromeos_constants.h" |
| 21 #include "components/history/core/browser/history_constants.h" |
21 #include "components/webdata/common/webdata_constants.h" | 22 #include "components/webdata/common/webdata_constants.h" |
22 #include "content/public/common/content_constants.h" | 23 #include "content/public/common/content_constants.h" |
23 #include "sql/connection.h" | 24 #include "sql/connection.h" |
24 #include "sql/statement.h" | 25 #include "sql/statement.h" |
25 #include "storage/browser/database/database_tracker.h" | 26 #include "storage/browser/database/database_tracker.h" |
26 #include "third_party/sqlite/sqlite3.h" | 27 #include "third_party/sqlite/sqlite3.h" |
27 | 28 |
28 namespace diagnostics { | 29 namespace diagnostics { |
29 | 30 |
30 namespace { | 31 namespace { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 databases_dir.Append(storage::kTrackerDatabaseFileName); | 213 databases_dir.Append(storage::kTrackerDatabaseFileName); |
213 return new SqliteIntegrityTest( | 214 return new SqliteIntegrityTest( |
214 SqliteIntegrityTest::NO_FLAGS_SET, | 215 SqliteIntegrityTest::NO_FLAGS_SET, |
215 DIAGNOSTICS_SQLITE_INTEGRITY_DATABASE_TRACKER_TEST, | 216 DIAGNOSTICS_SQLITE_INTEGRITY_DATABASE_TRACKER_TEST, |
216 tracker_db); | 217 tracker_db); |
217 } | 218 } |
218 | 219 |
219 DiagnosticsTest* MakeSqliteHistoryDbTest() { | 220 DiagnosticsTest* MakeSqliteHistoryDbTest() { |
220 return new SqliteIntegrityTest(SqliteIntegrityTest::CRITICAL, | 221 return new SqliteIntegrityTest(SqliteIntegrityTest::CRITICAL, |
221 DIAGNOSTICS_SQLITE_INTEGRITY_HISTORY_TEST, | 222 DIAGNOSTICS_SQLITE_INTEGRITY_HISTORY_TEST, |
222 base::FilePath(chrome::kHistoryFilename)); | 223 base::FilePath(history::kHistoryFilename)); |
223 } | 224 } |
224 | 225 |
225 #if defined(OS_CHROMEOS) | 226 #if defined(OS_CHROMEOS) |
226 DiagnosticsTest* MakeSqliteNssCertDbTest() { | 227 DiagnosticsTest* MakeSqliteNssCertDbTest() { |
227 base::FilePath home_dir; | 228 base::FilePath home_dir; |
228 PathService::Get(base::DIR_HOME, &home_dir); | 229 PathService::Get(base::DIR_HOME, &home_dir); |
229 return new SqliteIntegrityTest(SqliteIntegrityTest::REMOVE_IF_CORRUPT, | 230 return new SqliteIntegrityTest(SqliteIntegrityTest::REMOVE_IF_CORRUPT, |
230 DIAGNOSTICS_SQLITE_INTEGRITY_NSS_CERT_TEST, | 231 DIAGNOSTICS_SQLITE_INTEGRITY_NSS_CERT_TEST, |
231 home_dir.Append(chromeos::kNssCertDbPath)); | 232 home_dir.Append(chromeos::kNssCertDbPath)); |
232 } | 233 } |
233 | 234 |
234 DiagnosticsTest* MakeSqliteNssKeyDbTest() { | 235 DiagnosticsTest* MakeSqliteNssKeyDbTest() { |
235 base::FilePath home_dir; | 236 base::FilePath home_dir; |
236 PathService::Get(base::DIR_HOME, &home_dir); | 237 PathService::Get(base::DIR_HOME, &home_dir); |
237 return new SqliteIntegrityTest(SqliteIntegrityTest::REMOVE_IF_CORRUPT, | 238 return new SqliteIntegrityTest(SqliteIntegrityTest::REMOVE_IF_CORRUPT, |
238 DIAGNOSTICS_SQLITE_INTEGRITY_NSS_KEY_TEST, | 239 DIAGNOSTICS_SQLITE_INTEGRITY_NSS_KEY_TEST, |
239 home_dir.Append(chromeos::kNssKeyDbPath)); | 240 home_dir.Append(chromeos::kNssKeyDbPath)); |
240 } | 241 } |
241 #endif // defined(OS_CHROMEOS) | 242 #endif // defined(OS_CHROMEOS) |
242 | 243 |
243 DiagnosticsTest* MakeSqliteThumbnailsDbTest() { | 244 DiagnosticsTest* MakeSqliteThumbnailsDbTest() { |
244 return new SqliteIntegrityTest(SqliteIntegrityTest::NO_FLAGS_SET, | 245 return new SqliteIntegrityTest(SqliteIntegrityTest::NO_FLAGS_SET, |
245 DIAGNOSTICS_SQLITE_INTEGRITY_THUMBNAILS_TEST, | 246 DIAGNOSTICS_SQLITE_INTEGRITY_THUMBNAILS_TEST, |
246 base::FilePath(chrome::kThumbnailsFilename)); | 247 base::FilePath(history::kThumbnailsFilename)); |
247 } | 248 } |
248 | 249 |
249 DiagnosticsTest* MakeSqliteWebDataDbTest() { | 250 DiagnosticsTest* MakeSqliteWebDataDbTest() { |
250 return new SqliteIntegrityTest(SqliteIntegrityTest::CRITICAL, | 251 return new SqliteIntegrityTest(SqliteIntegrityTest::CRITICAL, |
251 DIAGNOSTICS_SQLITE_INTEGRITY_WEB_DATA_TEST, | 252 DIAGNOSTICS_SQLITE_INTEGRITY_WEB_DATA_TEST, |
252 base::FilePath(kWebDataFilename)); | 253 base::FilePath(kWebDataFilename)); |
253 } | 254 } |
254 | 255 |
255 } // namespace diagnostics | 256 } // namespace diagnostics |
OLD | NEW |