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_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/files/file_util.h" | 11 #include "base/files/file_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/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/process.h" | 15 #include "base/process/process_handle.h" |
16 #include "base/process/process_metrics.h" | 16 #include "base/process/process_metrics.h" |
17 #include "base/sha1.h" | 17 #include "base/sha1.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
20 #include "base/time/time.h" | 20 #include "base/time/time.h" |
21 #include "chrome/browser/safe_browsing/prefix_set.h" | 21 #include "chrome/browser/safe_browsing/prefix_set.h" |
22 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" | 22 #include "chrome/browser/safe_browsing/safe_browsing_store_file.h" |
23 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
24 #include "crypto/sha2.h" | 24 #include "crypto/sha2.h" |
25 #include "net/base/net_util.h" | 25 #include "net/base/net_util.h" |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1190 #if defined(OS_MACOSX) | 1190 #if defined(OS_MACOSX) |
1191 base::mac::SetFileBackupExclusion(store_filename); | 1191 base::mac::SetFileBackupExclusion(store_filename); |
1192 #endif | 1192 #endif |
1193 | 1193 |
1194 return GetFileSizeOrZero(store_filename); | 1194 return GetFileSizeOrZero(store_filename); |
1195 } | 1195 } |
1196 | 1196 |
1197 void SafeBrowsingDatabaseNew::UpdateBrowseStore() { | 1197 void SafeBrowsingDatabaseNew::UpdateBrowseStore() { |
1198 // Measure the amount of IO during the filter build. | 1198 // Measure the amount of IO during the filter build. |
1199 base::IoCounters io_before, io_after; | 1199 base::IoCounters io_before, io_after; |
1200 base::ProcessHandle handle = base::Process::Current().handle(); | 1200 base::ProcessHandle handle = base::GetCurrentProcessHandle(); |
1201 scoped_ptr<base::ProcessMetrics> metric( | 1201 scoped_ptr<base::ProcessMetrics> metric( |
1202 #if !defined(OS_MACOSX) | 1202 #if !defined(OS_MACOSX) |
1203 base::ProcessMetrics::CreateProcessMetrics(handle) | 1203 base::ProcessMetrics::CreateProcessMetrics(handle) |
1204 #else | 1204 #else |
1205 // Getting stats only for the current process is enough, so NULL is fine. | 1205 // Getting stats only for the current process is enough, so NULL is fine. |
1206 base::ProcessMetrics::CreateProcessMetrics(handle, NULL) | 1206 base::ProcessMetrics::CreateProcessMetrics(handle, NULL) |
1207 #endif | 1207 #endif |
1208 ); | 1208 ); |
1209 | 1209 |
1210 // IoCounters are currently not supported on Mac, and may not be | 1210 // IoCounters are currently not supported on Mac, and may not be |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1567 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { | 1567 bool SafeBrowsingDatabaseNew::IsMalwareIPMatchKillSwitchOn() { |
1568 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); | 1568 SBFullHash malware_kill_switch = SBFullHashForString(kMalwareIPKillSwitchUrl); |
1569 std::vector<SBFullHash> full_hashes; | 1569 std::vector<SBFullHash> full_hashes; |
1570 full_hashes.push_back(malware_kill_switch); | 1570 full_hashes.push_back(malware_kill_switch); |
1571 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); | 1571 return ContainsWhitelistedHashes(csd_whitelist_, full_hashes); |
1572 } | 1572 } |
1573 | 1573 |
1574 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { | 1574 bool SafeBrowsingDatabaseNew::IsCsdWhitelistKillSwitchOn() { |
1575 return csd_whitelist_.second; | 1575 return csd_whitelist_.second; |
1576 } | 1576 } |
OLD | NEW |