| 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/safe_browsing/safe_browsing_store_file.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_file.h" | 8 #include "base/files/scoped_file.h" |
| 9 #include "base/md5.h" | 9 #include "base/md5.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| 11 #include "base/metrics/sparse_histogram.h" | 11 #include "base/metrics/sparse_histogram.h" |
| 12 #include "components/safe_browsing_db/prefix_set.h" | |
| 13 | 12 |
| 14 namespace { | 13 namespace { |
| 15 | 14 |
| 16 // NOTE(shess): kFileMagic should not be a byte-wise palindrome, so | 15 // NOTE(shess): kFileMagic should not be a byte-wise palindrome, so |
| 17 // that byte-order changes force corruption. | 16 // that byte-order changes force corruption. |
| 18 const int32 kFileMagic = 0x600D71FE; | 17 const int32 kFileMagic = 0x600D71FE; |
| 19 | 18 |
| 20 // Version history: | 19 // Version history: |
| 21 // Version 6: aad08754/r2814 by erikkay@google.com on 2008-10-02 (sqlite) | 20 // Version 6: aad08754/r2814 by erikkay@google.com on 2008-10-02 (sqlite) |
| 22 // Version 7: 6afe28a5/r37435 by shess@chromium.org on 2010-01-28 | 21 // Version 7: 6afe28a5/r37435 by shess@chromium.org on 2010-01-28 |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1156 // With SQLite support gone, one way to get to this code is if the | 1155 // With SQLite support gone, one way to get to this code is if the |
| 1157 // existing file is a SQLite file. Make sure the journal file is | 1156 // existing file is a SQLite file. Make sure the journal file is |
| 1158 // also removed. | 1157 // also removed. |
| 1159 const base::FilePath journal_filename( | 1158 const base::FilePath journal_filename( |
| 1160 basename.value() + FILE_PATH_LITERAL("-journal")); | 1159 basename.value() + FILE_PATH_LITERAL("-journal")); |
| 1161 if (base::PathExists(journal_filename)) | 1160 if (base::PathExists(journal_filename)) |
| 1162 base::DeleteFile(journal_filename, false); | 1161 base::DeleteFile(journal_filename, false); |
| 1163 | 1162 |
| 1164 return true; | 1163 return true; |
| 1165 } | 1164 } |
| OLD | NEW |