OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_database.h" | 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/metrics/stats_counters.h" | 14 #include "base/metrics/stats_counters.h" |
15 #include "base/process_util.h" | 15 #include "base/process_util.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #include "chrome/browser/safe_browsing/bloom_filter.h" | 17 #include "chrome/browser/safe_browsing/bloom_filter.h" |
18 #include "chrome/browser/safe_browsing/prefix_set.h" | 18 #include "chrome/browser/safe_browsing/prefix_set.h" |
19 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" | 19 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
21 #include "crypto/sha2.h" | 21 #include "crypto/sha2.h" |
22 #include "googleurl/src/gurl.h" | 22 #include "googleurl/src/gurl.h" |
23 | 23 |
24 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
25 #include "base/mac/mac_util.h" | 25 #include "base/mac/mac_util.h" |
26 #endif | 26 #endif |
27 | 27 |
| 28 using content::BrowserThread; |
| 29 |
28 namespace { | 30 namespace { |
29 | 31 |
30 // Filename suffix for the bloom filter. | 32 // Filename suffix for the bloom filter. |
31 const FilePath::CharType kBloomFilterFile[] = FILE_PATH_LITERAL(" Filter 2"); | 33 const FilePath::CharType kBloomFilterFile[] = FILE_PATH_LITERAL(" Filter 2"); |
32 // Filename suffix for download store. | 34 // Filename suffix for download store. |
33 const FilePath::CharType kDownloadDBFile[] = FILE_PATH_LITERAL(" Download"); | 35 const FilePath::CharType kDownloadDBFile[] = FILE_PATH_LITERAL(" Download"); |
34 // Filename suffix for client-side phishing detection whitelist store. | 36 // Filename suffix for client-side phishing detection whitelist store. |
35 const FilePath::CharType kCsdWhitelistDBFile[] = | 37 const FilePath::CharType kCsdWhitelistDBFile[] = |
36 FILE_PATH_LITERAL(" Csd Whitelist"); | 38 FILE_PATH_LITERAL(" Csd Whitelist"); |
37 // Filename suffix for the download whitelist store. | 39 // Filename suffix for the download whitelist store. |
(...skipping 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1428 if (std::binary_search(new_whitelist.begin(), new_whitelist.end(), | 1430 if (std::binary_search(new_whitelist.begin(), new_whitelist.end(), |
1429 kill_switch)) { | 1431 kill_switch)) { |
1430 // The kill switch is whitelisted hence we whitelist all URLs. | 1432 // The kill switch is whitelisted hence we whitelist all URLs. |
1431 WhitelistEverything(whitelist); | 1433 WhitelistEverything(whitelist); |
1432 } else { | 1434 } else { |
1433 base::AutoLock locked(lookup_lock_); | 1435 base::AutoLock locked(lookup_lock_); |
1434 whitelist->second = false; | 1436 whitelist->second = false; |
1435 whitelist->first.swap(new_whitelist); | 1437 whitelist->first.swap(new_whitelist); |
1436 } | 1438 } |
1437 } | 1439 } |
OLD | NEW |